(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.49.4.1 and 1.55

version 1.49.4.1, 2004/11/12 17:48:28 version 1.55, 2005/02/28 21:12:22
Line 1 
Line 1 
 //%2003////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
 // IBM Corp.; EMC Corporation, The Open Group. // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 30 
Line 34 
 //              Carol Ann Krug Graves, Hewlett-Packard Company //              Carol Ann Krug Graves, Hewlett-Packard Company
 //                (carolann_graves@hp.com) //                (carolann_graves@hp.com)
 //              Adriann Schuur (schuur@de.ibm.com) PEP 164 //              Adriann Schuur (schuur@de.ibm.com) PEP 164
   //              Dave Sudlik, IBM (dsudlik@us.ibm.com)
   //              David Dillard, VERITAS Software Corp.
   //                  (david.dillard@veritas.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 57 
Line 64 
 // //
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 inline void _toString(Array<Sint8>& out, Boolean x)  inline void _toString(Array<char>& out, Boolean x)
 { {
     XmlWriter::append(out, x);     XmlWriter::append(out, x);
 } }
  
 inline void _toString(Array<Sint8>& out, Uint8 x) { XmlWriter::append(out, Uint32(x)); }  inline void _toString(Array<char>& out, Uint8 x) { XmlWriter::append(out, Uint32(x)); }
 inline void _toString(Array<Sint8>& out, Sint8 x) { XmlWriter::append(out, Sint32(x)); }  inline void _toString(Array<char>& out, Sint8 x) { XmlWriter::append(out, Sint32(x)); }
 inline void _toString(Array<Sint8>& out, Uint16 x) { XmlWriter::append(out, Uint32(x)); }  inline void _toString(Array<char>& out, Uint16 x) { XmlWriter::append(out, Uint32(x)); }
 inline void _toString(Array<Sint8>& out, Sint16 x) { XmlWriter::append(out, Sint32(x)); }  inline void _toString(Array<char>& out, Sint16 x) { XmlWriter::append(out, Sint32(x)); }
 inline void _toString(Array<Sint8>& out, Uint32 x) { XmlWriter::append(out, x); }  inline void _toString(Array<char>& out, Uint32 x) { XmlWriter::append(out, x); }
 inline void _toString(Array<Sint8>& out, Sint32 x) { XmlWriter::append(out, x); }  inline void _toString(Array<char>& out, Sint32 x) { XmlWriter::append(out, x); }
 inline void _toString(Array<Sint8>& out, Uint64 x) { XmlWriter::append(out, x); }  inline void _toString(Array<char>& out, Uint64 x) { XmlWriter::append(out, x); }
 inline void _toString(Array<Sint8>& out, Sint64 x) { XmlWriter::append(out, x); }  inline void _toString(Array<char>& out, Sint64 x) { XmlWriter::append(out, x); }
 inline void _toString(Array<Sint8>& out, Real32 x) { XmlWriter::append(out, Real64(x)); }  inline void _toString(Array<char>& out, Real32 x) { XmlWriter::append(out, Real64(x)); }
 inline void _toString(Array<Sint8>& out, Real64 x) { XmlWriter::append(out, x); }  inline void _toString(Array<char>& out, Real64 x) { XmlWriter::append(out, x); }
  
 inline void _toString(Array<Sint8>& out, Char16 x)  inline void _toString(Array<char>& out, Char16 x)
 { {
     // We need to convert the Char16 to UTF8 then append the UTF8     // We need to convert the Char16 to UTF8 then append the UTF8
     // character into the array.     // character into the array.
Line 96 
Line 103 
                 &strtgt,                 &strtgt,
                 endtgt);                 endtgt);
  
     out.append((Sint8 *)str, UTF_8_COUNT_TRAIL_BYTES(str[0]) +1);      out.append(str, UTF_8_COUNT_TRAIL_BYTES(str[0]) +1);
 } }
  
 inline void _toString(Array<Sint8>& out, const String& x)  inline void _toString(Array<char>& out, const String& x)
 { {
     out << x;     out << x;
 } }
  
 inline void _toString(Array<Sint8>& out, const CIMDateTime& x)  inline void _toString(Array<char>& out, const CIMDateTime& x)
 { {
     out << x.toString();     out << x.toString();
 } }
  
 inline void _toString(Array<Sint8>& out, const CIMObjectPath& x)  inline void _toString(Array<char>& out, const CIMObjectPath& x)
 { {
     out << x.toString();     out << x.toString();
 } }
  
 inline void _toString(Array<Sint8>& out, const CIMObject& x)  inline void _toString(Array<char>& out, const CIMObject& x)
 { {
     out << x.toString();     out << x.toString();
 } }
  
 template<class T> template<class T>
 void _toString(Array<Sint8>& out, const T* p, Uint32 size)  void _toString(Array<char>& out, const T* p, Uint32 size)
 { {
     while (size--)     while (size--)
     {     {
Line 448 
Line 455 
                 break;                 break;
  
         case CIMTYPE_OBJECT:         case CIMTYPE_OBJECT:
                 _rep->_u._cimobjectArray =                  _rep->_u._objectArray =
                     new Array<CIMObject>(*(x._rep->_u._cimobjectArray));                      new Array<CIMObject>(*(x._rep->_u._objectArray));
                 break;                 break;
  
             default:             default:
Line 523 
Line 530 
                 break;                 break;
  
             case CIMTYPE_OBJECT:             case CIMTYPE_OBJECT:
                 _rep->_u._cimobjectValue =                  if (x._rep->_u._objectValue->isUninitialized())
                     new CIMObject(x._rep->_u._cimobjectValue->clone());                  {
                       _rep->_u._objectValue = new CIMObject();
                   }
                   else
                   {
                       _rep->_u._objectValue =
                           new CIMObject(x._rep->_u._objectValue->clone());
                   }
                 break;                 break;
  
             // Should never get here. testing complete enum             // Should never get here. testing complete enum
Line 601 
Line 615 
                 break;                 break;
  
             case CIMTYPE_OBJECT:             case CIMTYPE_OBJECT:
                 delete _rep->_u._cimobjectArray;                  delete _rep->_u._objectArray;
                 break;                 break;
  
             default:             default:
Line 639 
Line 653 
                 break;                 break;
  
             case CIMTYPE_OBJECT:             case CIMTYPE_OBJECT:
                 delete _rep->_u._cimobjectValue;                  delete _rep->_u._objectValue;
                 break;                 break;
  
             default:             default:
Line 735 
Line 749 
             break;             break;
  
         case CIMTYPE_OBJECT:         case CIMTYPE_OBJECT:
             return _rep->_u._cimobjectArray->size();              return _rep->_u._objectArray->size();
             break;             break;
  
         //default:  // Handled below         //default:  // Handled below
Line 743 
Line 757 
  
     // Unreachable!     // Unreachable!
     PEGASUS_ASSERT(false);     PEGASUS_ASSERT(false);
     return 0;      PEGASUS_UNREACHABLE( return 0; )
 } }
  
 CIMType CIMValue::getType() const CIMType CIMValue::getType() const
Line 1032 
Line 1046 
     if (x.isUninitialized()) {     if (x.isUninitialized()) {
         // Don't need to clone since null CIMObjects aren't shared when created.         // Don't need to clone since null CIMObjects aren't shared when created.
         // Doesn't work anyway, clone() throws an exception if null.         // Doesn't work anyway, clone() throws an exception if null.
         _rep->_u._cimobjectValue = new CIMObject(x);          _rep->_u._objectValue = new CIMObject(x);
     }     }
     else {     else {
         _rep->_u._cimobjectValue = new CIMObject(x.clone());          _rep->_u._objectValue = new CIMObject(x.clone());
     }     }
     _rep->_type = CIMTYPE_OBJECT;     _rep->_type = CIMTYPE_OBJECT;
     _rep->_isNull = false;     _rep->_isNull = false;
Line 1179 
Line 1193 
 void CIMValue::set(const Array<CIMObject>& x) void CIMValue::set(const Array<CIMObject>& x)
 { {
     clear();     clear();
     _rep->_u._cimobjectArray = new Array<CIMObject>(x);      _rep->_u._objectArray = new Array<CIMObject>(x);
     _rep->_type = CIMTYPE_OBJECT;     _rep->_type = CIMTYPE_OBJECT;
     _rep->_isArray = true;     _rep->_isArray = true;
     _rep->_isNull = false;     _rep->_isNull = false;
Line 1326 
Line 1340 
         throw TypeMismatchException();         throw TypeMismatchException();
  
     if (!_rep->_isNull)     if (!_rep->_isNull)
         x = *_rep->_u._cimobjectValue;          x = *_rep->_u._objectValue;
 } }
  
 void CIMValue::get(Array<Boolean>& x) const void CIMValue::get(Array<Boolean>& x) const
Line 1470 
Line 1484 
         throw TypeMismatchException();         throw TypeMismatchException();
  
     if (!_rep->_isNull)     if (!_rep->_isNull)
         x = *_rep->_u._cimobjectArray;          x = *_rep->_u._objectArray;
 } }
  
 Boolean CIMValue::equal(const CIMValue& x) const Boolean CIMValue::equal(const CIMValue& x) const
Line 1546 
Line 1560 
                     (*x._rep->_u._referenceArray);                     (*x._rep->_u._referenceArray);
  
             case CIMTYPE_OBJECT:             case CIMTYPE_OBJECT:
                 return (*_rep->_u._cimobjectArray) ==                  return (*_rep->_u._objectArray) ==
                     (*x._rep->_u._cimobjectArray);                      (*x._rep->_u._objectArray);
  
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
Line 1605 
Line 1619 
                     *x._rep->_u._referenceValue;                     *x._rep->_u._referenceValue;
  
             case CIMTYPE_OBJECT:             case CIMTYPE_OBJECT:
                 return (*_rep->_u._cimobjectValue).identical((*x._rep->_u._cimobjectValue));                  return (*_rep->_u._objectValue).identical((*x._rep->_u._objectValue));
  
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
Line 1613 
Line 1627 
     }     }
  
     // Unreachable!     // Unreachable!
     return false;      PEGASUS_UNREACHABLE( return false; )
 } }
  
 String CIMValue::toString() const String CIMValue::toString() const
 { {
     Array<Sint8> out;      Array<char> out;
  
     //ATTN: Not sure what we should do with getstring for Null CIMValues     //ATTN: Not sure what we should do with getstring for Null CIMValues
     //Choice return empty string or exception out.     //Choice return empty string or exception out.
Line 1711 
Line 1725 
                 break;                 break;
  
             case CIMTYPE_OBJECT:             case CIMTYPE_OBJECT:
                 _toString(out, _rep->_u._cimobjectArray->getData(),                  _toString(out, _rep->_u._objectArray->getData(),
                                _rep->_u._cimobjectArray->size());                                 _rep->_u._objectArray->size());
                 break;                 break;
  
             default:             default:
Line 1784 
Line 1798 
                 break;                 break;
  
             case CIMTYPE_OBJECT:             case CIMTYPE_OBJECT:
                 _toString(out, *_rep->_u._cimobjectValue);                  _toString(out, *_rep->_u._objectValue);
                 break;                 break;
  
             default:             default:


Legend:
Removed from v.1.49.4.1  
changed lines
  Added in v.1.55

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2