(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 and 1.52

version 1.49, 2004/06/03 08:45:20 version 1.52, 2005/01/16 02:43:23
Line 1 
Line 1 
 //%2003////////////////////////////////////////////////////////////////////////  //%2004////////////////////////////////////////////////////////////////////////
 // //
 // 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.
 // //
 // 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 32 
 //              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 62 
 // //
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 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 101 
                 &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();
   }
   
   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 232 
Line 242 
     set(x);     set(x);
 } }
  
   CIMValue::CIMValue(const CIMObject& x)
   {
       _rep = new CIMValueRep();
       set(x);
   }
   
 CIMValue::CIMValue(const Array<Boolean>& x) CIMValue::CIMValue(const Array<Boolean>& x)
 { {
     _rep = new CIMValueRep();     _rep = new CIMValueRep();
Line 322 
Line 338 
     set(x);     set(x);
 } }
  
   CIMValue::CIMValue(const Array<CIMObject>& x)
   {
       _rep = new CIMValueRep();
       set(x);
   }
   
 CIMValue::CIMValue(const CIMValue& x) CIMValue::CIMValue(const CIMValue& x)
 { {
     _rep = new CIMValueRep();     _rep = new CIMValueRep();
Line 430 
Line 452 
                     new Array<CIMObjectPath>(*(x._rep->_u._referenceArray));                     new Array<CIMObjectPath>(*(x._rep->_u._referenceArray));
                 break;                 break;
  
           case CIMTYPE_OBJECT:
                   _rep->_u._objectArray =
                       new Array<CIMObject>(*(x._rep->_u._objectArray));
                   break;
   
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 500 
Line 527 
                     new CIMObjectPath(*(x._rep->_u._referenceValue));                     new CIMObjectPath(*(x._rep->_u._referenceValue));
                 break;                 break;
  
               case CIMTYPE_OBJECT:
                   _rep->_u._objectValue =
                       new CIMObject(x._rep->_u._objectValue->clone());
                   break;
   
             // Should never get here. testing complete enum             // Should never get here. testing complete enum
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
Line 573 
Line 605 
                 delete _rep->_u._referenceArray;                 delete _rep->_u._referenceArray;
                 break;                 break;
  
               case CIMTYPE_OBJECT:
                   delete _rep->_u._objectArray;
                   break;
   
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 607 
Line 643 
                 delete _rep->_u._referenceValue;                 delete _rep->_u._referenceValue;
                 break;                 break;
  
               case CIMTYPE_OBJECT:
                   delete _rep->_u._objectValue;
                   break;
   
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 699 
Line 739 
             return _rep->_u._referenceArray->size();             return _rep->_u._referenceArray->size();
             break;             break;
  
           case CIMTYPE_OBJECT:
               return _rep->_u._objectArray->size();
               break;
   
         //default:  // Handled below         //default:  // Handled below
     }     }
  
Line 780 
Line 824 
                 set(Array<CIMObjectPath>(arraySize));                 set(Array<CIMObjectPath>(arraySize));
                 break;                 break;
  
               case CIMTYPE_OBJECT:
                   set(Array<CIMObject>(arraySize));
                   break;
   
             default:             default:
                 throw TypeMismatchException();                 throw TypeMismatchException();
         }         }
Line 848 
Line 896 
                 set(CIMObjectPath());                 set(CIMObjectPath());
                 break;                 break;
  
               case CIMTYPE_OBJECT:
                   set(CIMObject());
                   break;
   
             default:             default:
                 throw TypeMismatchException();                 throw TypeMismatchException();
         }         }
Line 979 
Line 1031 
     _rep->_isNull = false;     _rep->_isNull = false;
 } }
  
   void CIMValue::set(const CIMObject& x)
   {
       clear();
       if (x.isUninitialized()) {
           // Don't need to clone since null CIMObjects aren't shared when created.
           // Doesn't work anyway, clone() throws an exception if null.
           _rep->_u._objectValue = new CIMObject(x);
       }
       else {
           _rep->_u._objectValue = new CIMObject(x.clone());
       }
       _rep->_type = CIMTYPE_OBJECT;
       _rep->_isNull = false;
   }
   
 void CIMValue::set(const Array<Boolean>& x) void CIMValue::set(const Array<Boolean>& x)
 { {
     clear();     clear();
Line 1114 
Line 1181 
     _rep->_isNull = false;     _rep->_isNull = false;
 } }
  
   void CIMValue::set(const Array<CIMObject>& x)
   {
       clear();
       _rep->_u._objectArray = new Array<CIMObject>(x);
       _rep->_type = CIMTYPE_OBJECT;
       _rep->_isArray = true;
       _rep->_isNull = false;
   }
   
 void CIMValue::get(Boolean& x) const void CIMValue::get(Boolean& x) const
 { {
     if (_rep->_type != CIMTYPE_BOOLEAN || _rep->_isArray)     if (_rep->_type != CIMTYPE_BOOLEAN || _rep->_isArray)
Line 1249 
Line 1325 
         x = *_rep->_u._referenceValue;         x = *_rep->_u._referenceValue;
 } }
  
   void CIMValue::get(CIMObject& x) const
   {
       if (_rep->_type != CIMTYPE_OBJECT || _rep->_isArray)
           throw TypeMismatchException();
   
       if (!_rep->_isNull)
           x = *_rep->_u._objectValue;
   }
   
 void CIMValue::get(Array<Boolean>& x) const void CIMValue::get(Array<Boolean>& x) const
 { {
     if (_rep->_type != CIMTYPE_BOOLEAN || !_rep->_isArray)     if (_rep->_type != CIMTYPE_BOOLEAN || !_rep->_isArray)
Line 1384 
Line 1469 
         x = *_rep->_u._referenceArray;         x = *_rep->_u._referenceArray;
 } }
  
   void CIMValue::get(Array<CIMObject>& x) const
   {
       if (_rep->_type != CIMTYPE_OBJECT || !_rep->_isArray)
           throw TypeMismatchException();
   
       if (!_rep->_isNull)
           x = *_rep->_u._objectArray;
   }
   
 Boolean CIMValue::equal(const CIMValue& x) const Boolean CIMValue::equal(const CIMValue& x) const
 { {
     if (!typeCompatible(x))     if (!typeCompatible(x))
Line 1456 
Line 1550 
                 return (*_rep->_u._referenceArray) ==                 return (*_rep->_u._referenceArray) ==
                     (*x._rep->_u._referenceArray);                     (*x._rep->_u._referenceArray);
  
               case CIMTYPE_OBJECT:
                   return (*_rep->_u._objectArray) ==
                       (*x._rep->_u._objectArray);
   
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 1511 
Line 1609 
                 return *_rep->_u._referenceValue ==                 return *_rep->_u._referenceValue ==
                     *x._rep->_u._referenceValue;                     *x._rep->_u._referenceValue;
  
               case CIMTYPE_OBJECT:
                   return (*_rep->_u._objectValue).identical((*x._rep->_u._objectValue));
   
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 1522 
Line 1623 
  
 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 1614 
Line 1715 
                                _rep->_u._referenceArray->size());                                _rep->_u._referenceArray->size());
                 break;                 break;
  
               case CIMTYPE_OBJECT:
                   _toString(out, _rep->_u._objectArray->getData(),
                                  _rep->_u._objectArray->size());
                   break;
   
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 1682 
Line 1788 
                 _toString(out, *_rep->_u._referenceValue);                 _toString(out, *_rep->_u._referenceValue);
                 break;                 break;
  
               case CIMTYPE_OBJECT:
                   _toString(out, *_rep->_u._objectValue);
                   break;
   
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }


Legend:
Removed from v.1.49  
changed lines
  Added in v.1.52

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2