version 1.1.2.34, 2009/11/12 16:18:04
|
version 1.1.2.43, 2009/12/04 10:44:45
|
|
|
} | } |
| |
/** | /** |
|
* Constructs a SCMOInstance from a memory object of type SCMBInstance_Main. |
|
* It incremets the referece counter of the memory object. |
|
* @param hdr A memory object of type SCMBInstance_Main. |
|
**/ |
|
SCMOInstance(SCMBInstance_Main* hdr) |
|
{ |
|
inst.hdr = hdr; |
|
Ref(); |
|
} |
|
|
|
|
|
/** |
* Assignment operator for the SCMO instance, | * Assignment operator for the SCMO instance, |
* @param theSCMOClass The right hand value |
* @param theSCMOInstance The right hand value |
**/ | **/ |
SCMOInstance& operator=(const SCMOInstance& theSCMOInstance) | SCMOInstance& operator=(const SCMOInstance& theSCMOInstance) |
{ | { |
|
|
* Has to be copied by caller. | * Has to be copied by caller. |
* It is set to NULL if rc != SCMO_OK. | * It is set to NULL if rc != SCMO_OK. |
* @param pvalue Returns a pointer to the value of property. | * @param pvalue Returns a pointer to the value of property. |
* The value is strored in a SCMBUnion |
* The value is stored in a SCMBUnion |
* and has to be copied by the caller ! | * and has to be copied by the caller ! |
* It returns NULL if rc != SCMO_OK. | * It returns NULL if rc != SCMO_OK. |
* | * |
|
|
Boolean& isArray, | Boolean& isArray, |
Uint32& size ) const; | Uint32& size ) const; |
| |
|
void getSCMBValuePropertyAt( |
|
Uint32 pos, |
|
SCMBValue** value, |
|
const char ** valueBase, |
|
SCMBClassProperty ** propDef, |
|
const char ** classBase) const; |
|
|
/** | /** |
* Gets the type and value of the named property. | * Gets the type and value of the named property. |
* The value has to be copied by the caller ! | * The value has to be copied by the caller ! |
* @param name The property name | * @param name The property name |
* @param pvalue Returns a pointer to the value of property. | * @param pvalue Returns a pointer to the value of property. |
* The value is strored in a SCMBUnion |
* The value is stored in a SCMBUnion |
* and has to be copied by the caller ! | * and has to be copied by the caller ! |
* It returns NULL if rc != SCMO_OK. | * It returns NULL if rc != SCMO_OK. |
* | * |
|
|
CIMType& type, | CIMType& type, |
const SCMBUnion** keyvalue) const; | const SCMBUnion** keyvalue) const; |
| |
|
SCMO_RC getKeyBindingAtUnresolved( |
|
Uint32 node, |
|
const char** pname, |
|
Uint32 & pnameLen, |
|
CIMType& type, |
|
const SCMBUnion** pdata, |
|
const char** valueBase) const; |
|
|
/** | /** |
* Get the named key binding. | * Get the named key binding. |
* @parm name The name of the key binding. | * @parm name The name of the key binding. |
* @param type Returns the type as CIMType. | * @param type Returns the type as CIMType. |
* It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND. | * It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND. |
* @param keyvalue Returns a pointer to the value of keybinding. | * @param keyvalue Returns a pointer to the value of keybinding. |
* The value is strored in a SCMBUnion |
* The value is stored in a SCMBUnion |
* and has to be copied by the caller ! | * and has to be copied by the caller ! |
* It returns NULL if rc != SCMO_OK. | * It returns NULL if rc != SCMO_OK. |
* | * |
|
|
inst.hdr->flags.includeClassOrigin = false; | inst.hdr->flags.includeClassOrigin = false; |
} | } |
| |
|
|
|
/** |
|
* Returns the number of external references hosted by the instance. |
|
**/ |
|
Uint32 numberExtRef() const |
|
{ |
|
return inst.mem->numberExtRef; |
|
} |
|
|
|
/** |
|
* Gets the pointer of an external reference of the instance. |
|
* Warning: The pointer is purely returned. No management is done. |
|
* @parm idx The index of the external reference. |
|
**/ |
|
SCMOInstance* getExtRef(Uint32 idx) const; |
|
|
|
/** |
|
* Sets a pointer of an external reference of the instance. |
|
* Warning: The pointer is purely returned. No management is done. |
|
* @parm idx The index of the external reference. |
|
* @parm ptr The pointer to an SCMOInstance |
|
**/ |
|
void putExtRef(Uint32 idx,SCMOInstance* ptr); |
|
|
private: | private: |
| |
void Ref() | void Ref() |
{ | { |
inst.hdr->refCount++; | inst.hdr->refCount++; |
// printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get()); |
|
}; | }; |
| |
void Unref() | void Unref() |
{ | { |
if (inst.hdr->refCount.decAndTestIfZero()) | if (inst.hdr->refCount.decAndTestIfZero()) |
{ | { |
// printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get()); |
|
// All external references has to be destroyed. | // All external references has to be destroyed. |
_destroyExternalReferences(); | _destroyExternalReferences(); |
// The class has also be dereferenced. | // The class has also be dereferenced. |
|
|
free(inst.base); | free(inst.base); |
inst.base=NULL; | inst.base=NULL; |
} | } |
else |
|
|
}; |
|
|
|
|
|
void _copyOnWrite() |
|
{ |
|
if ( 1 < inst.hdr->refCount.get() ) |
|
{ |
|
SCMBInstance_Main * oldRef = inst.hdr; |
|
_clone(); |
|
if (oldRef->refCount.decAndTestIfZero()) |
{ | { |
// printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get()); |
// All external references has to be destroyed. |
|
_destroyExternalReferencesInternal((SCMBMgmt_Header*)oldRef); |
|
// The class has also be dereferenced. |
|
delete oldRef->theClass; |
|
free((void*)oldRef); |
|
oldRef=0; |
|
} |
} | } |
|
|
}; | }; |
| |
|
void _clone(); |
| |
void _destroyExternalReferences(); | void _destroyExternalReferences(); |
| |
|
|
friend class SCMOClass; | friend class SCMOClass; |
friend class SCMODump; | friend class SCMODump; |
friend class SCMOXmlWriter; | friend class SCMOXmlWriter; |
|
friend class SCMOStreamer; |
}; | }; |
| |
inline void SCMOInstance::_getPropertyAt( | inline void SCMOInstance::_getPropertyAt( |
|
|
} | } |
} | } |
| |
|
inline void SCMOInstance::getSCMBValuePropertyAt( |
|
Uint32 pos, |
|
SCMBValue** value, |
|
const char ** valueBase, |
|
SCMBClassProperty ** propDef, |
|
const char ** propDefBase) const |
|
{ |
|
_getPropertyAt(pos,value,valueBase,propDef); |
|
|
|
*propDefBase = inst.hdr->theClass->cls.base; |
|
} |
|
|
|
inline SCMO_RC SCMOInstance::getKeyBindingAtUnresolved( |
|
Uint32 node, |
|
const char** pname, |
|
Uint32 & pnameLen, |
|
CIMType& type, |
|
const SCMBUnion** pdata, |
|
const char** valueBase) const |
|
{ |
|
SCMO_RC rc = _getKeyBindingDataAtNodeIndex(node,pname,pnameLen,type,pdata); |
|
*valueBase = inst.base; |
|
return rc; |
|
} |
|
|
|
|
|
|
#define PEGASUS_ARRAY_T SCMOInstance | #define PEGASUS_ARRAY_T SCMOInstance |
# include <Pegasus/Common/ArrayInter.h> | # include <Pegasus/Common/ArrayInter.h> |
#undef PEGASUS_ARRAY_T | #undef PEGASUS_ARRAY_T |