version 1.49.4.1, 2004/11/12 17:48:28
|
version 1.53, 2005/02/05 22:59:23
|
|
|
//%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 |
|
|
// 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) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
// | // |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
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. |
|
|
&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--) |
{ | { |
|
|
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: |
|
|
break; | break; |
| |
case CIMTYPE_OBJECT: | case CIMTYPE_OBJECT: |
_rep->_u._cimobjectValue = |
_rep->_u._objectValue = |
new CIMObject(x._rep->_u._cimobjectValue->clone()); |
new CIMObject(x._rep->_u._objectValue->clone()); |
break; | break; |
| |
// Should never get here. testing complete enum | // Should never get here. testing complete enum |
|
|
break; | break; |
| |
case CIMTYPE_OBJECT: | case CIMTYPE_OBJECT: |
delete _rep->_u._cimobjectArray; |
delete _rep->_u._objectArray; |
break; | break; |
| |
default: | default: |
|
|
break; | break; |
| |
case CIMTYPE_OBJECT: | case CIMTYPE_OBJECT: |
delete _rep->_u._cimobjectValue; |
delete _rep->_u._objectValue; |
break; | break; |
| |
default: | default: |
|
|
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 |
|
|
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; |
|
|
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; |
|
|
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 |
|
|
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 |
|
|
(*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); |
|
|
*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); |
|
|
| |
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. |
|
|
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: |
|
|
break; | break; |
| |
case CIMTYPE_OBJECT: | case CIMTYPE_OBJECT: |
_toString(out, *_rep->_u._cimobjectValue); |
_toString(out, *_rep->_u._objectValue); |
break; | break; |
| |
default: | default: |