version 1.1.2.11, 2009/10/06 14:50:46
|
version 1.3, 2013/02/13 11:39:58
|
|
|
// | // |
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// |
// | // |
|
// This code implements part of PEP#348 - The CMPI infrastructure using SCMO |
|
// (Single Chunk Memory Objects). |
|
// The design document can be found on the OpenPegasus website openpegasus.org |
|
// at https://collaboration.opengroup.org/pegasus/pp/documents/21210/PEP_348.pdf |
|
// |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifndef _SCMOCLASS_H_ | #ifndef _SCMOCLASS_H_ |
|
|
| |
/** | /** |
* Constructs a SCMOClass out of a CIMClass. | * Constructs a SCMOClass out of a CIMClass. |
* @param theCIMClass The source the SCMOClass is constucted off. |
* @param theCIMClass The source the SCMOClass is constructed off. |
* @param nameSpaceName The namespace for the class, optional. | * @param nameSpaceName The namespace for the class, optional. |
* @return | * @return |
*/ | */ |
SCMOClass(const CIMClass& theCIMClass, const char* nameSpaceName=0 ); |
SCMOClass(const CIMClass& theCIMClass, const char* altNameSpace=0 ); |
| |
/** | /** |
* Copy constructor for the SCMO class, used to implement refcounting. | * Copy constructor for the SCMO class, used to implement refcounting. |
|
|
} | } |
| |
/** | /** |
|
* Constructs a SCMOClass from a memory object of type SCMBClass_Main. |
|
* It incremets the referece counter of the memory object. |
|
* @param hdr A memory object of type SCMBClass_Main. |
|
**/ |
|
SCMOClass(SCMBClass_Main* hdr) |
|
{ |
|
cls.hdr = hdr; |
|
Ref(); |
|
} |
|
|
|
/** |
|
* Assignment operator for the SCMO class, |
|
* @param theSCMOClass The right hand value |
|
**/ |
|
SCMOClass& operator=(const SCMOClass& theSCMOClass) |
|
{ |
|
if (cls.hdr != theSCMOClass.cls.hdr) |
|
{ |
|
Unref(); |
|
cls.hdr = theSCMOClass.cls.hdr; |
|
Ref(); |
|
} |
|
return *this; |
|
} |
|
|
|
/** |
|
* Constructs an empty SCMOClass only with name space and class name. |
|
* |
|
* If you construct a SCMOInstance using this class, you must mark it as |
|
* compromized using SCMOInstance.markAsCompromised(). |
|
* |
|
* @param className The name for the class. |
|
* @param nameSpaceName The namespace for the class. |
|
*/ |
|
SCMOClass(const char* className, const char* nameSpaceName ); |
|
|
|
|
|
/** |
* Destructor is decrementing the refcount. If refcount is zero, the | * Destructor is decrementing the refcount. If refcount is zero, the |
* singele chunk memory object is deallocated. | * singele chunk memory object is deallocated. |
*/ | */ |
|
|
void getKeyNamesAsString(Array<String>& keyNames) const; | void getKeyNamesAsString(Array<String>& keyNames) const; |
| |
/** | /** |
* Determines whether the object has been initialized. |
* Gets the super class name of the class. |
* @return True if the object has not been initialized, false otherwise. |
* @retuns The super class name. |
|
* If not available a NULL pointer is returned |
|
*/ |
|
const char* getSuperClassName() const; |
|
|
|
/** |
|
* Gets the super class name of the class. |
|
* @param Return strlen of result string. |
|
* @retuns The super class name. |
|
* If not available a NULL pointer is returned |
*/ | */ |
Boolean isUninitialized( ) const {return (cls.base == 0); }; |
const char* getSuperClassName_l(Uint32 & length) const; |
| |
static StrLit qualifierNameStrLit(Uint32 num) | static StrLit qualifierNameStrLit(Uint32 num) |
{ | { |
return _qualifierNameStrLit[num]; | return _qualifierNameStrLit[num]; |
} | } |
| |
|
/** |
|
* Determines if the SCMOClass is an empty class. |
|
* A empty class is a class with no information about properties. |
|
* Maybe only the class name and/or name space are available. |
|
* @return True if it an empty class. |
|
**/ |
|
Boolean isEmpty( )const |
|
{ |
|
// The size of one indicates that only an empty string was stored. |
|
return (cls.hdr->flags.isEmpty); |
|
} |
|
|
private: | private: |
| |
void Ref() | void Ref() |
{ | { |
cls.hdr->refCount++; | cls.hdr->refCount++; |
// printf("\ncls.hdr->refCount=%u\n",cls.hdr->refCount.get()); |
|
}; | }; |
| |
void Unref() | void Unref() |
{ | { |
if (cls.hdr->refCount.decAndTestIfZero()) | if (cls.hdr->refCount.decAndTestIfZero()) |
{ | { |
// printf("\ncls.hdr->refCount=%u\n",cls.hdr->refCount.get()); |
|
_destroyExternalReferences(); | _destroyExternalReferences(); |
free(cls.base); | free(cls.base); |
cls.base=0; | cls.base=0; |
} | } |
else |
|
{ |
|
// printf("\ncls.hdr->refCount=%u\n",cls.hdr->refCount.get()); |
|
} |
|
| |
}; | }; |
| |
void _destroyExternalReferences(); |
|
|
|
/** | /** |
* Constructs an uninitialized SCMOClass object. |
* Constructs an empty SCMOClass object. |
*/ | */ |
SCMOClass(); | SCMOClass(); |
| |
inline void _initSCMOClass(); | inline void _initSCMOClass(); |
| |
|
void _destroyExternalReferences(); |
|
|
SCMO_RC _getProperyNodeIndex(Uint32& node, const char* name) const; | SCMO_RC _getProperyNodeIndex(Uint32& node, const char* name) const; |
SCMO_RC _getKeyBindingNodeIndex(Uint32& node, const char* name) const; | SCMO_RC _getKeyBindingNodeIndex(Uint32& node, const char* name) const; |
| |
|
|
friend class SCMODump; | friend class SCMODump; |
friend class SCMOXmlWriter; | friend class SCMOXmlWriter; |
friend class SCMOClassCache; | friend class SCMOClassCache; |
|
friend class SCMOStreamer; |
}; | }; |
| |
| |