version 1.1.2.34, 2009/11/12 16:18:04
|
version 1.1.2.40, 2009/11/19 16:25: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. |
* | * |
|
|
* 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. |
* | * |
|
|
* @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() |
|
|
}; | }; |
| |
| |
|
void _copyOnWrite() |
|
{ |
|
if ( 1 < inst.hdr->refCount.get() ) |
|
{ |
|
SCMBInstance_Main * oldRef = inst.hdr; |
|
fprintf(stderr,"!! Copy on Write (%d) !!\n", |
|
inst.hdr->refCount.get() ); |
|
_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(); |
| |
void _destroyExternalKeyBindings(); | void _destroyExternalKeyBindings(); |
|
|
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( |