version 1.2, 2001/07/02 01:50:09
|
version 1.7, 2002/01/08 18:22:45
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#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) |
{ | { |
CIMClassRep* rep = dynamic_cast<CIMClassRep*>(_rep); |
Inc(_rep = x._rep); |
|
|
if (!rep) |
|
throw TypeMismatch(); |
|
|
|
return CIMClass(rep); |
|
} | } |
| |
CIMConstClass CIMObject::getClass() const |
CIMObject::CIMObject(const CIMInstance& x) |
{ | { |
CIMClassRep* rep = dynamic_cast<CIMClassRep*>(_rep); |
Inc(_rep = x._rep); |
|
} |
| |
if (!rep) |
CIMObject& CIMObject::operator=(const CIMClass& x) |
throw TypeMismatch(); |
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
| |
return CIMConstClass(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 |
{ | { |
CIMInstanceRep* rep = dynamic_cast<CIMInstanceRep*>(_rep); |
x._checkRep(); |
|
_checkRep(); |
|
return _rep->identical(x._rep); |
|
} |
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
// |
|
// CIMConstObject |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
| |
if (!rep) |
CIMConstObject::CIMConstObject(const CIMClass& x) |
throw TypeMismatch(); |
{ |
|
Inc(_rep = x._rep); |
|
} |
| |
return CIMInstance(rep); |
CIMConstObject::CIMConstObject(const CIMConstClass& x) |
|
{ |
|
Inc(_rep = x._rep); |
} | } |
| |
CIMConstInstance CIMObject::getInstance() const |
CIMConstObject::CIMConstObject(const CIMInstance& x) |
{ | { |
CIMInstanceRep* rep = dynamic_cast<CIMInstanceRep*>(_rep); |
Inc(_rep = x._rep); |
|
} |
| |
if (!rep) |
CIMConstObject::CIMConstObject(const CIMConstInstance& x) |
throw TypeMismatch(); |
{ |
|
Inc(_rep = x._rep); |
|
} |
| |
return CIMConstInstance(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 (x._rep != _rep) |
{ | { |
if (!_rep) |
Dec(_rep); |
throw NullPointer(); |
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
| |
if (isClass()) |
CIMConstObject& CIMConstObject::operator=(const CIMConstClass& x) |
|
{ |
|
if (x._rep != _rep) |
{ | { |
CIMConstClass cimClass = getClass(); |
Dec(_rep); |
cimClass.toXml(out); |
Inc(_rep = x._rep); |
} | } |
else |
return *this; |
|
} |
|
|
|
CIMConstObject& CIMConstObject::operator=(const CIMConstInstance& x) |
{ | { |
CIMConstInstance cimInstance = getInstance(); |
if (x._rep != _rep) |
cimInstance.toXml(out); |
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
} | } |
|
return *this; |
} | } |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
|
|
} | } |
| |
CIMObjectWithPath::CIMObjectWithPath( | CIMObjectWithPath::CIMObjectWithPath( |
CIMReference& reference, |
const CIMReference& reference, |
CIMObject& object) |
const CIMObject& object) |
: _reference(reference), _object(object) | : _reference(reference), _object(object) |
{ | { |
| |
|
|
return *this; | return *this; |
} | } |
| |
void CIMObjectWithPath::set(CIMReference& reference, CIMObject& object) |
void CIMObjectWithPath::set( |
|
const CIMReference& reference, |
|
const CIMObject& object) |
{ | { |
_reference = reference; | _reference = reference; |
_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"; |