summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordave.sudlik <dave.sudlik>2004-11-29 18:48:19 +0000
committerdave.sudlik <dave.sudlik>2004-11-29 18:48:19 +0000
commite570a2ab8ec852b3e99f1bed3926ab783b7ad7d2 (patch)
treee00fce71b91ee1fc60fc7910415440211a06cd0d
parent84907c1a27e1c89ee3584c28725804204e705965 (diff)
downloadtog-pegasus-PEP213_SIZE_OPTIMIZATIONS_TAG.zip
tog-pegasus-PEP213_SIZE_OPTIMIZATIONS_TAG.tar.gz
tog-pegasus-PEP213_SIZE_OPTIMIZATIONS_TAG.tar.xz
TITLE: Embedded Object support DESCRIPTION: This commit is just for the CIMValue support for CIMObjects, as described in the PEP and in ballot 80.
-rw-r--r--src/Pegasus/Common/CIMObject.cpp21
-rw-r--r--src/Pegasus/Common/CIMObject.h24
-rw-r--r--src/Pegasus/Common/CIMObjectPath.cpp12
-rw-r--r--src/Pegasus/Common/CIMObjectRep.h3
-rw-r--r--src/Pegasus/Common/CIMProperty.h2
-rw-r--r--src/Pegasus/Common/CIMType.cpp3
-rw-r--r--src/Pegasus/Common/CIMType.h4
-rw-r--r--src/Pegasus/Common/CIMValue.cpp106
-rw-r--r--src/Pegasus/Common/CIMValue.h16
-rw-r--r--src/Pegasus/Common/MofWriter.cpp22
-rw-r--r--src/Pegasus/Common/Union.h4
-rw-r--r--src/Pegasus/Common/XmlWriter.cpp25
-rw-r--r--src/Pegasus/Common/tests/Value/Value.cpp76
13 files changed, 315 insertions, 3 deletions
diff --git a/src/Pegasus/Common/CIMObject.cpp b/src/Pegasus/Common/CIMObject.cpp
index bdb32df..fd779fd 100644
--- a/src/Pegasus/Common/CIMObject.cpp
+++ b/src/Pegasus/Common/CIMObject.cpp
@@ -30,6 +30,7 @@
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
// Carol Ann Krug Graves, Hewlett-Packard Company
// (carolann_graves@hp.com)
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -190,6 +191,16 @@ Boolean CIMObject::isUninitialized() const
return (_rep == 0)? true : false;
}
+String CIMObject::toString () const
+{
+ Array<Sint8> out;
+
+ _checkRep();
+ _rep->toXml(out);
+
+ return out.getData();
+}
+
Boolean CIMObject::isClass () const
{
try
@@ -344,6 +355,16 @@ Boolean CIMConstObject::isUninitialized() const
return (_rep == 0)? true : false;
}
+String CIMConstObject::toString () const
+{
+ Array<Sint8> out;
+
+ _checkRep();
+ _rep->toXml(out);
+
+ return out.getData();
+}
+
Boolean CIMConstObject::isClass() const
{
try
diff --git a/src/Pegasus/Common/CIMObject.h b/src/Pegasus/Common/CIMObject.h
index 7e36e57..09eba85 100644
--- a/src/Pegasus/Common/CIMObject.h
+++ b/src/Pegasus/Common/CIMObject.h
@@ -46,6 +46,10 @@ class CIMClass;
class CIMConstClass;
class CIMInstance;
class CIMConstInstance;
+class CIMProperty;
+class CIMConstProperty;
+class CIMQualifier;
+class CIMConstQualifier;
////////////////////////////////////////////////////////////////////////////////
//
@@ -230,6 +234,16 @@ public:
*/
Boolean isUninitialized() const;
+ /** Returns a string representing the value of the CIMObject.
+ With the inclusion of CIMObject as a CIMValue, the intent
+ of the toString() method is to produce a "human-readable" string
+ consistent with other CIMValue types. The string will be a MOF
+ representation of the object (ie. either CIMClass or CIMInstance)
+ using the _rep's toMof() method.
+ @return String representing the CIMObject value.
+ */
+ String toString () const;
+
/** Determines if the object represents a CIMClass.
@return True if the object represents a CIMClass; otherwise, false.
*/
@@ -364,6 +378,16 @@ public:
*/
Boolean isUninitialized() const;
+ /** Returns a string representing the value of the CIMObject.
+ With the inclusion of CIMObject as a CIMValue, the intent
+ of the toString() method is to produce a "human-readable" string
+ consistent with other CIMValue types. The string will be a MOF
+ representation of the object (ie. either CIMClass or CIMInstance)
+ using the _rep's toMof() method.
+ @return String representing the CIMObject value.
+ */
+ String toString () const;
+
/** REVIEWERS: Insert description here.
*/
Boolean isClass() const;
diff --git a/src/Pegasus/Common/CIMObjectPath.cpp b/src/Pegasus/Common/CIMObjectPath.cpp
index 328638c..aa0c800 100644
--- a/src/Pegasus/Common/CIMObjectPath.cpp
+++ b/src/Pegasus/Common/CIMObjectPath.cpp
@@ -30,7 +30,7 @@
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
// Carol Ann Krug Graves, Hewlett-Packard Company
// (carolann_graves@hp.com)
-// Dave Sudlik, IBM (dsudlik@us.ibm.com) for Bug#1462
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -218,6 +218,11 @@ CIMKeyBinding::CIMKeyBinding(const CIMName& name, const CIMValue& value)
case CIMTYPE_REFERENCE:
kbType = REFERENCE;
break;
+ case CIMTYPE_OBJECT:
+ throw TypeMismatchException();
+ // From PEP 194:
+ // Open Issue for the DMTF: Are EmbeddedObject properties permitted to be keys?
+ break;
default:
kbType = NUMERIC;
break;
@@ -301,6 +306,11 @@ Boolean CIMKeyBinding::equal(CIMValue value)
kbValue = XmlReader::stringToValue(0, getValue().getCString(),
value.getType());
break;
+ case CIMTYPE_OBJECT:
+ return false;
+ // From PEP 194:
+ // Open Issue for the DMTF: Are EmbeddedObject properties permitted to be keys?
+ break;
default: // Numerics
if (getType() != NUMERIC) return false;
kbValue = XmlReader::stringToValue(0, getValue().getCString(),
diff --git a/src/Pegasus/Common/CIMObjectRep.h b/src/Pegasus/Common/CIMObjectRep.h
index a86d278..89d7e1c 100644
--- a/src/Pegasus/Common/CIMObjectRep.h
+++ b/src/Pegasus/Common/CIMObjectRep.h
@@ -30,6 +30,7 @@
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
// (carolann_graves@hp.com)
// Adriann Schuur (schuur@de.ibm.com) PEP 164
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -133,6 +134,8 @@ public:
virtual void toXml(Array<Sint8>& out) const = 0;
+ virtual void toMof(Array<Sint8>& out) const = 0;
+
virtual CIMObjectRep* clone() const = 0;
protected:
diff --git a/src/Pegasus/Common/CIMProperty.h b/src/Pegasus/Common/CIMProperty.h
index 379b105..244192e 100644
--- a/src/Pegasus/Common/CIMProperty.h
+++ b/src/Pegasus/Common/CIMProperty.h
@@ -48,6 +48,8 @@ class CIMConstProperty;
class CIMPropertyRep;
class CIMClassRep;
class CIMInstanceRep;
+class CIMQualifier;
+class CIMConstQualifier;
class Resolver;
/** The CIMProperty class is used to represent CIM properties in Pegasus. A CIM Property
diff --git a/src/Pegasus/Common/CIMType.cpp b/src/Pegasus/Common/CIMType.cpp
index a9db60b..4ed546f 100644
--- a/src/Pegasus/Common/CIMType.cpp
+++ b/src/Pegasus/Common/CIMType.cpp
@@ -30,6 +30,7 @@
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
// Carol Ann Krug Graves, Hewlett-Packard Company
// (carolann_graves@hp.com)
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -41,7 +42,7 @@ static const char* _typeStrings[] =
{
"boolean", "uint8", "sint8", "uint16", "sint16", "uint32", "sint32",
"uint64", "sint64", "real32", "real64", "char16", "string", "datetime",
- "reference"
+ "reference", "object"
};
static const Uint32 _NUM_TYPES = sizeof(_typeStrings) / sizeof(_typeStrings[0]);
diff --git a/src/Pegasus/Common/CIMType.h b/src/Pegasus/Common/CIMType.h
index a2c944a..b6cad61 100644
--- a/src/Pegasus/Common/CIMType.h
+++ b/src/Pegasus/Common/CIMType.h
@@ -59,6 +59,7 @@ PEGASUS_NAMESPACE_BEGIN
string CIMTYPE_STRING String
datetime CIMTYPE_DATETIME CIMDateTime
reference CIMTYPE_REFERENCE CIMObjectPath
+ object CIMTYPE_OBJECT CIMObject (not a "real" CIM type -- see PEP 194)
</pre>
*/
@@ -78,7 +79,8 @@ enum CIMType
CIMTYPE_CHAR16,
CIMTYPE_STRING,
CIMTYPE_DATETIME,
- CIMTYPE_REFERENCE
+ CIMTYPE_REFERENCE,
+ CIMTYPE_OBJECT
};
/**
diff --git a/src/Pegasus/Common/CIMValue.cpp b/src/Pegasus/Common/CIMValue.cpp
index 381de60..c98ccb7 100644
--- a/src/Pegasus/Common/CIMValue.cpp
+++ b/src/Pegasus/Common/CIMValue.cpp
@@ -32,6 +32,7 @@
// Carol Ann Krug Graves, Hewlett-Packard Company
// (carolann_graves@hp.com)
// Adriann Schuur (schuur@de.ibm.com) PEP 164
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -116,6 +117,11 @@ inline void _toString(Array<Sint8>& out, const CIMObjectPath& x)
out << x.toString();
}
+inline void _toString(Array<Sint8>& out, const CIMObject& x)
+{
+ out << x.toString();
+}
+
template<class T>
void _toString(Array<Sint8>& out, const T* p, Uint32 size)
{
@@ -234,6 +240,12 @@ CIMValue::CIMValue(const CIMObjectPath& x)
set(x);
}
+CIMValue::CIMValue(const CIMObject& x)
+{
+ _rep = new CIMValueRep();
+ set(x);
+}
+
CIMValue::CIMValue(const Array<Boolean>& x)
{
_rep = new CIMValueRep();
@@ -324,6 +336,12 @@ CIMValue::CIMValue(const Array<CIMObjectPath>& x)
set(x);
}
+CIMValue::CIMValue(const Array<CIMObject>& x)
+{
+ _rep = new CIMValueRep();
+ set(x);
+}
+
CIMValue::CIMValue(const CIMValue& x)
{
_rep = new CIMValueRep();
@@ -432,6 +450,11 @@ void CIMValue::assign(const CIMValue& x)
new Array<CIMObjectPath>(*(x._rep->_u._referenceArray));
break;
+ case CIMTYPE_OBJECT:
+ _rep->_u._objectArray =
+ new Array<CIMObject>(*(x._rep->_u._objectArray));
+ break;
+
default:
PEGASUS_ASSERT(false);
}
@@ -502,6 +525,11 @@ void CIMValue::assign(const CIMValue& x)
new CIMObjectPath(*(x._rep->_u._referenceValue));
break;
+ case CIMTYPE_OBJECT:
+ _rep->_u._objectValue =
+ new CIMObject(x._rep->_u._objectValue->clone());
+ break;
+
// Should never get here. testing complete enum
default:
PEGASUS_ASSERT(false);
@@ -575,6 +603,10 @@ void CIMValue::clear()
delete _rep->_u._referenceArray;
break;
+ case CIMTYPE_OBJECT:
+ delete _rep->_u._objectArray;
+ break;
+
default:
PEGASUS_ASSERT(false);
}
@@ -609,6 +641,10 @@ void CIMValue::clear()
delete _rep->_u._referenceValue;
break;
+ case CIMTYPE_OBJECT:
+ delete _rep->_u._objectValue;
+ break;
+
default:
PEGASUS_ASSERT(false);
}
@@ -701,6 +737,10 @@ Uint32 CIMValue::getArraySize() const
return _rep->_u._referenceArray->size();
break;
+ case CIMTYPE_OBJECT:
+ return _rep->_u._objectArray->size();
+ break;
+
//default: // Handled below
}
@@ -782,6 +822,10 @@ void CIMValue::setNullValue(CIMType type, Boolean isArray, Uint32 arraySize)
set(Array<CIMObjectPath>(arraySize));
break;
+ case CIMTYPE_OBJECT:
+ set(Array<CIMObject>(arraySize));
+ break;
+
default:
throw TypeMismatchException();
}
@@ -850,6 +894,10 @@ void CIMValue::setNullValue(CIMType type, Boolean isArray, Uint32 arraySize)
set(CIMObjectPath());
break;
+ case CIMTYPE_OBJECT:
+ set(CIMObject());
+ break;
+
default:
throw TypeMismatchException();
}
@@ -981,6 +1029,21 @@ void CIMValue::set(const CIMObjectPath& x)
_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)
{
clear();
@@ -1116,6 +1179,15 @@ void CIMValue::set(const Array<CIMObjectPath>& x)
_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
{
if (_rep->_type != CIMTYPE_BOOLEAN || _rep->_isArray)
@@ -1251,6 +1323,15 @@ void CIMValue::get(CIMObjectPath& x) const
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
{
if (_rep->_type != CIMTYPE_BOOLEAN || !_rep->_isArray)
@@ -1386,6 +1467,15 @@ void CIMValue::get(Array<CIMObjectPath>& x) const
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
{
if (!typeCompatible(x))
@@ -1458,6 +1548,10 @@ Boolean CIMValue::equal(const CIMValue& x) const
return (*_rep->_u._referenceArray) ==
(*x._rep->_u._referenceArray);
+ case CIMTYPE_OBJECT:
+ return (*_rep->_u._objectArray) ==
+ (*x._rep->_u._objectArray);
+
default:
PEGASUS_ASSERT(false);
}
@@ -1513,6 +1607,9 @@ Boolean CIMValue::equal(const CIMValue& x) const
return *_rep->_u._referenceValue ==
*x._rep->_u._referenceValue;
+ case CIMTYPE_OBJECT:
+ return (*_rep->_u._objectValue).identical((*x._rep->_u._objectValue));
+
default:
PEGASUS_ASSERT(false);
}
@@ -1616,6 +1713,11 @@ String CIMValue::toString() const
_rep->_u._referenceArray->size());
break;
+ case CIMTYPE_OBJECT:
+ _toString(out, _rep->_u._objectArray->getData(),
+ _rep->_u._objectArray->size());
+ break;
+
default:
PEGASUS_ASSERT(false);
}
@@ -1684,6 +1786,10 @@ String CIMValue::toString() const
_toString(out, *_rep->_u._referenceValue);
break;
+ case CIMTYPE_OBJECT:
+ _toString(out, *_rep->_u._objectValue);
+ break;
+
default:
PEGASUS_ASSERT(false);
}
diff --git a/src/Pegasus/Common/CIMValue.h b/src/Pegasus/Common/CIMValue.h
index a62fec3..bc58d15 100644
--- a/src/Pegasus/Common/CIMValue.h
+++ b/src/Pegasus/Common/CIMValue.h
@@ -34,6 +34,7 @@
#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/CIMType.h>
#include <Pegasus/Common/CIMObjectPath.h>
+#include <Pegasus/Common/CIMObject.h>
#include <Pegasus/Common/CIMDateTime.h>
#include <Pegasus/Common/Exception.h>
#include <Pegasus/Common/Array.h>
@@ -42,6 +43,7 @@
PEGASUS_NAMESPACE_BEGIN
class CIMValueRep;
+class CIMObject;
/**
The CIMValue class represents a value of any of the CIM data types
@@ -110,6 +112,9 @@ public:
CIMValue(const CIMObjectPath& x);
/// Constructor.
+ CIMValue(const CIMObject& x);
+
+ /// Constructor.
CIMValue(const Array<Boolean>& x);
/// Constructor.
@@ -155,6 +160,9 @@ public:
CIMValue(const Array<CIMObjectPath>& x);
/// Constructor.
+ CIMValue(const Array<CIMObject>& x);
+
+ /// Constructor.
CIMValue(const CIMValue& x);
/// Destructor.
@@ -258,6 +266,8 @@ public:
///
void set(const CIMObjectPath& x);
///
+ void set(const CIMObject& x);
+ ///
void set(const Array<Boolean>& x);
///
void set(const Array<Uint8>& x);
@@ -287,6 +297,8 @@ public:
void set(const Array<CIMDateTime>& x);
///
void set(const Array<CIMObjectPath>& x);
+ ///
+ void set(const Array<CIMObject>& x);
/** Gets the value of a CIMValue.
Note: Before using get, the caller should use getType () and isNull ()
@@ -338,6 +350,8 @@ public:
///
void get(CIMObjectPath& x) const;
///
+ void get(CIMObject& x) const;
+ ///
void get(Array<Boolean>& x) const;
///
void get(Array<Uint8>& x) const;
@@ -367,6 +381,8 @@ public:
void get(Array<CIMDateTime>& x) const;
///
void get(Array<CIMObjectPath>& x) const;
+ ///
+ void get(Array<CIMObject>& x) const;
/** Compares with another CIMValue object for equality.
@param x - CIMValue to compare with.
diff --git a/src/Pegasus/Common/MofWriter.cpp b/src/Pegasus/Common/MofWriter.cpp
index 9aa84b1..fd91d07 100644
--- a/src/Pegasus/Common/MofWriter.cpp
+++ b/src/Pegasus/Common/MofWriter.cpp
@@ -29,6 +29,7 @@
//
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
// (carolann_graves@hp.com)
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -198,6 +199,11 @@ inline void _mofWriter_appendValue(Array<Sint8>& out, const CIMObjectPath& x)
_mofWriter_appendValue(out, x.toString());
}
+inline void _mofWriter_appendValue(Array<Sint8>& out, const CIMObject& x)
+{
+ _mofWriter_appendValue(out, x.toString());
+}
+
/** Array -
arrayInitializer = "{" constantValue*( "," constantValue)"}"
*/
@@ -365,6 +371,14 @@ void MofWriter::appendValueElement(
break;
}
+ case CIMTYPE_OBJECT:
+ {
+ Array<CIMObject> a;
+ value.get(a);
+ _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
+ break;
+ }
+
default:
PEGASUS_ASSERT(false);
}
@@ -493,6 +507,14 @@ void MofWriter::appendValueElement(
break;
}
+ case CIMTYPE_OBJECT:
+ {
+ CIMObject v;
+ value.get(v);
+ _mofWriter_appendValue(out, v);
+ break;
+ }
+
default:
PEGASUS_ASSERT(false);
}
diff --git a/src/Pegasus/Common/Union.h b/src/Pegasus/Common/Union.h
index dfce2d7..1950545 100644
--- a/src/Pegasus/Common/Union.h
+++ b/src/Pegasus/Common/Union.h
@@ -28,6 +28,7 @@
// Author: Mike Brasher (mbrasher@bmc.com)
//
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -39,6 +40,7 @@
#include <Pegasus/Common/String.h>
#include <Pegasus/Common/CIMDateTime.h>
#include <Pegasus/Common/CIMObjectPath.h>
+#include <Pegasus/Common/CIMObject.h>
#include <Pegasus/Common/Array.h>
PEGASUS_NAMESPACE_BEGIN
@@ -65,6 +67,7 @@ union Union
String* _stringValue;
CIMDateTime* _dateTimeValue;
CIMObjectPath* _referenceValue;
+ CIMObject* _objectValue;
Array<Boolean>* _booleanArray;
Array<Uint8>* _uint8Array;
@@ -81,6 +84,7 @@ union Union
Array<String>* _stringArray;
Array<CIMDateTime>* _dateTimeArray;
Array<CIMObjectPath>* _referenceArray;
+ Array<CIMObject>* _objectArray;
};
PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/Common/XmlWriter.cpp b/src/Pegasus/Common/XmlWriter.cpp
index 814fc57..1cc7f39 100644
--- a/src/Pegasus/Common/XmlWriter.cpp
+++ b/src/Pegasus/Common/XmlWriter.cpp
@@ -36,6 +36,7 @@
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase1
// Willis White (whiwill@us.ibm.com) PEP 127 and 128
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -871,6 +872,12 @@ inline void _xmlWritter_appendValue(Array<Sint8>& out, const CIMObjectPath& x)
XmlWriter::appendValueReferenceElement(out, x, true);
}
+// DJS -- temporary for testing until encode/decode issues resolved
+inline void _xmlWritter_appendValue(Array<Sint8>& out, const CIMObject& x)
+{
+ out << x.toString();
+}
+
void _xmlWritter_appendValueArray(Array<Sint8>& out, const CIMObjectPath* p, Uint32 size)
{
out << "<VALUE.REFARRAY>\n";
@@ -1041,6 +1048,15 @@ void XmlWriter::appendValueElement(
break;
}
+ // DJS -- temporary for testing until encode/decode issues resolved
+ case CIMTYPE_OBJECT:
+ {
+ Array<CIMObject> a;
+ value.get(a);
+ _xmlWritter_appendValueArray(out, a.getData(), a.size());
+ break;
+ }
+
default:
PEGASUS_ASSERT(false);
}
@@ -1170,6 +1186,15 @@ void XmlWriter::appendValueElement(
break;
}
+ // DJS -- temporary for testing until encode/decode issues resolved
+ case CIMTYPE_OBJECT:
+ {
+ CIMObject v;
+ value.get(v);
+ _xmlWritter_appendValue(out, v);
+ break;
+ }
+
default:
PEGASUS_ASSERT(false);
}
diff --git a/src/Pegasus/Common/tests/Value/Value.cpp b/src/Pegasus/Common/tests/Value/Value.cpp
index 54447c2..86c18da 100644
--- a/src/Pegasus/Common/tests/Value/Value.cpp
+++ b/src/Pegasus/Common/tests/Value/Value.cpp
@@ -33,6 +33,7 @@
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
// Carol Ann Krug Graves, Hewlett-Packard Company
// (carolann_graves@hp.com)
+// Dave Sudlik, IBM (dsudlik@us.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////
@@ -49,6 +50,8 @@
#include <cassert>
#include <Pegasus/Common/CIMValue.h>
+#include <Pegasus/Common/DeclContext.h>
+#include <Pegasus/Common/Resolver.h>
#include <Pegasus/Common/XmlWriter.h>
#include <Pegasus/Common/MofWriter.h>
@@ -103,6 +106,7 @@ void test01(const T& x)
// Test toMof
Array<Sint8> mofout;
+ mofout.clear();
MofWriter::appendValueElement(mofout, v);
mofout.append('\0');
@@ -309,6 +313,60 @@ int main(int argc, char** argv)
test01(CIMDateTime("19991224120000.000000+360"));
test01(CIMObjectPath("//host1:77/root/test:Class1.key1=\"key1Value\",key2=\"key2Value\""));
+ // Create and populate a declaration context:
+
+ const CIMNamespaceName NAMESPACE = CIMNamespaceName ("/zzz");
+
+ SimpleDeclContext* context = new SimpleDeclContext;
+
+ context->addQualifierDecl(
+ NAMESPACE, CIMQualifierDecl(CIMName ("counter"), false,
+ CIMScope::PROPERTY));
+
+ context->addQualifierDecl(
+ NAMESPACE, CIMQualifierDecl(CIMName ("classcounter"), false,
+ CIMScope::CLASS));
+
+ context->addQualifierDecl(
+ NAMESPACE, CIMQualifierDecl(CIMName ("min"), String(),
+ CIMScope::PROPERTY));
+
+ context->addQualifierDecl(
+ NAMESPACE, CIMQualifierDecl(CIMName ("max"), String(),
+ CIMScope::PROPERTY));
+
+ context->addQualifierDecl(NAMESPACE,
+ CIMQualifierDecl(CIMName ("Description"), String(),
+ CIMScope::PROPERTY));
+
+ CIMClass class1(CIMName ("MyClass"));
+
+ class1
+ .addProperty(CIMProperty(CIMName ("count"), Uint32(55))
+ .addQualifier(CIMQualifier(CIMName ("counter"), true))
+ .addQualifier(CIMQualifier(CIMName ("min"), String("0")))
+ .addQualifier(CIMQualifier(CIMName ("max"), String("1"))))
+ .addProperty(CIMProperty(CIMName ("message"), String("Hello"))
+ .addQualifier(CIMQualifier(CIMName ("description"),
+ String("My Message"))))
+ .addProperty(CIMProperty(CIMName ("ratio"), Real32(1.5)));
+
+ Resolver::resolveClass (class1, context, NAMESPACE);
+ context->addClass(NAMESPACE, class1);
+
+ // Test a CIMObject that is a CIMClass
+ test01(CIMObject(class1));
+
+ // Test a CIMObject that is a CIMInstance
+ CIMInstance instance1(CIMName ("MyClass"));
+ instance1.addQualifier(CIMQualifier(CIMName ("classcounter"), true));
+ instance1.addProperty(CIMProperty(CIMName ("message"), String("Goodbye")));
+
+ Resolver::resolveInstance (instance1, context, NAMESPACE, true);
+
+ test01(CIMObject(instance1));
+
+
// Test CIMValue arrays
Array<Uint8> arr1;
@@ -401,6 +459,24 @@ int main(int argc, char** argv)
arr15.append(CIMObjectPath("//host3:99/root/test/static:Class3.keyX=\"keyXValue\",keyY=\"keyYValue\""));
test02(arr15);
+
+ // Test an array of CIMObjects that are CIMInstances
+ CIMInstance instance2(CIMName ("MyClass"));
+ instance2.addQualifier(CIMQualifier(CIMName ("classcounter"), true));
+ instance2.addProperty(CIMProperty(CIMName ("message"), String("Adios")));
+ Resolver::resolveInstance (instance2, context, NAMESPACE, true);
+
+ CIMInstance instance3(CIMName ("MyClass"));
+ instance3.addQualifier(CIMQualifier(CIMName ("classcounter"), false));
+ instance3.addProperty(CIMProperty(CIMName ("message"), String("Au Revoir")));
+ Resolver::resolveInstance (instance3, context, NAMESPACE, true);
+
+ Array<CIMObject> arr16;
+ arr16.append(CIMObject(instance1));
+ arr16.append(CIMObject(instance2));
+ arr16.append(CIMObject(instance3));
+ test02(arr16);
+
cout << argv[0] << " +++++ passed all tests" << endl;
return 0;