version 1.8, 2009/12/21 13:00:32
|
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> |
|
|
#define _NUM_QUALIFIER_NAMES \ | #define _NUM_QUALIFIER_NAMES \ |
(sizeof(_qualifierNameStrLit)/sizeof(_qualifierNameStrLit[0])) | (sizeof(_qualifierNameStrLit)/sizeof(_qualifierNameStrLit[0])) |
| |
|
|
|
/***************************************************************************** |
|
* The static declaration of the common SCMO memory functions. |
|
*****************************************************************************/ |
|
|
|
static Uint64 _getFreeSpace( |
|
SCMBDataPtr& ptr, |
|
Uint32 size, |
|
SCMBMgmt_Header** pmem); |
|
|
|
static void _setString( |
|
const String& theString, |
|
SCMBDataPtr& ptr, |
|
SCMBMgmt_Header** pmem); |
|
|
|
static void _setBinary( |
|
const void* theBuffer, |
|
Uint32 bufferSize, |
|
SCMBDataPtr& ptr, |
|
SCMBMgmt_Header** pmem); |
|
|
|
|
|
|
/***************************************************************************** | /***************************************************************************** |
* Internal inline functions. | * Internal inline functions. |
*****************************************************************************/ | *****************************************************************************/ |
|
|
} | } |
} | } |
| |
|
static void _deleteExternalReferenceInternal( |
|
SCMBMgmt_Header* memHdr, SCMOInstance *extRefPtr) |
|
{ |
|
Uint32 nuExtRef = memHdr->numberExtRef; |
|
char * base = ((char*)memHdr); |
|
Uint64* array = |
|
(Uint64*)&(base[memHdr->extRefIndexArray.start]); |
|
Uint32 extRefIndex = PEG_NOT_FOUND; |
|
|
|
for (Uint32 i = 0; i < nuExtRef; i++) |
|
{ |
|
if (((SCMBUnion*)(&(base[array[i]])))->extRefPtr == extRefPtr) |
|
{ |
|
extRefIndex = i; |
|
break; |
|
} |
|
} |
|
PEGASUS_ASSERT (extRefIndex != PEG_NOT_FOUND); |
|
|
|
// Shrink extRefIndexArray |
|
|
|
for (Uint32 i = extRefIndex + 1; i < nuExtRef; i++) |
|
{ |
|
array[i-1] = array[i]; |
|
} |
|
|
|
array[nuExtRef-1] = 0; |
|
memHdr->numberExtRef--; |
|
|
|
delete extRefPtr; |
|
} |
|
|
/***************************************************************************** | /***************************************************************************** |
* The SCMOClass methods | * The SCMOClass methods |
*****************************************************************************/ | *****************************************************************************/ |
|
|
tag = _generateStringTag((const char*)name, len); | tag = _generateStringTag((const char*)name, len); |
// get the node index of the hash table | // get the node index of the hash table |
hashIdx = | hashIdx = |
cls.hdr->keyBindingSet.hashTable[tag%PEGASUS_KEYBINDIG_SCMB_HASHSIZE]; |
cls.hdr->keyBindingSet.hashTable[tag&(PEGASUS_KEYBINDIG_SCMB_HASHSIZE-1)]; |
// there is no entry in the hash table on this hash table index. | // there is no entry in the hash table on this hash table index. |
if (hashIdx == 0) | if (hashIdx == 0) |
{ | { |
|
|
tag = _generateStringTag((const char*)name, len); | tag = _generateStringTag((const char*)name, len); |
// get the node index of the hash table | // get the node index of the hash table |
hashIdx = | hashIdx = |
cls.hdr->propertySet.hashTable[tag%PEGASUS_PROPERTY_SCMB_HASHSIZE]; |
cls.hdr->propertySet.hashTable[tag&(PEGASUS_PROPERTY_SCMB_HASHSIZE -1)]; |
// there is no entry in the hash table on this hash table index. | // there is no entry in the hash table on this hash table index. |
if (hashIdx == 0) | if (hashIdx == 0) |
{ | { |
|
|
Uint32 *hashTable = cls.hdr->keyBindingSet.hashTable; | Uint32 *hashTable = cls.hdr->keyBindingSet.hashTable; |
| |
// calculate the new hash index of the new property. | // calculate the new hash index of the new property. |
Uint32 hash = newKeyNode->nameHashTag % PEGASUS_KEYBINDIG_SCMB_HASHSIZE; |
Uint32 hash = newKeyNode->nameHashTag & |
|
(PEGASUS_KEYBINDIG_SCMB_HASHSIZE - 1); |
| |
// 0 is an invalid index in the hash table | // 0 is an invalid index in the hash table |
if (hashTable[hash] == 0) | if (hashTable[hash] == 0) |
|
|
Uint32 *hashTable = cls.hdr->propertySet.hashTable; | Uint32 *hashTable = cls.hdr->propertySet.hashTable; |
| |
// calcuate the new hash index of the new property. | // calcuate the new hash index of the new property. |
Uint32 hash = newPropNode->theProperty.nameHashTag % |
Uint32 hash = newPropNode->theProperty.nameHashTag & |
PEGASUS_PROPERTY_SCMB_HASHSIZE; |
(PEGASUS_PROPERTY_SCMB_HASHSIZE -1); |
| |
// 0 is an invalid index in the hash table | // 0 is an invalid index in the hash table |
if (hashTable[hash] == 0) | if (hashTable[hash] == 0) |
|
|
| |
// Create a filter to set the bit. | // Create a filter to set the bit. |
// Modulo division with 64. Shift left a bit by the remainder. | // Modulo division with 64. Shift left a bit by the remainder. |
Uint64 filter = ( (Uint64)1 << (i%64)); |
Uint64 filter = ( (Uint64)1 << (i & 63)); |
| |
// Calculate the real pointer to the Uint64 array | // Calculate the real pointer to the Uint64 array |
keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]); | keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]); |
|
|
| |
// Create a filter to check if the bit is set: | // Create a filter to check if the bit is set: |
// Modulo division with 64. Shift left a bit by the remainder. | // Modulo division with 64. Shift left a bit by the remainder. |
Uint64 filter = ( (Uint64)1 << (i%64)); |
Uint64 filter = ( (Uint64)1 << (i & 63)); |
| |
// Calculate the real pointer to the Uint64 array | // Calculate the real pointer to the Uint64 array |
keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]); | keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]); |
|
|
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)); |
|
|
inst.hdr->flags.includeQualifiers=includeQualifiers; | inst.hdr->flags.includeQualifiers=includeQualifiers; |
inst.hdr->flags.includeClassOrigin=includeClassOrigin; | inst.hdr->flags.includeClassOrigin=includeClassOrigin; |
| |
setPropertyFilter(propertyList); |
|
|
|
} | } |
| |
SCMOInstance::SCMOInstance(SCMOClass& baseClass, const CIMObjectPath& cimObj) | SCMOInstance::SCMOInstance(SCMOClass& baseClass, const CIMObjectPath& cimObj) |
|
|
// only references can be a key binding | // only references can be a key binding |
if (theClassKeyBindNodeArray[i].type == CIMTYPE_REFERENCE) | if (theClassKeyBindNodeArray[i].type == CIMTYPE_REFERENCE) |
{ | { |
delete theInstanceKeyBindingNodeArray[i].data.extRefPtr; |
_deleteExternalReferenceInternal( |
|
inst.mem, |
|
theInstanceKeyBindingNodeArray[i].data.extRefPtr); |
} | } |
} | } |
}// for all key bindings | }// for all key bindings |
|
|
// only references can be a key binding. | // only references can be a key binding. |
if (theUserDefKBElement->type == CIMTYPE_REFERENCE) | if (theUserDefKBElement->type == CIMTYPE_REFERENCE) |
{ | { |
delete theUserDefKBElement->value.data.extRefPtr; |
_deleteExternalReferenceInternal( |
|
inst.mem, |
|
theUserDefKBElement->value.data.extRefPtr); |
} | } |
} | } |
| |
|
|
} | } |
} | } |
| |
if (inst.hdr->flags.isFiltered) |
|
{ |
|
// Get absolut pointer to property filter index map of the instance |
|
Uint32* propertyFilterIndexMap = |
|
(Uint32*)&(inst.base[inst.hdr->propertyFilterIndexMap.start]); |
|
|
|
for(Uint32 i = 0, k = inst.hdr->filterProperties; i<k; i++) |
|
{ |
|
// Get absolut pointer to property filter index map |
|
// of the instance get the real node index of the property. |
|
CIMProperty theProperty=_getCIMPropertyAtNodeIndex( |
|
propertyFilterIndexMap[i]); |
|
|
|
newInstance._rep->_properties.append(theProperty); |
|
} |
|
|
|
} |
|
else |
|
{ |
|
|
|
if (inst.hdr->flags.exportSetOnly) | if (inst.hdr->flags.exportSetOnly) |
{ | { |
for(Uint32 i = 0, k = inst.hdr->numberProperties; i<k; i++) | for(Uint32 i = 0, k = inst.hdr->numberProperties; i<k; i++) |
|
|
{ | { |
for(Uint32 i = 0, k = inst.hdr->numberProperties; i<k; i++) | for(Uint32 i = 0, k = inst.hdr->numberProperties; i<k; i++) |
{ | { |
SCMBValue* theInstPropArray = |
|
(SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]); |
|
|
|
// Set all properties in the CIMInstance gegarding they | // Set all properties in the CIMInstance gegarding they |
// are part of the SCMOInstance or the SCMOClass. | // are part of the SCMOInstance or the SCMOClass. |
CIMProperty theProperty=_getCIMPropertyAtNodeIndex(i); | CIMProperty theProperty=_getCIMPropertyAtNodeIndex(i); |
|
|
newInstance._rep->_properties.append(theProperty); | newInstance._rep->_properties.append(theProperty); |
} | } |
} | } |
} |
|
cimInstance = newInstance; | cimInstance = newInstance; |
| |
return rc; | return rc; |
|
|
| |
void SCMOInstance::_setCIMObjectPath(const CIMObjectPath& cimObj) | void SCMOInstance::_setCIMObjectPath(const CIMObjectPath& cimObj) |
{ | { |
CIMObjectPathRep* objRep = cimObj._rep; |
CString className = cimObj.getClassName().getString().getCString(); |
|
|
CString className = objRep->_className.getString().getCString(); |
|
| |
// Is the instance from the same class ? | // Is the instance from the same class ? |
if (!(_equalNoCaseUTF8Strings( | if (!(_equalNoCaseUTF8Strings( |
|
|
strlen(className)))) | strlen(className)))) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_CLASS, | throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_CLASS, |
objRep->_className.getString()); |
cimObj.getClassName().getString()); |
} | } |
| |
//set host name | //set host name |
_setString(objRep->_host,inst.hdr->hostName,&inst.mem ); |
_setString(cimObj.getHost(),inst.hdr->hostName,&inst.mem ); |
| |
for (Uint32 i = 0, k = objRep->_keyBindings.size(); i < k; i++) |
const Array<CIMKeyBinding> & keys=cimObj.getKeyBindings(); |
|
for (Uint32 i = 0, k = keys.size(); i < k; i++) |
{ | { |
String key = objRep->_keyBindings[i].getValue(); |
String key = keys[i].getValue(); |
_setKeyBindingFromString( | _setKeyBindingFromString( |
(const char*) |
(const char*) keys[i].getName().getString().getCString(), |
objRep->_keyBindings[i].getName().getString().getCString(), |
|
_CIMTypeFromKeyBindingType( | _CIMTypeFromKeyBindingType( |
(const char*)key.getCString(), | (const char*)key.getCString(), |
objRep->_keyBindings[i].getType()), |
keys[i].getType()), |
key); | key); |
} | } |
|
|
} | } |
|
|
void SCMOInstance::_setCIMValueAtNodeIndex( | void SCMOInstance::_setCIMValueAtNodeIndex( |
Uint32 node, | Uint32 node, |
CIMValueRep* valRep, | CIMValueRep* valRep, |
|
|
_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) |
|
{ |
|
_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); |
|
|
void SCMOInstance::setNameSpace_l(const char* nameSpace, Uint32 len) | void SCMOInstance::setNameSpace_l(const char* nameSpace, Uint32 len) |
{ | { |
// Copy on Write is only necessary if a realloc() becomes necessary | // Copy on Write is only necessary if a realloc() becomes necessary |
if (inst.mem->freeBytes < len) |
if (inst.mem->freeBytes < ((len+8) & ~7)) |
{ | { |
_copyOnWrite(); | _copyOnWrite(); |
} | } |
|
|
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; |
|
// The theClassKeyPropList pointer will always be valid, |
|
// even after a realloc() caused by copyOnWrite() |
|
// as this is an absolute pointer to the class which does not change |
Uint32* theClassKeyPropList = | Uint32* theClassKeyPropList = |
(Uint32*) &((inst.hdr->theClass.ptr->cls.base) | (Uint32*) &((inst.hdr->theClass.ptr->cls.base) |
[(inst.hdr->theClass.ptr->cls.hdr->keyIndexList.start)]); | [(inst.hdr->theClass.ptr->cls.hdr->keyIndexList.start)]); |
| |
SCMBKeyBindingValue* theKeyBindValueArray; |
SCMBKeyBindingValue* theKeyBindValueArray = |
SCMBValue* theInstPropNodeArray; |
(SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]); |
|
SCMBValue* theInstPropNodeArray= |
|
(SCMBValue*)&inst.base[inst.hdr->propertyArray.start]; |
| |
Uint32 propNode; |
inst.hdr->numberKeyBindings = |
|
inst.hdr->theClass.ptr->cls.hdr->keyBindingSet.number; |
| |
for (Uint32 i = 0, k = inst.hdr->numberKeyBindings; i < k; i++) | for (Uint32 i = 0, k = inst.hdr->numberKeyBindings; i < k; i++) |
{ | { |
// the instance pointers has to be reinitialized each time, |
|
// because in _setKeyBindingFromSCMBUnion() |
|
// a reallocation can take place. |
|
theKeyBindValueArray = |
|
(SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]); |
|
|
|
theInstPropNodeArray = |
|
(SCMBValue*)&inst.base[inst.hdr->propertyArray.start]; |
|
|
|
// If the keybinding is not set. | // If the keybinding is not set. |
if (!theKeyBindValueArray[i].isSet) | if (!theKeyBindValueArray[i].isSet) |
{ | { |
|
|
!theInstPropNodeArray[propNode].flags.isNull) | !theInstPropNodeArray[propNode].flags.isNull) |
{ | { |
_copyOnWrite(); | _copyOnWrite(); |
|
// the instance pointers have to be recalculated as copyOnWrite |
|
// might change the absolute address of these pointers |
|
theInstPropNodeArray = |
|
(SCMBValue*)&inst.base[inst.hdr->propertyArray.start]; |
|
theKeyBindValueArray = |
|
(SCMBKeyBindingValue*) |
|
&(inst.base[inst.hdr->keyBindingArray.start]); |
| |
_setKeyBindingFromSCMBUnion( | _setKeyBindingFromSCMBUnion( |
theInstPropNodeArray[propNode].valueType, | theInstPropNodeArray[propNode].valueType, |
theInstPropNodeArray[propNode].value, | theInstPropNodeArray[propNode].value, |
inst.base, | inst.base, |
theKeyBindValueArray[i]); | theKeyBindValueArray[i]); |
|
|
|
// the instance pointers have to be reinitialized each time, |
|
// because a reallocation can take place |
|
// in _setKeyBindingFromSCMBUnion() |
|
theKeyBindValueArray = |
|
(SCMBKeyBindingValue*) |
|
&(inst.base[inst.hdr->keyBindingArray.start]); |
|
theInstPropNodeArray = |
|
(SCMBValue*)&inst.base[inst.hdr->propertyArray.start]; |
|
|
} | } |
} | } |
} | } |
|
|
return rc; | return rc; |
} | } |
| |
// is filtering on ? |
|
if (inst.hdr->flags.isFiltered) |
|
{ |
|
// Is the property NOT in the property filter ? |
|
if(!_isPropertyInFilter(node)) |
|
{ |
|
// The named propery is not part of this instance |
|
// due to filtering. |
|
return SCMO_NOT_FOUND; |
|
} |
|
} |
|
|
|
return _getPropertyAtNodeIndex(node,&pname,type,pOutVal,isArray,size); | return _getPropertyAtNodeIndex(node,&pname,type,pOutVal,isArray,size); |
} | } |
| |
|
|
*pOutVal = 0; | *pOutVal = 0; |
isArray = false; | isArray = false; |
size = 0; | size = 0; |
Uint32 node; |
|
| |
// is filtering on ? |
if (idx >= inst.hdr->numberProperties) |
if (inst.hdr->flags.isFiltered) |
|
{ |
|
// check the number of properties part of the filter |
|
if (idx >= inst.hdr->filterProperties) |
|
{ | { |
return SCMO_INDEX_OUT_OF_BOUND; | return SCMO_INDEX_OUT_OF_BOUND; |
} | } |
| |
// Get absolut pointer to property filter index map of the instance |
return _getPropertyAtNodeIndex(idx,pname,type,pOutVal,isArray,size); |
Uint32* propertyFilterIndexMap = |
|
(Uint32*)&(inst.base[inst.hdr->propertyFilterIndexMap.start]); |
|
|
|
// get the real node index of the property. |
|
node = propertyFilterIndexMap[idx]; |
|
} |
|
else |
|
{ |
|
// the index is used as node index. |
|
node = idx; |
|
if (node >= inst.hdr->numberProperties) |
|
{ |
|
return SCMO_INDEX_OUT_OF_BOUND; |
|
} |
|
} |
|
|
|
return _getPropertyAtNodeIndex(node,pname,type,pOutVal,isArray,size); |
|
} | } |
| |
SCMO_RC SCMOInstance::getPropertyNodeIndex(const char* name, Uint32& node) const | SCMO_RC SCMOInstance::getPropertyNodeIndex(const char* name, Uint32& node) const |
|
|
return rc; | return rc; |
} | } |
| |
// is filtering on ? |
|
if (inst.hdr->flags.isFiltered) |
|
{ |
|
// Is the property NOT in the property filter ? |
|
if(!_isPropertyInFilter(node)) |
|
{ |
|
// The named propery is not part of this instance |
|
// due to filtering. |
|
return SCMO_NOT_FOUND; |
|
} |
|
} |
|
|
|
// check class origin if set. | // check class origin if set. |
if (origin!= 0) | if (origin!= 0) |
{ | { |
|
|
return SCMO_INDEX_OUT_OF_BOUND; | return SCMO_INDEX_OUT_OF_BOUND; |
} | } |
| |
// is filtering on ? |
|
if (inst.hdr->flags.isFiltered) |
|
{ |
|
// Is the property NOT in the property filter ? |
|
if(!_isPropertyInFilter(node)) |
|
{ |
|
// The proptery of the is not set due to filtering. |
|
return SCMO_OK; |
|
} |
|
} |
|
|
|
// Is the traget type OK ? | // Is the traget type OK ? |
// The type stored in the class information is set on realType. | // The type stored in the class information is set on realType. |
// It must be used in further calls to guaranty consistence. | // It must be used in further calls to guaranty consistence. |
|
|
| |
case CIMTYPE_STRING: | case CIMTYPE_STRING: |
{ | { |
_setString(*((String*)((void*)&u)), |
CString cstr = ((String*)((void*)&u))->getCString(); |
|
const char *cptr = (const char*)cstr; |
|
_setBinary( |
|
cptr, |
|
strlen(cptr) + 1, |
scmoUnion->stringValue, | scmoUnion->stringValue, |
pmem ); | pmem ); |
break; | break; |
|
|
| |
Uint32 SCMOInstance::getPropertyCount() const | Uint32 SCMOInstance::getPropertyCount() const |
{ | { |
if (inst.hdr->flags.isFiltered) |
|
{ |
|
return(inst.hdr->filterProperties); |
|
} |
|
|
|
return(inst.hdr->numberProperties); | return(inst.hdr->numberProperties); |
} | } |
| |
|
|
{ | { |
return(u); | return(u); |
} | } |
break; |
|
} | } |
| |
case CIMTYPE_STRING: | case CIMTYPE_STRING: |
|
|
} | } |
| |
return(ptr); | return(ptr); |
break; |
|
} | } |
default: | default: |
{ | { |
|
|
inst.hdr->keyBindingArray, | inst.hdr->keyBindingArray, |
sizeof(SCMBKeyBindingValue)*inst.hdr->numberKeyBindings, | sizeof(SCMBKeyBindingValue)*inst.hdr->numberKeyBindings, |
&inst.mem); | &inst.mem); |
|
|
|
// Clear the keybindings after the allocation. Setting the keybindings |
|
// later causes this value to be reinitialized. |
|
inst.hdr->numberKeyBindings = 0; |
|
|
|
markAsCompromised(); |
} | } |
| |
Uint32 SCMOInstance::getKeyBindingCount() const | Uint32 SCMOInstance::getKeyBindingCount() const |
|
|
return CIMTYPE_REAL64; | return CIMTYPE_REAL64; |
} | } |
} | } |
break; |
|
} | } |
| |
| |
case CIMKeyBinding::STRING: | case CIMKeyBinding::STRING: |
{ | { |
return CIMTYPE_STRING; | return CIMTYPE_STRING; |
break; |
|
} | } |
| |
case CIMKeyBinding::BOOLEAN: | case CIMKeyBinding::BOOLEAN: |
{ | { |
return CIMTYPE_BOOLEAN; | return CIMTYPE_BOOLEAN; |
break; |
|
} | } |
| |
case CIMKeyBinding::REFERENCE: | case CIMKeyBinding::REFERENCE: |
{ | { |
return CIMTYPE_REFERENCE; | return CIMTYPE_REFERENCE; |
break; |
|
} | } |
| |
default: | default: |
|
|
// Can cause reallocation ! | // Can cause reallocation ! |
_setString(kbs,scmoKBV.data.stringValue,&inst.mem); | _setString(kbs,scmoKBV.data.stringValue,&inst.mem); |
return true; | return true; |
break; |
|
} | } |
case CIMTYPE_REFERENCE: | case CIMTYPE_REFERENCE: |
{ | { |
|
|
{ | { |
// From PEP 194: EmbeddedObjects cannot be keys. | // From PEP 194: EmbeddedObjects cannot be keys. |
throw TypeMismatchException(); | throw TypeMismatchException(); |
break; |
|
} | } |
default: | default: |
{ | { |
|
|
| |
_copyOnWrite(); | _copyOnWrite(); |
| |
|
// If keybindings exists and cleared using the clearKeyBindings() |
|
// method, reset the value to the actual keybindings count exists |
|
// in the class. |
|
if (!inst.hdr->numberKeyBindings) |
|
{ |
|
inst.hdr->numberKeyBindings = |
|
inst.hdr->theClass.ptr->cls.hdr->keyBindingSet.number; |
|
} |
|
|
rc = inst.hdr->theClass.ptr->_getKeyBindingNodeIndex(node,name); | rc = inst.hdr->theClass.ptr->_getKeyBindingNodeIndex(node,name); |
if (rc != SCMO_OK) | if (rc != SCMO_OK) |
{ | { |
|
|
| |
_copyOnWrite(); | _copyOnWrite(); |
| |
|
// If keybindings exists and cleared using the clearKeyBindings() |
|
// method, reset the value to the actual keybindings count exists |
|
// in the class. |
|
if (!inst.hdr->numberKeyBindings) |
|
{ |
|
inst.hdr->numberKeyBindings = |
|
inst.hdr->theClass.ptr->cls.hdr->keyBindingSet.number; |
|
} |
|
|
|
|
// create a pointer to keybinding node array of the class. | // create a pointer to keybinding node array of the class. |
Uint64 idx = inst.hdr->theClass.ptr->cls.hdr-> | Uint64 idx = inst.hdr->theClass.ptr->cls.hdr-> |
keyBindingSet.nodeArray.start; | keyBindingSet.nodeArray.start; |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.u8=Uint8(keyValue->simple.val.u64); | kbValue.data.simple.val.u8=Uint8(keyValue->simple.val.u64); |
return SCMO_OK; |
|
break; | break; |
} | } |
case CIMTYPE_UINT16: | case CIMTYPE_UINT16: |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.u16=Uint16(keyValue->simple.val.u64); | kbValue.data.simple.val.u16=Uint16(keyValue->simple.val.u64); |
return SCMO_OK; |
|
break; | break; |
} | } |
case CIMTYPE_UINT32: | case CIMTYPE_UINT32: |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.u32=Uint32(keyValue->simple.val.u64); | kbValue.data.simple.val.u32=Uint32(keyValue->simple.val.u64); |
return SCMO_OK; |
|
break; | break; |
} | } |
case CIMTYPE_UINT64: | case CIMTYPE_UINT64: |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.u64=keyValue->simple.val.u64; | kbValue.data.simple.val.u64=keyValue->simple.val.u64; |
return SCMO_OK; |
|
break; | break; |
} | } |
default: | default: |
{ | { |
return SCMO_TYPE_MISSMATCH; | return SCMO_TYPE_MISSMATCH; |
break; |
|
} | } |
} | } |
|
return SCMO_OK; |
|
|
} | } |
| |
if (setType == CIMTYPE_SINT64) | if (setType == CIMTYPE_SINT64) |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.s8=Sint8(keyValue->simple.val.s64); | kbValue.data.simple.val.s8=Sint8(keyValue->simple.val.s64); |
return SCMO_OK; |
|
break; | break; |
} | } |
case CIMTYPE_SINT16: | case CIMTYPE_SINT16: |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.s16=Sint16(keyValue->simple.val.s64); | kbValue.data.simple.val.s16=Sint16(keyValue->simple.val.s64); |
return SCMO_OK; |
|
break; | break; |
} | } |
case CIMTYPE_SINT32: | case CIMTYPE_SINT32: |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.s32=Sint32(keyValue->simple.val.s64); | kbValue.data.simple.val.s32=Sint32(keyValue->simple.val.s64); |
return SCMO_OK; |
|
break; | break; |
} | } |
case CIMTYPE_SINT64: | case CIMTYPE_SINT64: |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.s64=keyValue->simple.val.s64; | kbValue.data.simple.val.s64=keyValue->simple.val.s64; |
return SCMO_OK; |
|
break; | break; |
} | } |
default: | default: |
{ | { |
return SCMO_TYPE_MISSMATCH; | return SCMO_TYPE_MISSMATCH; |
break; |
|
} | } |
} | } |
|
return SCMO_OK; |
} | } |
| |
if (setType == CIMTYPE_REAL64) | if (setType == CIMTYPE_REAL64) |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.r32=Real32(keyValue->simple.val.r64); | kbValue.data.simple.val.r32=Real32(keyValue->simple.val.r64); |
return SCMO_OK; |
|
break; | break; |
} | } |
case CIMTYPE_REAL64: | case CIMTYPE_REAL64: |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
kbValue.data.simple.hasValue=true; | kbValue.data.simple.hasValue=true; |
kbValue.data.simple.val.r64=keyValue->simple.val.r64; | kbValue.data.simple.val.r64=keyValue->simple.val.r64; |
return SCMO_OK; |
|
break; | break; |
} | } |
default: | default: |
{ | { |
return SCMO_TYPE_MISSMATCH; | return SCMO_TYPE_MISSMATCH; |
break; |
|
} | } |
} | } |
|
return SCMO_OK; |
} | } |
else | else |
{ | { |
|
|
kbValue.isSet=true; | kbValue.isSet=true; |
_setSCMBUnion(keyValue,classType,false, 0,kbValue.data); | _setSCMBUnion(keyValue,classType,false, 0,kbValue.data); |
return SCMO_OK; | return SCMO_OK; |
break; |
|
} | } |
default: | default: |
{ | { |
return SCMO_TYPE_MISSMATCH; | return SCMO_TYPE_MISSMATCH; |
break; |
|
} | } |
} | } |
} | } |
|
|
| |
} | } |
| |
static int _indexComp(const void* left, const void* right) |
// class SCMODump only in debug builds available |
{ |
#ifdef PEGASUS_DEBUG |
return((*(Uint32 *)left)-(*(Uint32 *)right)); |
|
} |
|
|
|
void SCMOInstance::setPropertyFilter(const char **propertyList) |
|
{ |
|
SCMO_RC rc; |
|
Uint32 node,i = 0; |
|
|
|
_copyOnWrite(); |
|
|
|
if (inst.hdr->propertyFilter.start == 0) |
|
{ |
|
// Allocate the SCMBPropertyFilter |
|
_getFreeSpace( |
|
inst.hdr->propertyFilter, |
|
sizeof(Uint64)*(((inst.hdr->numberProperties-1)/64)+1), |
|
&inst.mem); |
|
|
|
// Allocate the SCMBPropertyFilterIndexMap |
|
_getFreeSpace( |
|
inst.hdr->propertyFilterIndexMap, |
|
sizeof(Uint32)*inst.hdr->numberProperties, |
|
&inst.mem); |
|
} |
|
// Get absolut pointer to property filter index map of the instance |
|
Uint32* propertyFilterIndexMap = |
|
(Uint32*)&(inst.base[inst.hdr->propertyFilterIndexMap.start]); |
|
|
|
// All properties are accepted |
|
if (propertyList == 0) |
|
{ |
|
// Clear filtering: |
|
// Switch filtering off. |
|
inst.hdr->flags.isFiltered = false; |
|
|
|
// Clear filter index map |
|
memset( |
|
propertyFilterIndexMap, |
|
0, |
|
sizeof(Uint32)*inst.hdr->numberProperties); |
|
|
|
//reset number filter properties to all |
|
inst.hdr->filterProperties = inst.hdr->numberProperties; |
|
|
|
return; |
|
} |
|
|
|
// Switch filtering on. |
|
inst.hdr->flags.isFiltered = true; |
|
|
|
// intit the filter with the key properties |
|
inst.hdr->filterProperties=_initPropFilterWithKeys(); |
|
|
|
// add the properties to the filter. |
|
while (propertyList[i] != 0) |
|
{ |
|
// the hash index of the property if the property name is found |
|
rc = inst.hdr->theClass.ptr->_getProperyNodeIndex(node,propertyList[i]); |
|
|
|
// if property is already in the filter |
|
// ( eg. key properties ) do not add them ! |
|
if (rc == SCMO_OK && !_isPropertyInFilter(node)) |
|
{ |
|
// The property name was found. Otherwise ignore this property name. |
|
// insert the hash index into the filter index map |
|
propertyFilterIndexMap[inst.hdr->filterProperties]=node; |
|
// increase number of properties in filter. |
|
inst.hdr->filterProperties++; |
|
// set bit in the property filter |
|
_setPropertyInPropertyFilter(node); |
|
} |
|
// Proceed with the next property name. |
|
i++; |
|
} |
|
|
|
// sort the filter index to be in order as properties stored in the class. |
|
qsort( |
|
propertyFilterIndexMap, |
|
inst.hdr->filterProperties, |
|
sizeof(Uint32), |
|
_indexComp); |
|
} |
|
|
|
Uint32 SCMOInstance::_initPropFilterWithKeys() |
|
{ |
|
|
|
// Get absolut pointer to the key property mask of the class. |
|
Uint64 idx = inst.hdr->theClass.ptr->cls.hdr->keyPropertyMask.start; |
|
Uint64* keyMask =(Uint64*)&(inst.hdr->theClass.ptr->cls.base)[idx]; |
|
|
|
// Get absolut pointer to property filter mask |
|
Uint64* propertyFilterMask = |
|
(Uint64*)&(inst.base[inst.hdr->propertyFilter.start]); |
|
|
|
// copy the key mask to the property filter mask |
|
memcpy( |
|
propertyFilterMask, |
|
keyMask, |
|
sizeof(Uint64)*(((inst.hdr->numberProperties-1)/64)+1)); |
|
|
|
// Get absolut pointer to key index list of the class |
|
idx=inst.hdr->theClass.ptr->cls.hdr->keyIndexList.start; |
|
Uint32* keyIndex = (Uint32*)&(inst.hdr->theClass.ptr->cls.base)[idx]; |
|
|
|
// Get absolut pointer to property filter index map of the instance |
|
Uint32* propertyFilterIndexMap = |
|
(Uint32*)&(inst.base[inst.hdr->propertyFilterIndexMap.start]); |
|
|
|
Uint32 noKeys = inst.hdr->theClass.ptr->cls.hdr->keyBindingSet.number; |
|
memcpy(propertyFilterIndexMap,keyIndex,sizeof(Uint32)*noKeys); |
|
|
|
// return the number of properties already in the filter index map |
|
return noKeys; |
|
|
|
} |
|
|
|
void SCMOInstance::_clearPropertyFilter() |
|
{ |
|
Uint64 *propertyFilter; |
|
|
|
// Calculate the real pointer to the Uint64 array |
|
propertyFilter = (Uint64*)&(inst.base[inst.hdr->propertyFilter.start]); |
|
|
|
// the number of Uint64 in the key mask is : |
|
// Decrease the number of properties by 1 |
|
// since the array is starting at index 0! |
|
// Divide with the number of bits in a Uint64. |
|
// e.g. number of Properties = 68 |
|
// (68 - 1) / 64 = 1 --> The mask consists of 2 Uint64 |
|
|
|
memset(propertyFilter, |
|
0, |
|
sizeof(Uint64)*(((inst.hdr->numberProperties-1)/64)+1)); |
|
|
|
} |
|
void SCMOInstance::_setPropertyInPropertyFilter(Uint32 i) |
|
{ |
|
Uint64 *propertyFilter; |
|
|
|
// In which Uint64 of key mask is the bit for property i ? |
|
// Divide with the number of bits in a Uint64. |
|
// 47 / 64 = 0 --> The key bit for property i is in in keyMask[0]. |
|
Uint32 idx = i/64 ; |
|
|
|
// Create a filter to set the bit. |
|
// Modulo division with 64. Shift left a bit by the remainder. |
|
Uint64 filter = ( (Uint64)1 << (i%64)); |
|
|
|
// Calculate the real pointer to the Uint64 array |
|
propertyFilter = (Uint64*)&(inst.base[inst.hdr->propertyFilter.start]); |
|
|
|
propertyFilter[idx] = propertyFilter[idx] | filter ; |
|
} |
|
|
|
Boolean SCMOInstance::_isPropertyInFilter(Uint32 i) const |
|
{ |
|
Uint64 *propertyFilter; |
|
|
|
// In which Uint64 of key mask is the bit for property i ? |
|
// Divide with the number of bits in a Uint64. |
|
// e.g. number of Properties = 68 |
|
// 47 / 64 = 0 --> The key bit for property i is in in keyMask[0]. |
|
Uint32 idx = i/64 ; |
|
|
|
// Create a filter to check if the bit is set: |
|
// Modulo division with 64. Shift left a bit by the remainder. |
|
Uint64 filter = ( (Uint64)1 << (i%64)); |
|
|
|
// Calculate the real pointer to the Uint64 array |
|
propertyFilter = (Uint64*)&(inst.base[inst.hdr->propertyFilter.start]); |
|
|
|
// If the bit is set the property is NOT filtered. |
|
// So the result has to be negated! |
|
return propertyFilter[idx] & filter ; |
|
|
|
} |
|
|
|
/****************************************************************************** | /****************************************************************************** |
* SCMODump Print and Dump functions | * SCMODump Print and Dump functions |
*****************************************************************************/ | *****************************************************************************/ |
|
|
(insthdr->flags.includeQualifiers ? "True" : "False")); | (insthdr->flags.includeQualifiers ? "True" : "False")); |
fprintf(_out,"\n includeClassOrigin: %s", | fprintf(_out,"\n includeClassOrigin: %s", |
(insthdr->flags.includeClassOrigin ? "True" : "False")); | (insthdr->flags.includeClassOrigin ? "True" : "False")); |
fprintf(_out,"\n isFiltered: %s", |
|
(insthdr->flags.isFiltered ? "True" : "False")); |
|
fprintf(_out,"\n isClassOnly: %s", | fprintf(_out,"\n isClassOnly: %s", |
(insthdr->flags.isClassOnly ? "True" : "False")); | (insthdr->flags.isClassOnly ? "True" : "False")); |
fprintf(_out,"\n isCompromised: %s", | fprintf(_out,"\n isCompromised: %s", |
|
|
| |
dumpSCMOInstanceKeyBindings(testInst); | dumpSCMOInstanceKeyBindings(testInst); |
| |
dumpSCMOInstancePropertyFilter(testInst); |
|
|
|
dumpInstanceProperties(testInst); | dumpInstanceProperties(testInst); |
fprintf(_out,"\n\n"); | fprintf(_out,"\n\n"); |
| |
} | } |
| |
void SCMODump::dumpSCMOInstancePropertyFilter(SCMOInstance& testInst) const |
|
{ |
|
SCMBInstance_Main* insthdr = testInst.inst.hdr; |
|
char* instbase = testInst.inst.base; |
|
|
|
if (!insthdr->flags.isFiltered) |
|
{ |
|
fprintf(_out,"\n\nNo propterty filter!\n\n"); |
|
return; |
|
} |
|
|
|
fprintf(_out,"\n\nInstance Property Filter :"); |
|
fprintf(_out,"\n=========================="); |
|
fprintf(_out,"\n\nNumber of properties in the filter : %u\n" |
|
,insthdr->filterProperties); |
|
|
|
dumpPropertyFilter(testInst); |
|
|
|
dumpPropertyFilterIndexMap(testInst); |
|
|
|
} |
|
|
|
void SCMODump::dumpInstanceProperties( | void SCMODump::dumpInstanceProperties( |
SCMOInstance& testInst, | SCMOInstance& testInst, |
Boolean verbose) const | Boolean verbose) const |
|
|
{ | { |
fprintf(_out,"\n\nInstance property (#%3u) %s\n",i, | fprintf(_out,"\n\nInstance property (#%3u) %s\n",i, |
NULLSTR(insthdr->theClass.ptr->_getPropertyNameAtNode(i))); | NULLSTR(insthdr->theClass.ptr->_getPropertyNameAtNode(i))); |
if(insthdr->flags.isFiltered && !testInst._isPropertyInFilter(i)) |
|
{ |
|
fprintf(_out,"\nProperty is filtered out!"); |
|
} |
|
else |
|
{ |
|
printSCMOValue(val[i],instbase,verbose); |
|
} |
|
} |
|
|
|
} |
|
|
|
void SCMODump::dumpPropertyFilterIndexMap(SCMOInstance& testInst) const |
|
{ |
|
|
|
SCMBInstance_Main* insthdr = testInst.inst.hdr; |
|
char* instbase = testInst.inst.base; |
|
|
|
if (!insthdr->flags.isFiltered) |
|
{ |
|
fprintf(_out,"\n\nNo propterty filter!\n\n"); |
|
return; |
|
} |
|
|
|
fprintf(_out,"\n\nProperty Filter Index Max:"); |
|
fprintf(_out,"\n==========================\n"); |
|
|
|
// Get absolut pointer to key index list of the class |
|
Uint32* keyIndex = |
|
(Uint32*)&(instbase)[insthdr->propertyFilterIndexMap.start]; |
|
|
|
Uint32 line,j,i,k = insthdr->filterProperties; |
|
|
|
for (j = 0; j < k; j = j + line) |
|
{ |
|
if ((insthdr->filterProperties-j)/16) |
|
{ |
|
line = 16 ; |
|
} |
|
else |
|
{ |
|
line = insthdr->filterProperties%16; |
|
} |
|
|
|
|
|
fprintf(_out,"Index :"); |
|
for (i = 0; i < line; i++) |
|
{ |
|
fprintf(_out," %3u",j+i); |
|
} |
|
|
|
fprintf(_out,"\nNode :"); |
|
for (i = 0; i < line; i++) |
|
{ |
|
fprintf(_out," %3u",keyIndex[j+i]); |
|
} |
|
|
|
fprintf(_out,"\n\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
void SCMODump::dumpPropertyFilter(SCMOInstance& testInst) const |
|
{ |
|
|
|
SCMBInstance_Main* insthdr = testInst.inst.hdr; |
|
char* instbase = testInst.inst.base; |
|
|
|
if (!insthdr->flags.isFiltered) |
|
{ |
|
fprintf(_out,"\n\nNo propterty filter!"); |
|
return; |
|
} |
|
| |
Uint64 *thePropertyFilter = |
printSCMOValue(val[i],instbase,verbose); |
(Uint64*)&(instbase[insthdr->propertyFilter.start]); |
|
Uint32 end, noProperties = insthdr->numberProperties; |
|
Uint32 noMasks = (noProperties-1)/64; |
|
Uint64 printMask = 1; |
|
|
|
for (Uint32 i = 0; i <= noMasks; i++ ) |
|
{ |
|
printMask = 1; |
|
if (i < noMasks) |
|
{ |
|
end = 64; |
|
} |
|
else |
|
{ |
|
end = noProperties%64; |
|
} |
|
|
|
fprintf(_out,"\npropertyFilter[%02u]= ",i); |
|
|
|
for (Uint32 j = 0; j < end; j++) |
|
{ |
|
if (j > 0 && !(j%8)) |
|
{ |
|
fprintf(_out," "); |
|
} | } |
| |
if (thePropertyFilter[i] & printMask) |
|
{ |
|
fprintf(_out,"1"); |
|
} |
|
else |
|
{ |
|
fprintf(_out,"0"); |
|
} | } |
| |
printMask = printMask << 1; |
|
} |
|
fprintf(_out,"\n"); |
|
} |
|
} |
|
| |
void SCMODump::dumpSCMOInstanceKeyBindings( | void SCMODump::dumpSCMOInstanceKeyBindings( |
SCMOInstance& testInst, | SCMOInstance& testInst, |
|
|
} | } |
else | else |
{ | { |
line = clshdr->propertySet.number%16; |
line = clshdr->propertySet.number & 15; |
} | } |
| |
| |
|
|
void SCMODump::dumpKeyBindingSet(SCMOClass& testCls) const | void SCMODump::dumpKeyBindingSet(SCMOClass& testCls) const |
{ | { |
SCMBClass_Main* clshdr = testCls.cls.hdr; | SCMBClass_Main* clshdr = testCls.cls.hdr; |
char* clsbase = testCls.cls.base; |
|
| |
fprintf(_out,"\n\nKey Binding Set:"); | fprintf(_out,"\n\nKey Binding Set:"); |
fprintf(_out,"\n=================\n"); | fprintf(_out,"\n=================\n"); |
|
|
| |
fprintf(_out,"\nHash Tag %3u Hash Index %3u", | fprintf(_out,"\nHash Tag %3u Hash Index %3u", |
nodeArray[i].nameHashTag, | nodeArray[i].nameHashTag, |
nodeArray[i].nameHashTag%PEGASUS_KEYBINDIG_SCMB_HASHSIZE); |
nodeArray[i].nameHashTag & (PEGASUS_KEYBINDIG_SCMB_HASHSIZE -1)); |
| |
fprintf(_out,"\nType: %s",cimTypeToString(nodeArray[i].type)); | fprintf(_out,"\nType: %s",cimTypeToString(nodeArray[i].type)); |
| |
|
|
void SCMODump::dumpClassProperties(SCMOClass& testCls) const | void SCMODump::dumpClassProperties(SCMOClass& testCls) const |
{ | { |
SCMBClass_Main* clshdr = testCls.cls.hdr; | SCMBClass_Main* clshdr = testCls.cls.hdr; |
char* clsbase = testCls.cls.base; |
|
| |
fprintf(_out,"\n\nClass Properties:"); | fprintf(_out,"\n\nClass Properties:"); |
fprintf(_out,"\n=================\n"); | fprintf(_out,"\n=================\n"); |
|
|
| |
fprintf(_out,"\nHash Tag %3u Hash Index %3u", | fprintf(_out,"\nHash Tag %3u Hash Index %3u", |
prop.nameHashTag, | prop.nameHashTag, |
prop.nameHashTag%PEGASUS_PROPERTY_SCMB_HASHSIZE); |
prop.nameHashTag & (PEGASUS_PROPERTY_SCMB_HASHSIZE -1)); |
fprintf(_out,"\nPropagated: %s isKey: %s", | fprintf(_out,"\nPropagated: %s isKey: %s", |
(prop.flags.propagated?"TRUE":"FALSE"), | (prop.flags.propagated?"TRUE":"FALSE"), |
(prop.flags.isKey?"TRUE":"FALSE") | (prop.flags.isKey?"TRUE":"FALSE") |
|
|
} | } |
else | else |
{ | { |
line = size%16; |
line = size & 15; |
} | } |
| |
| |
|
|
} | } |
else | else |
{ | { |
end = noProperties%64; |
end = noProperties & 63; |
} | } |
| |
fprintf(_out,"\nkeyPropertyMask[%02u]= ",i); | fprintf(_out,"\nkeyPropertyMask[%02u]= ",i); |
| |
for (Uint32 j = 0; j < end; j++) | for (Uint32 j = 0; j < end; j++) |
{ | { |
if (j > 0 && !(j%8)) |
if (j > 0 && !(j & 7)) |
{ | { |
fprintf(_out," "); | fprintf(_out," "); |
} | } |
|
|
} | } |
| |
printLine[1][p] = item/16; | printLine[1][p] = item/16; |
printLine[2][p] = item%16; |
printLine[2][p] = item & 15; |
| |
} | } |
} | } |
|
|
| |
return; | return; |
} | } |
|
#endif // PEGASUS_DEBUG (class SCMODump only in debug builds available) |
| |
| |
/***************************************************************************** | /***************************************************************************** |
|
|
// Init memory from unaligned start up to the size required with alignment | // Init memory from unaligned start up to the size required with alignment |
// to zero. | // to zero. |
memset(&((char*)(*pmem))[start],0,(size_t)reqAlignSize); | memset(&((char*)(*pmem))[start],0,(size_t)reqAlignSize); |
|
PEGASUS_DEBUG_ASSERT( |
|
((*pmem)->freeBytes+(*pmem)->startOfFreeSpace) == (*pmem)->totalSize); |
| |
return alignedStart; | return alignedStart; |
} | } |