version 1.5, 2001/07/10 22:31:09
|
version 1.6, 2001/12/22 02:15:16
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "CIMObject.h" | #include "CIMObject.h" |
|
#include "CIMClass.h" |
|
#include "CIMInstance.h" |
#include "XmlWriter.h" | #include "XmlWriter.h" |
| |
PEGASUS_USING_STD; |
|
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
|
|
// | // |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
CIMClass CIMObject::getClass() |
CIMObject::CIMObject(const CIMClass& x) |
{ | { |
if (!isClass()) |
Inc(_rep = x._rep); |
throw TypeMismatch(); |
} |
| |
return CIMClass((CIMClassRep*)_rep); |
CIMObject::CIMObject(const CIMInstance& x) |
|
{ |
|
Inc(_rep = x._rep); |
} | } |
| |
CIMConstClass CIMObject::getClass() const |
CIMObject& CIMObject::operator=(const CIMClass& x) |
{ | { |
if (!isInstance()) |
if (x._rep != _rep) |
throw TypeMismatch(); |
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
| |
return CIMConstClass((CIMClassRep*)_rep); |
CIMObject& CIMObject::operator=(const CIMInstance& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
} | } |
| |
CIMInstance CIMObject::getInstance() |
Boolean CIMObject::identical(const CIMConstObject& x) const |
{ | { |
if (!isInstance()) |
x._checkRep(); |
throw TypeMismatch(); |
_checkRep(); |
|
return _rep->identical(x._rep); |
|
} |
| |
return CIMInstance((CIMInstanceRep*)_rep); |
//////////////////////////////////////////////////////////////////////////////// |
|
// |
|
// CIMConstObject |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
|
CIMConstObject::CIMConstObject(const CIMClass& x) |
|
{ |
|
Inc(_rep = x._rep); |
} | } |
| |
CIMConstInstance CIMObject::getInstance() const |
CIMConstObject::CIMConstObject(const CIMInstance& x) |
{ | { |
if (!isInstance()) |
Inc(_rep = x._rep); |
throw TypeMismatch(); |
} |
| |
return CIMConstInstance((CIMInstanceRep*)_rep); |
CIMConstObject& CIMConstObject::operator=(const CIMClass& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
} | } |
| |
void CIMObject::toXml(Array<Sint8>& out) const |
CIMConstObject& CIMConstObject::operator=(const CIMInstance& x) |
{ | { |
if (!_rep) |
if (x._rep != _rep) |
throw NullPointer(); |
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
| |
if (isClass()) |
CIMConstObject& CIMConstObject::operator=(const CIMConstClass& x) |
{ | { |
CIMConstClass cimClass = getClass(); |
if (x._rep != _rep) |
cimClass.toXml(out); |
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
} | } |
else |
|
|
CIMConstObject& CIMConstObject::operator=(const CIMConstInstance& x) |
|
{ |
|
if (x._rep != _rep) |
{ | { |
CIMConstInstance cimInstance = getInstance(); |
Dec(_rep); |
cimInstance.toXml(out); |
Inc(_rep = x._rep); |
} | } |
|
return *this; |
} | } |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
|
|
_object = object; | _object = object; |
} | } |
| |
//------------------------------------------------------------------------------ |
|
// |
|
// <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))> |
|
// |
|
//------------------------------------------------------------------------------ |
|
|
|
void CIMObjectWithPath::toXml(Array<Sint8>& out) const | void CIMObjectWithPath::toXml(Array<Sint8>& out) const |
{ | { |
out << "<VALUE.OBJECTWITHPATH>\n"; | out << "<VALUE.OBJECTWITHPATH>\n"; |