(file) Return to CIMValue.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/CIMValue.cpp between version 1.11.2.12 and 1.24

version 1.11.2.12, 2001/12/02 06:23:26 version 1.24, 2002/04/01 19:06:03
Line 23 
Line 23 
 // Author: Mike Brasher (mbrasher@bmc.com) // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
   //              Karl Schopmeyer, (k.schopmeyer@opengroup.org)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 59 
Line 60 
 // //
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
   // Too complicated.  Commented out in favor of sprintf("%lld"/"%llu").
   #if 0
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // _SignedIntToStr() // _SignedIntToStr()
Line 77 
Line 80 
         return;         return;
     }     }
  
     char buffer[256];      char buffer[32];
     Uint32 len = 0;     Uint32 len = 0;
     Boolean negative = false;     Boolean negative = false;
  
     for (Uint32 i = 0; 1; i++)      while (x)
     {     {
         Sint64 q = x / 10;  
         Sint32 r = x % 10;         Sint32 r = x % 10;
           x = x / 10;
         if (q == 0 && r == 0)  
             break;  
  
         if (r < 0)         if (r < 0)
         {         {
Line 96 
Line 96 
         }         }
  
         buffer[len++] = r + '0';         buffer[len++] = r + '0';
   
         x = q ;  
     }     }
  
     buffer[len] = '\0';     buffer[len] = '\0';
Line 137 
Line 135 
         return;         return;
     }     }
  
     char buffer[256];      char buffer[32];
     Uint32 len = 0;     Uint32 len = 0;
     Boolean negative = false;  
  
     for (Uint32 i = 0; 1; i++)      while (x)
     {     {
         Sint64 q = x / 10;          Uint32 r = x % 10;
         Sint32 r = x % 10;          x = x / 10;
   
         if (q == 0 && r == 0)  
             break;  
  
         buffer[len++] = r + '0';         buffer[len++] = r + '0';
   
         x = q ;  
     }     }
  
     buffer[len] = '\0';     buffer[len] = '\0';
Line 167 
Line 159 
  
     *q++ = '\0';     *q++ = '\0';
 } }
   #endif
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
Line 182 
Line 175 
 inline void _toXml(Array<Sint8>& out, Boolean x) { _toString(out, x); } inline void _toXml(Array<Sint8>& out, Boolean x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Boolean x) { _toString(out, x); } inline void _toMof(Array<Sint8>& out, Boolean x) { _toString(out, x); }
  
 template<class T>  inline void _integerToString(Array<Sint8>& out, Sint32 x)
 inline void _integerToString(Array<Sint8>& out, const T& x)  
 { {
     char buffer[32];     char buffer[32];
     sprintf(buffer, "%d", x);     sprintf(buffer, "%d", x);
     out << (char*)buffer;     out << (char*)buffer;
 } }
  
 inline void _toString(Array<Sint8>& out, Uint8 x) { _integerToString(out, x); }  inline void _unsignedIntegerToString(Array<Sint8>& out, Uint32 x)
 inline void _toXml(Array<Sint8>& out, Uint8 x) { _integerToString(out, x); }  {
 inline void _toMof(Array<Sint8>& out, Uint8 x) { _integerToString(out, x); }      char buffer[32];
       sprintf(buffer, "%u", x);
       out << (char*)buffer;
   }
   
   inline void _toString(Array<Sint8>& out, Uint8 x) { _unsignedIntegerToString(out, x); }
   inline void _toXml(Array<Sint8>& out, Uint8 x) { _toString(out, x); }
   inline void _toMof(Array<Sint8>& out, Uint8 x) { _toString(out, x); }
  
 inline void _toString(Array<Sint8>& out, Sint8 x) { _integerToString(out, x); } inline void _toString(Array<Sint8>& out, Sint8 x) { _integerToString(out, x); }
 inline void _toXml(Array<Sint8>& out, Sint8 x) { _integerToString(out, x); }  inline void _toXml(Array<Sint8>& out, Sint8 x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Sint8 x) { _integerToString(out, x); }  inline void _toMof(Array<Sint8>& out, Sint8 x) { _toString(out, x); }
  
 inline void _toString(Array<Sint8>& out, Uint16 x) { _integerToString(out, x); }  inline void _toString(Array<Sint8>& out, Uint16 x) { _unsignedIntegerToString(out, x); }
 inline void _toXml(Array<Sint8>& out, Uint16 x) { _integerToString(out, x); }  inline void _toXml(Array<Sint8>& out, Uint16 x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Uint16 x) { _integerToString(out, x); }  inline void _toMof(Array<Sint8>& out, Uint16 x) { _toString(out, x); }
  
 inline void _toString(Array<Sint8>& out, Sint16 x) { _integerToString(out, x); } inline void _toString(Array<Sint8>& out, Sint16 x) { _integerToString(out, x); }
 inline void _toXml(Array<Sint8>& out, Sint16 x) { _integerToString(out, x); }  inline void _toXml(Array<Sint8>& out, Sint16 x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Sint16 x) { _integerToString(out, x); }  inline void _toMof(Array<Sint8>& out, Sint16 x) { _toString(out, x); }
  
 inline void _toString(Array<Sint8>& out, Uint32 x) { _integerToString(out, x); }  inline void _toString(Array<Sint8>& out, Uint32 x) { _unsignedIntegerToString(out, x); }
 inline void _toXml(Array<Sint8>& out, Uint32 x) { _integerToString(out, x); }  inline void _toXml(Array<Sint8>& out, Uint32 x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Uint32 x) { _integerToString(out, x); }  inline void _toMof(Array<Sint8>& out, Uint32 x) { _toString(out, x); }
  
 inline void _toString(Array<Sint8>& out, Sint32 x) { _integerToString(out, x); } inline void _toString(Array<Sint8>& out, Sint32 x) { _integerToString(out, x); }
 inline void _toXml(Array<Sint8>& out, Sint32 x) { _integerToString(out, x); }  inline void _toXml(Array<Sint8>& out, Sint32 x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Sint32 x) { _integerToString(out, x); }  inline void _toMof(Array<Sint8>& out, Sint32 x) { _toString(out, x); }
  
 inline void _toString(Array<Sint8>& out, Uint64 x) inline void _toString(Array<Sint8>& out, Uint64 x)
 { {
     char buffer[128];      char buffer[32];  // Should need 21 chars max
     _UnsignedIntToStr(x, buffer);      // I know I shouldn't put platform flags here, but the other was is too hard
   #if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)
       sprintf(buffer, "%I64u", x);
   #else
       sprintf(buffer, "%llu", x);
   #endif
     out << buffer;     out << buffer;
 } }
  
Line 226 
Line 230 
  
 inline void _toString(Array<Sint8>& out, Sint64 x) inline void _toString(Array<Sint8>& out, Sint64 x)
 { {
     char buffer[128];      char buffer[32];  // Should need 21 chars max
     _SignedIntToStr(x, buffer);      // I know I shouldn't put platform flags here, but the other was is too hard
   #if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)
       sprintf(buffer, "%I64d", x);
   #else
       sprintf(buffer, "%lld", x);
   #endif
     out << buffer;     out << buffer;
 } }
  
 inline void _toXml(Array<Sint8>& out, Sint64 x) { _toString(out, x); } inline void _toXml(Array<Sint8>& out, Sint64 x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Sint64 x) { _toString(out, x); } inline void _toMof(Array<Sint8>& out, Sint64 x) { _toString(out, x); }
  
 void _toString(Array<Sint8>& out, Real32 x)  
 {  
     char buffer[128];  
     // ATTN: Does this format match the CIM/XML format?  
     sprintf(buffer, "%f", x);  
     out << buffer;  
 }  
   
 inline void _toXml(Array<Sint8>& out, Real32 x) { _toString(out, x); }  
 inline void _toMof(Array<Sint8>& out, Real32 x) { _toString(out, x); }  
   
 void _toString(Array<Sint8>& out, Real64 x) void _toString(Array<Sint8>& out, Real64 x)
 { {
     char buffer[128];     char buffer[128];
     // ATTN: Does this format match the CIM/XML format?      // %e gives '[-]m.dddddde+/-xx', which seems compatible with CIM/XML spec
     sprintf(buffer, "%f", x);      sprintf(buffer, "%e", x);
     out << buffer;     out << buffer;
 } }
  
 inline void _toXml(Array<Sint8>& out, Real64 x) { _toString(out, x); } inline void _toXml(Array<Sint8>& out, Real64 x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, Real64 x) { _toString(out, x); } inline void _toMof(Array<Sint8>& out, Real64 x) { _toString(out, x); }
  
   inline void _toString(Array<Sint8>& out, Real32 x) { _toString(out, Real64(x)); }
   inline void _toXml(Array<Sint8>& out, Real32 x) { _toString(out, x); }
   inline void _toMof(Array<Sint8>& out, Real32 x) { _toString(out, x); }
   
 inline void _toString(Array<Sint8>& out, Char16 x) inline void _toString(Array<Sint8>& out, Char16 x)
 { {
     // ATTN: How to convert 16-bit characters to printable form?     // ATTN: How to convert 16-bit characters to printable form?
Line 353 
Line 355 
 inline void _toXml(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); } inline void _toXml(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); }
 inline void _toMof(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); } inline void _toMof(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); }
  
   inline void _toString(Array<Sint8>& out, const CIMReference& x)
   {
       out << x.toString();
   }
   inline void _toXml(Array<Sint8>& out, const CIMReference& x)
   {
       x.toXml(out);
   }
   inline void _toMof(Array<Sint8>& out, const CIMReference& x)
   {
       x.toMof(out);
   }
   
 template<class T> template<class T>
 void _toString(Array<Sint8>& out, const T* p, Uint32 size) void _toString(Array<Sint8>& out, const T* p, Uint32 size)
 { {
Line 363 
Line 378 
     }     }
 } }
  
   void _toXml(Array<Sint8>& out, const CIMReference* p, Uint32 size)
   {
       out << "<VALUE.REFARRAY>\n";
       while (size--)
       {
           _toXml(out, *p++);
       }
       out << "</VALUE.REFARRAY>\n";
   }
   
 template<class T> template<class T>
 void _toXml(Array<Sint8>& out, const T* p, Uint32 size) void _toXml(Array<Sint8>& out, const T* p, Uint32 size)
 { {
       out << "<VALUE.ARRAY>\n";
   
     while (size--)     while (size--)
     {     {
         out << "<VALUE>";         out << "<VALUE>";
Line 374 
Line 401 
  
         out << "</VALUE>\n";         out << "</VALUE>\n";
     }     }
   
       out << "</VALUE.ARRAY>\n";
 } }
 /** _toMof Array - /** _toMof Array -
     arrayInitializer  = "{" constantValue*( "," constantValue)"}"     arrayInitializer  = "{" constantValue*( "," constantValue)"}"
Line 413 
Line 442 
     _init();     _init();
 } }
  
   CIMValue::CIMValue(CIMType type, Boolean isArray, Uint32 arraySize)
   {
       _init();
       setNullValue(type, isArray, arraySize);
   }
   
 CIMValue::CIMValue(const CIMValue& x) CIMValue::CIMValue(const CIMValue& x)
 { {
     _init();     _init();
Line 495 
Line 530 
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _Inc(_u._dateTimeArray = x._u._dateTimeArray);                 _Inc(_u._dateTimeArray = x._u._dateTimeArray);
                 break;                 break;
   
               case CIMType::REFERENCE:
                   _Inc(_u._referenceArray = x._u._referenceArray);
                   break;
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
     else     else
Line 553 
Line 594 
                 break;                 break;
  
             case CIMType::STRING:             case CIMType::STRING:
                 new(_u._stringValue) String(*((String*)x._u._stringValue));                  _u._stringValue = new String(*(x._u._stringValue));
                 break;                 break;
  
             case CIMType::DATETIME:             case CIMType::DATETIME:
Line 564 
Line 605 
                 _u._referenceValue                 _u._referenceValue
                     = new CIMReference(*(x._u._referenceValue));                     = new CIMReference(*(x._u._referenceValue));
                 break;                 break;
   
               // Should never get here. testing complete enum
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
 } }
Line 636 
Line 681 
             break;             break;
  
         case CIMType::REFERENCE:         case CIMType::REFERENCE:
             return 0;              return _u._referenceArray->size;
               break;
           // Should never get here. switch on complete enum
           default:
               throw CIMValueInvalidType();
     }     }
  
     // Unreachable!     // Unreachable!
Line 644 
Line 693 
     return 0;     return 0;
 } }
  
   //ATTN: P1  KS Problem with Compiler when I added the defaults to clear, the compiler
   // gets an exception very early.  Disabled the exceptions to keep compiler running for
   // the minute. Note that the case statement is not complete. None missing.
 void CIMValue::clear() void CIMValue::clear()
 { {
       // ATTN: KS P1 should we be setting NULL=true here????. Right now it only
       // clears the value component. Note that the last thing we do is init
       // and that does the isNull=false.
       //
     if (_isArray)     if (_isArray)
     {     {
         switch (_type)         switch (_type)
Line 705 
Line 761 
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _Dec(_u._dateTimeArray);                 _Dec(_u._dateTimeArray);
                 break;                 break;
   
               case CIMType::REFERENCE:
                   _Dec(_u._referenceArray);
                   break;
   
               //default:
                   //throw CIMValueInvalidType();
         }         }
     }     }
     else     else
Line 726 
Line 789 
                 break;                 break;
  
             case CIMType::STRING:             case CIMType::STRING:
                 ((String*)_u._stringValue)->~String();                  delete _u._stringValue;
                 break;                 break;
  
             case CIMType::DATETIME:             case CIMType::DATETIME:
Line 736 
Line 799 
             case CIMType::REFERENCE:             case CIMType::REFERENCE:
                 delete _u._referenceValue;                 delete _u._referenceValue;
                 break;                 break;
               //default:
                   //throw CIMValueInvalidType();
         }         }
     }     }
  
     _init();     _init();
 } }
  
 void CIMValue::toXml(Array<Sint8>& out) const  void CIMValue::toXml(Array<Sint8>& out, Boolean forceTag) const
   {
       /* If the CIMValue is Null, no element is returned.
        Note that it output absolutely nothing. This works for
        everything except qualifiers where the value tag is required in
        any case per the XML specification
       */
   
       if (_isNull)
 { {
           if (forceTag)
               if (_isArray)
                   out << "<VALUE.ARRAY></VALUE.ARRAY>\n";
               else
                   out << "<VALUE></VALUE>\n";
           return;
       }
     if (_isArray)     if (_isArray)
     {     {
         out << "<VALUE.ARRAY>\n";  
   
         switch (_type)         switch (_type)
         {         {
             case CIMType::BOOLEAN:             case CIMType::BOOLEAN:
             {             {
                   // ATTN-RK-P3-20020220: Why can't this just use
                   // _toXml(out, _u._booleanArray->data(), _u._booleanArray->size);
                   // like everybody else?
                   out << "<VALUE.ARRAY>\n";
   
                 for (Uint32 i = 0, n = _u._booleanArray->size; i < n; i++)                 for (Uint32 i = 0, n = _u._booleanArray->size; i < n; i++)
                 {                 {
                     out << "<VALUE>";                     out << "<VALUE>";
                     _toXml(out, Boolean(_u._booleanArray->data()[i]));                     _toXml(out, Boolean(_u._booleanArray->data()[i]));
                     out << "</VALUE>\n";                     out << "</VALUE>\n";
                 }                 }
   
                   out << "</VALUE.ARRAY>\n";
                 break;                 break;
             }             }
  
Line 812 
Line 897 
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _toXml(out, _u._dateTimeArray->data(), _u._dateTimeArray->size);                 _toXml(out, _u._dateTimeArray->data(), _u._dateTimeArray->size);
                 break;                 break;
         }  
  
         out << "</VALUE.ARRAY>\n";              case CIMType::REFERENCE:
                   _toXml(out, _u._referenceArray->data(),
                               _u._referenceArray->size);
                   break;
   
               default:
                   throw CIMValueInvalidType();
           }
     }     }
     else if (_type == CIMType::REFERENCE)     else if (_type == CIMType::REFERENCE)
     {     {
         _u._referenceValue->toXml(out);          // Has to be separate because it uses VALUE.REFERENCE tag
           _toXml(out, *_u._referenceValue);
     }     }
     else     else
     {     {
Line 875 
Line 967 
                 break;                 break;
  
             case CIMType::STRING:             case CIMType::STRING:
                 _toXml(out, *((String*)_u._stringValue));                  _toXml(out, *_u._stringValue);
                 break;                 break;
  
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _toXml(out, *_u._dateTimeValue);                 _toXml(out, *_u._dateTimeValue);
                 break;                 break;
               default:
                   throw CIMValueInvalidType();
         }         }
  
         out << "</VALUE>\n";         out << "</VALUE>\n";
     }     }
 } }
  
 String CIMValue::toXml() const  String CIMValue::toXml(Boolean forceTag) const
 { {
     Array<Sint8> out;     Array<Sint8> out;
     toXml(out);      toXml(out, forceTag);
     out.append('\0');     out.append('\0');
     return String(out.getData());     return String(out.getData());
 } }
  
 void CIMValue::toMof(Array<Sint8>& out) const    //ATTNKS:  void CIMValue::toMof(Array<Sint8>& out) const
   {
       // if the CIMValue is Null we return nothing.
       // The alternative is to return the Null indicator.
       if (_isNull)
 { {
           out << "null";
           return ;
       }
   
   
     if (_isArray)     if (_isArray)
     {     {
         switch (_type)         switch (_type)
         {         {
             case CIMType::BOOLEAN:             case CIMType::BOOLEAN:
             {             {
                 for (Uint32 i = 0, n = _u._booleanArray->size; i < n; i++)                  _toMof(out, _u._booleanArray->data(), _u._booleanArray->size);
                 {  
                     _toMof(out, Boolean(_u._booleanArray->data()[i]));  
                 }  
                 break;                 break;
             }             }
             case CIMType::UINT8:             case CIMType::UINT8:
Line 959 
Line 1059 
  
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _toMof(out, _u._dateTimeArray->data(),                 _toMof(out, _u._dateTimeArray->data(),
                             _u._dateTimeArray->size); break;                              _u._dateTimeArray->size);
         }                  break;
   
               case CIMType::REFERENCE:
                   _toMof(out, _u._referenceArray->data(),
                               _u._referenceArray->size);
                   break;
   
               default:
                   throw CIMValueInvalidType();
     }     }
     else if (_type == CIMType::REFERENCE)  
     {  
         _u._referenceValue->toMof(out);  
     }     }
     else     else
     {     {
Line 1019 
Line 1124 
                 break;                 break;
  
             case CIMType::STRING:             case CIMType::STRING:
                 _toMof(out, *((String*)_u._stringValue));                  _toMof(out, *_u._stringValue);
                 break;                 break;
  
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _toMof(out, *_u._dateTimeValue);                 _toMof(out, *_u._dateTimeValue);
                 break;                 break;
   
               case CIMType::REFERENCE:
                   _toMof(out, *_u._referenceValue);
                   break;
   
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
 } }
  
  
 void CIMValue::print(PEGASUS_STD(ostream) &os) const  void CIMValue::print( Boolean forceTag, PEGASUS_STD(ostream) &os) const
 { {
     Array<Sint8> tmp;     Array<Sint8> tmp;
     toXml(tmp);      toXml(tmp, forceTag);
     tmp.append('\0');     tmp.append('\0');
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
   
 void CIMValue::set(Boolean x) void CIMValue::set(Boolean x)
 { {
     clear();     clear();
     _u._booleanValue = (Uint8)x;     _u._booleanValue = (Uint8)x;
     _type = CIMType::BOOLEAN;     _type = CIMType::BOOLEAN;
       _isNull = false;
 } }
  
 void CIMValue::set(Uint8 x) void CIMValue::set(Uint8 x)
Line 1050 
Line 1164 
     clear();     clear();
     _u._uint8Value = x;     _u._uint8Value = x;
     _type = CIMType::UINT8;     _type = CIMType::UINT8;
       _isNull = false;
 } }
  
 void CIMValue::set(Sint8 x) void CIMValue::set(Sint8 x)
Line 1057 
Line 1172 
     clear();     clear();
     _u._sint8Value = x;     _u._sint8Value = x;
     _type = CIMType::SINT8;     _type = CIMType::SINT8;
       _isNull = false;
 } }
  
 void CIMValue::set(Uint16 x) void CIMValue::set(Uint16 x)
Line 1064 
Line 1180 
     clear();     clear();
     _u._uint16Value = x;     _u._uint16Value = x;
     _type = CIMType::UINT16;     _type = CIMType::UINT16;
       _isNull = false;
 } }
  
 void CIMValue::set(Sint16 x) void CIMValue::set(Sint16 x)
Line 1071 
Line 1188 
     clear();     clear();
     _u._sint16Value = x;     _u._sint16Value = x;
     _type = CIMType::SINT16;     _type = CIMType::SINT16;
       _isNull = false;
 } }
  
 void CIMValue::set(Uint32 x) void CIMValue::set(Uint32 x)
Line 1078 
Line 1196 
     clear();     clear();
     _u._uint32Value = x;     _u._uint32Value = x;
     _type = CIMType::UINT32;     _type = CIMType::UINT32;
       _isNull = false;
 } }
  
 void CIMValue::set(Sint32 x) void CIMValue::set(Sint32 x)
Line 1085 
Line 1204 
     clear();     clear();
     _u._sint32Value = x;     _u._sint32Value = x;
     _type = CIMType::SINT32;     _type = CIMType::SINT32;
       _isNull = false;
 } }
  
 void CIMValue::set(Uint64 x) void CIMValue::set(Uint64 x)
Line 1092 
Line 1212 
     clear();     clear();
     _u._uint64Value = x;     _u._uint64Value = x;
     _type = CIMType::UINT64;     _type = CIMType::UINT64;
       _isNull = false;
 } }
  
 void CIMValue::set(Sint64 x) void CIMValue::set(Sint64 x)
Line 1099 
Line 1220 
     clear();     clear();
     _u._sint64Value = x;     _u._sint64Value = x;
     _type = CIMType::SINT64;     _type = CIMType::SINT64;
       _isNull = false;
 } }
  
 void CIMValue::set(Real32 x) void CIMValue::set(Real32 x)
Line 1106 
Line 1228 
     clear();     clear();
     _u._real32Value = x;     _u._real32Value = x;
     _type = CIMType::REAL32;     _type = CIMType::REAL32;
       _isNull = false;
 } }
  
 void CIMValue::set(Real64 x) void CIMValue::set(Real64 x)
Line 1113 
Line 1236 
     clear();     clear();
     _u._real64Value = x;     _u._real64Value = x;
     _type = CIMType::REAL64;     _type = CIMType::REAL64;
       _isNull = false;
 } }
  
 void CIMValue::set(const Char16& x) void CIMValue::set(const Char16& x)
Line 1120 
Line 1244 
     clear();     clear();
     _u._char16Value = x;     _u._char16Value = x;
     _type = CIMType::CHAR16;     _type = CIMType::CHAR16;
       _isNull = false;
 } }
  
 void CIMValue::set(const String& x) void CIMValue::set(const String& x)
 { {
     clear();     clear();
     new(_u._stringValue) String(x);      _u._stringValue = new String(x);
     _type = CIMType::STRING;     _type = CIMType::STRING;
       _isNull = false;
 } }
  
 void CIMValue::set(const char* x) void CIMValue::set(const char* x)
 { {
     set(String(x));     set(String(x));
       _isNull = false;
 } }
  
 void CIMValue::set(const CIMDateTime& x) void CIMValue::set(const CIMDateTime& x)
Line 1139 
Line 1266 
     clear();     clear();
     _u._dateTimeValue = new CIMDateTime(x);     _u._dateTimeValue = new CIMDateTime(x);
     _type = CIMType::DATETIME;     _type = CIMType::DATETIME;
       _isNull = false;
 } }
  
 void CIMValue::set(const CIMReference& x) void CIMValue::set(const CIMReference& x)
Line 1146 
Line 1274 
     clear();     clear();
     _u._referenceValue = new CIMReference(x);     _u._referenceValue = new CIMReference(x);
     _type = CIMType::REFERENCE;     _type = CIMType::REFERENCE;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Boolean>& x) void CIMValue::set(const Array<Boolean>& x)
Line 1274 
Line 1403 
     _isNull = false;     _isNull = false;
 } }
  
   void CIMValue::set(const Array<CIMReference>& x)
   {
       clear();
       _Inc(_u._referenceArray = x._rep);
       _type = CIMType::REFERENCE;
       _isArray = true;
       _isNull = false;
   }
   
 void CIMValue::get(Boolean& x) const void CIMValue::get(Boolean& x) const
 { {
     if (_type != CIMType::BOOLEAN || _isArray)     if (_type != CIMType::BOOLEAN || _isArray)
Line 1375 
Line 1513 
     if (_type != CIMType::STRING || _isArray)     if (_type != CIMType::STRING || _isArray)
         throw TypeMismatch();         throw TypeMismatch();
  
     x = *((String*)_u._stringValue);      x = *_u._stringValue;
 } }
  
 void CIMValue::get(CIMDateTime& x) const void CIMValue::get(CIMDateTime& x) const
Line 1500 
Line 1638 
  
 void CIMValue::get(Array<CIMDateTime>& x) const void CIMValue::get(Array<CIMDateTime>& x) const
 { {
   #ifdef CIMValueisNullexception
       if (_isNull)
           throw CIMValueIsNull();
   #endif
   
     if (_type != CIMType::DATETIME || !_isArray)     if (_type != CIMType::DATETIME || !_isArray)
         throw TypeMismatch();         throw TypeMismatch();
  
     x.set(_u._dateTimeArray);     x.set(_u._dateTimeArray);
 } }
  
   void CIMValue::get(Array<CIMReference>& x) const
   {
       if (_type != CIMType::REFERENCE || !_isArray)
           throw TypeMismatch();
   
       x.set(_u._referenceArray);
   }
   
 void CIMValue::_init() void CIMValue::_init()
 { {
     _type = CIMType::NONE;     _type = CIMType::NONE;
Line 1519 
Line 1670 
     if (!x.typeCompatible(y))     if (!x.typeCompatible(y))
         return false;         return false;
  
       if (x._isNull != y._isNull)
           return false;
   
     if (x._isArray)     if (x._isArray)
     {     {
         switch (x._type)         switch (x._type)
Line 1578 
Line 1732 
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 return Array<CIMDateTime>(x._u._dateTimeArray) ==                 return Array<CIMDateTime>(x._u._dateTimeArray) ==
                     Array<CIMDateTime>(y._u._dateTimeArray);                     Array<CIMDateTime>(y._u._dateTimeArray);
   
               case CIMType::REFERENCE:
                   return Array<CIMReference>(x._u._referenceArray) ==
                       Array<CIMReference>(y._u._referenceArray);
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
     else     else
Line 1621 
Line 1781 
                 return x._u._char16Value == y._u._char16Value;                 return x._u._char16Value == y._u._char16Value;
  
             case CIMType::STRING:             case CIMType::STRING:
                 return String::equal(                  return String::equal(*x._u._stringValue, *y._u._stringValue);
                     *((String*)x._u._stringValue),  
                     *((String*)y._u._stringValue));  
  
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 return *x._u._dateTimeValue == *y._u._dateTimeValue;                 return *x._u._dateTimeValue == *y._u._dateTimeValue;
  
             case CIMType::REFERENCE:             case CIMType::REFERENCE:
                 return *x._u._referenceValue == *y._u._referenceValue;                 return *x._u._referenceValue == *y._u._referenceValue;
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
  
Line 1639 
Line 1799 
  
 void CIMValue::setNullValue(CIMType type, Boolean isArray, Uint32 arraySize) void CIMValue::setNullValue(CIMType type, Boolean isArray, Uint32 arraySize)
 { {
     _isNull = true;  
  
     clear();     clear();
  
Line 1702 
Line 1861 
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 set(Array<CIMDateTime>(arraySize));                 set(Array<CIMDateTime>(arraySize));
                 break;                 break;
   
               case CIMType::REFERENCE:
                   set(Array<CIMReference>(arraySize));
                   break;
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
     else     else
Line 1767 
Line 1932 
             case CIMType::REFERENCE:             case CIMType::REFERENCE:
                 set(CIMReference());                 set(CIMReference());
                 break;                 break;
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
   
       // Set the Null attribute. Note that this must be after the set
       // because the set functions sets the _isNull.
   
       _isNull = true;
 } }
  
 String CIMValue::toString() const String CIMValue::toString() const
 { {
     Array<Sint8> out;     Array<Sint8> out;
  
       //ATTN: Not sure what we should do with getstring for Null CIMValues
       //Choice return empty string or exception out.
       if (_isNull)
           return String();
   
     if (_isArray)     if (_isArray)
     {     {
         switch (_type)         switch (_type)
Line 1842 
Line 2019 
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _toString(out, _u._dateTimeArray->data(), _u._dateTimeArray->size);                 _toString(out, _u._dateTimeArray->data(), _u._dateTimeArray->size);
                 break;                 break;
   
               case CIMType::REFERENCE:
                   _toString(out, _u._referenceArray->data(), _u._referenceArray->size);
                   break;
   
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
     else if (_type == CIMType::REFERENCE)  
     {  
         return _u._referenceValue->toString();  
     }  
     else     else
     {     {
         switch (_type)         switch (_type)
Line 1901 
Line 2081 
                 break;                 break;
  
             case CIMType::STRING:             case CIMType::STRING:
                 _toString(out, *((String*)_u._stringValue));                  _toString(out, *_u._stringValue);
                 break;                 break;
  
             case CIMType::DATETIME:             case CIMType::DATETIME:
                 _toString(out, *_u._dateTimeValue);                 _toString(out, *_u._dateTimeValue);
                 break;                 break;
   
               case CIMType::REFERENCE:
                   _toString(out, *_u._referenceValue);
                   break;
   
               default:
                   throw CIMValueInvalidType();
         }         }
     }     }
  


Legend:
Removed from v.1.11.2.12  
changed lines
  Added in v.1.24

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2