version 1.20, 2012/05/10 09:52:11
|
version 1.24, 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 |
|
// |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/SCMO.h> | #include <Pegasus/Common/SCMO.h> |
|
|
SCMOInstance::SCMOInstance( | SCMOInstance::SCMOInstance( |
SCMOClass& baseClass, | SCMOClass& baseClass, |
Boolean includeQualifiers, | Boolean includeQualifiers, |
Boolean includeClassOrigin, |
Boolean includeClassOrigin) |
const char** propertyList) |
|
{ | { |
| |
_initSCMOInstance(new SCMOClass(baseClass)); | _initSCMOInstance(new SCMOClass(baseClass)); |
|
|
_setBinary(hostName,len+1,inst.hdr->hostName,&inst.mem); | _setBinary(hostName,len+1,inst.hdr->hostName,&inst.mem); |
} | } |
| |
void SCMOInstance::setHostName_l(const char* hostName, Uint32 len) |
|
{ |
|
// Copy on Write is only necessary if a realloc() becomes necessary |
|
if (inst.mem->freeBytes < ((len+8) & ~7)) |
|
{ |
|
_copyOnWrite(); |
|
} |
|
// copy including trailing '\0' |
|
_setBinary(hostName,len+1,inst.hdr->hostName,&inst.mem); |
|
} |
|
|
|
const char* SCMOInstance::getHostName() const | const char* SCMOInstance::getHostName() const |
{ | { |
return _getCharString(inst.hdr->hostName,inst.base); | return _getCharString(inst.hdr->hostName,inst.base); |
|
|
return _getCharString(inst.hdr->instNameSpace,inst.base); | return _getCharString(inst.hdr->instNameSpace,inst.base); |
} | } |
| |
|
void SCMOInstance::completeHostNameAndNamespace( |
|
const char* hn, |
|
Uint32 hnLen, |
|
const char* ns, |
|
Uint32 nsLen) |
|
{ |
|
// hostName is Null or empty String ? |
|
if (0 == inst.hdr->hostName.size || |
|
0 == inst.base[inst.hdr->hostName.start]) |
|
{ |
|
// Copy on Write is only necessary if a realloc() becomes necessary |
|
if (inst.mem->freeBytes < ((hnLen+8) & ~7)) |
|
{ |
|
_copyOnWrite(); |
|
} |
|
// copy including trailing '\0' |
|
_setBinary(hn,hnLen+1,inst.hdr->hostName,&inst.mem); |
|
} |
|
// namespace is Null or empty String ? |
|
if (0 == inst.hdr->instNameSpace.size || |
|
0 == inst.base[inst.hdr->instNameSpace.start]) |
|
{ |
|
setNameSpace_l(ns,nsLen); |
|
} |
|
} |
|
|
|
|
void SCMOInstance::buildKeyBindingsFromProperties() | void SCMOInstance::buildKeyBindingsFromProperties() |
{ | { |
Uint32 propNode; | Uint32 propNode; |
|
|
| |
} | } |
| |
|
// class SCMODump only in debug builds available |
|
#ifdef PEGASUS_DEBUG |
/****************************************************************************** | /****************************************************************************** |
* SCMODump Print and Dump functions | * SCMODump Print and Dump functions |
*****************************************************************************/ | *****************************************************************************/ |
|
|
| |
return; | return; |
} | } |
|
#endif // PEGASUS_DEBUG (class SCMODump only in debug builds available) |
| |
| |
/***************************************************************************** | /***************************************************************************** |