(file) Return to SCMO.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/SCMO.cpp between version 1.2.2.72 and 1.24

version 1.2.2.72, 2009/11/16 17:07:31 version 1.24, 2013/02/13 11:39:58
Line 27 
Line 27 
 // //
 ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
 // //
   // 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>
Line 42 
Line 47 
 #include <Pegasus/Common/CIMNameCast.h> #include <Pegasus/Common/CIMNameCast.h>
 #include <Pegasus/Common/CommonUTF.h> #include <Pegasus/Common/CommonUTF.h>
 #include <Pegasus/Common/StrLit.h> #include <Pegasus/Common/StrLit.h>
   #include <Pegasus/Common/Tracer.h>
 #include <Pegasus/Common/XmlWriter.h> #include <Pegasus/Common/XmlWriter.h>
 #include <Pegasus/Common/System.h> #include <Pegasus/Common/System.h>
 #include <Pegasus/Common/FileSystem.h> #include <Pegasus/Common/FileSystem.h>
Line 60 
Line 66 
   #include <Pegasus/General/SetFileDescriptorToEBCDICEncoding.h>   #include <Pegasus/General/SetFileDescriptorToEBCDICEncoding.h>
 #endif #endif
  
 #ifdef PEGASUS_STRING_ENABLE_ICU  #ifdef PEGASUS_HAS_ICU
 # include <unicode/platform.h> # include <unicode/platform.h>
 # include <unicode/urename.h> # include <unicode/urename.h>
 # include <unicode/ures.h> # include <unicode/ures.h>
Line 82 
Line 88 
  */  */
 #define NULLSTR(x) ((x) == 0 ? "" : (x)) #define NULLSTR(x) ((x) == 0 ? "" : (x))
  
 #define NEWCIMSTR(ptr,base) \  
       ((ptr).size == 0 ?  \  
       (String()) :           \  
       (String(&(base)[(ptr).start],((ptr).size)-1)))  
   
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 #define PEGASUS_ARRAY_T SCMOInstance #define PEGASUS_ARRAY_T SCMOInstance
 # include "ArrayImpl.h" # include "ArrayImpl.h"
 #undef PEGASUS_ARRAY_T #undef PEGASUS_ARRAY_T
  
   
 const StrLit SCMOClass::_qualifierNameStrLit[72] = const StrLit SCMOClass::_qualifierNameStrLit[72] =
 { {
     STRLIT(""),     STRLIT(""),
Line 173 
Line 173 
 #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.
  *****************************************************************************/  *****************************************************************************/
  
   inline String _newCimString(const SCMBDataPtr & ptr, const char * base)
   {
       if (ptr.size > 0)
       {
           return String(&(base[ptr.start]),ptr.size-1);
       }
       else
       {
           return String();
       }
   }
   
 inline void _deleteArrayExtReference( inline void _deleteArrayExtReference(
     SCMBDataPtr& theArray,     SCMBDataPtr& theArray,
     SCMBMgmt_Header** pmem )     SCMBMgmt_Header** pmem )
Line 197 
Line 232 
     }     }
 } }
  
   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
  *****************************************************************************/  *****************************************************************************/
Line 324 
Line 391 
     return _getCharString(cls.hdr->superClassName,cls.base);     return _getCharString(cls.hdr->superClassName,cls.base);
 } }
  
 const char* SCMOClass::getSuperClassName_l(Uint64 & length) const  const char* SCMOClass::getSuperClassName_l(Uint32 & length) const
 { {
     length = cls.hdr->superClassName.size;     length = cls.hdr->superClassName.size;
     if (0 == length)     if (0 == length)
Line 341 
Line 408 
 void  SCMOClass::getCIMClass(CIMClass& cimClass) const void  SCMOClass::getCIMClass(CIMClass& cimClass) const
 { {
     CIMClass newCimClass(     CIMClass newCimClass(
         CIMNameCast(NEWCIMSTR(cls.hdr->className,cls.base)),          CIMNameCast(_newCimString(cls.hdr->className,cls.base)),
         CIMNameCast(NEWCIMSTR(cls.hdr->superClassName,cls.base)));          CIMNameCast(_newCimString(cls.hdr->superClassName,cls.base)));
  
     // set the name space     // set the name space
     newCimClass._rep->_reference._rep->_nameSpace=     newCimClass._rep->_reference._rep->_nameSpace=
         CIMNamespaceNameCast(NEWCIMSTR(cls.hdr->nameSpace,cls.base));          CIMNamespaceNameCast(_newCimString(cls.hdr->nameSpace,cls.base));
  
     // Add class qualifier if exist     // Add class qualifier if exist
     if (0 != cls.hdr->numberOfQualifiers)     if (0 != cls.hdr->numberOfQualifiers)
Line 402 
Line 469 
     if (0 != clsProp.theProperty.originClassName.start)     if (0 != clsProp.theProperty.originClassName.start)
     {     {
         retCimProperty = CIMProperty(         retCimProperty = CIMProperty(
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.name,cls.base)),              CIMNameCast(_newCimString(clsProp.theProperty.name,cls.base)),
             theCimValue,             theCimValue,
             theCimValue.getArraySize(),             theCimValue.getArraySize(),
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.refClassName,cls.base)),              CIMNameCast(
             CIMNameCast(NEWCIMSTR(                  _newCimString(clsProp.theProperty.refClassName,cls.base)),
                 clsProp.theProperty.originClassName,cls.base)),              CIMNameCast(
                   _newCimString(clsProp.theProperty.originClassName,cls.base)),
             clsProp.theProperty.flags.propagated);             clsProp.theProperty.flags.propagated);
     }     }
     else     else
     {     {
          retCimProperty = CIMProperty(          retCimProperty = CIMProperty(
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.name,cls.base)),              CIMNameCast(_newCimString(clsProp.theProperty.name,cls.base)),
             theCimValue,             theCimValue,
             theCimValue.getArraySize(),             theCimValue.getArraySize(),
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.refClassName,cls.base)),              CIMNameCast(
                   _newCimString(clsProp.theProperty.refClassName,cls.base)),
             CIMName(),             CIMName(),
             clsProp.theProperty.flags.propagated);             clsProp.theProperty.flags.propagated);
     }     }
Line 458 
Line 527 
  
     if (scmbQualifier.name == QUALNAME_USERDEFINED)     if (scmbQualifier.name == QUALNAME_USERDEFINED)
     {     {
         theCimQualiName = NEWCIMSTR(scmbQualifier.userDefName,base);          theCimQualiName = _newCimString(scmbQualifier.userDefName,base);
     }     }
     else     else
     {     {
Line 484 
Line 553 
     for (Uint32 i = 0, k = cls.hdr->keyBindingSet.number; i < k; i++)     for (Uint32 i = 0, k = cls.hdr->keyBindingSet.number; i < k; i++)
     {     {
         // Append the key property name.         // Append the key property name.
         keyNames.append(NEWCIMSTR(nodeArray[i].name,cls.base));          keyNames.append(_newCimString(nodeArray[i].name,cls.base));
     }     }
 } }
  
Line 506 
Line 575 
     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)
     {     {
Line 561 
Line 630 
     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)
     {     {
Line 604 
Line 673 
     } while ( true );     } while ( true );
  
     // this should never be reached     // this should never be reached
     return SCMO_NOT_FOUND;      PEGASUS_UNREACHABLE(return SCMO_NOT_FOUND;)
   
 } }
  
 void SCMOClass::_setClassProperties(PropertySet& theCIMProperties) void SCMOClass::_setClassProperties(PropertySet& theCIMProperties)
Line 729 
Line 797 
     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)
Line 780 
Line 849 
     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)
Line 824 
Line 893 
     const CIMProperty& theCIMProperty)     const CIMProperty& theCIMProperty)
 { {
     CIMPropertyRep* propRep = theCIMProperty._rep;     CIMPropertyRep* propRep = theCIMProperty._rep;
     Uint64 valueStart;  
  
     // First do all _setString(). Can cause reallocation.     // First do all _setString(). Can cause reallocation.
     _setString(propRep->_name.getString(),     _setString(propRep->_name.getString(),
Line 854 
Line 922 
  
     // 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]);
Line 874 
Line 942 
  
     // 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]);
Line 1193 
Line 1261 
 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));
Line 1202 
Line 1269 
     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)
Line 1231 
Line 1296 
 SCMOInstance::SCMOInstance( SCMOInstance::SCMOInstance(
     const CIMInstance& cimInstance,     const CIMInstance& cimInstance,
     const char* altNameSpace,     const char* altNameSpace,
     Uint64 altNSLen)      Uint32 altNSLen)
 { {
     SCMOClass theSCMOClass = _getSCMOClass(     SCMOClass theSCMOClass = _getSCMOClass(
         cimInstance._rep->_reference,         cimInstance._rep->_reference,
Line 1254 
Line 1319 
 SCMOInstance::SCMOInstance( SCMOInstance::SCMOInstance(
     const CIMObject& cimObject,     const CIMObject& cimObject,
     const char* altNameSpace,     const char* altNameSpace,
     Uint64 altNSLen)      Uint32 altNSLen)
 { {
     if (cimObject.isClass())     if (cimObject.isClass())
     {     {
Line 1290 
Line 1355 
 SCMOInstance::SCMOInstance( SCMOInstance::SCMOInstance(
     const CIMObjectPath& cimObj,     const CIMObjectPath& cimObj,
     const char* altNameSpace,     const char* altNameSpace,
     Uint64 altNSLen)      Uint32 altNSLen)
 { {
     SCMOClass theSCMOClass = _getSCMOClass(     SCMOClass theSCMOClass = _getSCMOClass(
         cimObj,         cimObj,
Line 1318 
Line 1383 
 SCMOClass SCMOInstance::_getSCMOClass( SCMOClass SCMOInstance::_getSCMOClass(
     const CIMObjectPath& theCIMObj,     const CIMObjectPath& theCIMObj,
     const char* altNS,     const char* altNS,
     Uint64 altNSlength)      Uint32 altNSlength)
 { {
     SCMOClass theClass;     SCMOClass theClass;
  
Line 1463 
Line 1528 
 void SCMOInstance::_destroyExternalKeyBindings() void SCMOInstance::_destroyExternalKeyBindings()
 { {
     // 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->cls.hdr->keyBindingSet.nodeArray.start;      Uint64 idx = inst.hdr->theClass.ptr->cls.hdr->keyBindingSet.nodeArray.start;
     SCMBKeyBindingNode* theClassKeyBindNodeArray =     SCMBKeyBindingNode* theClassKeyBindNodeArray =
         (SCMBKeyBindingNode*)&((inst.hdr->theClass->cls.base)[idx]);          (SCMBKeyBindingNode*)&((inst.hdr->theClass.ptr->cls.base)[idx]);
  
     // create a pointer to instanc key binding array.     // create a pointer to instanc key binding array.
     SCMBKeyBindingValue* theInstanceKeyBindingNodeArray =     SCMBKeyBindingValue* theInstanceKeyBindingNodeArray =
Line 1478 
Line 1543 
             // 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
Line 1497 
Line 1564 
                 // 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);
                 }                 }
             }             }
  
Line 1512 
Line 1581 
 { {
  
     SCMO_RC rc = SCMO_OK;     SCMO_RC rc = SCMO_OK;
     Uint32 noProps;  
     CIMObjectPath objPath;     CIMObjectPath objPath;
  
     // For better usability define pointers to SCMO Class data structures.     // For better usability define pointers to SCMO Class data structures.
     SCMBClass_Main* clshdr = inst.hdr->theClass->cls.hdr;      SCMBClass_Main* clshdr = inst.hdr->theClass.ptr->cls.hdr;
     char* clsbase = inst.hdr->theClass->cls.base;      char* clsbase = inst.hdr->theClass.ptr->cls.base;
  
     getCIMObjectPath(objPath);     getCIMObjectPath(objPath);
  
Line 1544 
Line 1612 
         }         }
     }     }
  
     if (inst.hdr->flags.isFiltered)      if (inst.hdr->flags.exportSetOnly)
     {  
         // 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  
     {     {
         for(Uint32 i = 0, k = inst.hdr->numberProperties; i<k; i++)         for(Uint32 i = 0, k = inst.hdr->numberProperties; i<k; i++)
         {         {
Line 1577 
Line 1628 
                 newInstance._rep->_properties.append(theProperty);                 newInstance._rep->_properties.append(theProperty);
             }             }
         }         }
       }
       else
       {
           for(Uint32 i = 0, k = inst.hdr->numberProperties; i<k; i++)
           {
               // Set all properties in the CIMInstance gegarding they
               // are part of the SCMOInstance or the SCMOClass.
               CIMProperty theProperty=_getCIMPropertyAtNodeIndex(i);
  
               newInstance._rep->_properties.append(theProperty);
           }
     }     }
  
     cimInstance = newInstance;     cimInstance = newInstance;
Line 1587 
Line 1648 
  
 void SCMOInstance::getCIMObjectPath(CIMObjectPath& cimObj) const void SCMOInstance::getCIMObjectPath(CIMObjectPath& cimObj) const
 { {
       Array<CIMKeyBinding> keys;
     CIMObjectPath newObjectPath;  
  
     // For better usability define pointers to SCMO Class data structures.     // For better usability define pointers to SCMO Class data structures.
     SCMBClass_Main* clshdr = inst.hdr->theClass->cls.hdr;      SCMBClass_Main* clshdr = inst.hdr->theClass.ptr->cls.hdr;
     char* clsbase = inst.hdr->theClass->cls.base;      char* clsbase = inst.hdr->theClass.ptr->cls.base;
  
     // Address the class keybinding information     // Address the class keybinding information
     SCMBKeyBindingNode* scmoClassArray =     SCMBKeyBindingNode* scmoClassArray =
Line 1618 
Line 1678 
                 0,                 0,
                 scmoInstArray[i].data,                 scmoInstArray[i].data,
                 inst.base);                 inst.base);
             newObjectPath._rep->_keyBindings.append(              keys.append(
                 CIMKeyBinding(                 CIMKeyBinding(
                     CIMNameCast(NEWCIMSTR(scmoClassArray[i].name,clsbase)),                      CIMNameCast(_newCimString(scmoClassArray[i].name,clsbase)),
                     theKeyBindingValue                     theKeyBindingValue
                     ));                     ));
         }         }
Line 1646 
Line 1706 
                     theUserDefKBElement->value.data,                     theUserDefKBElement->value.data,
                     inst.base);                     inst.base);
  
                 newObjectPath._rep->_keyBindings.append(                  keys.append(
                     CIMKeyBinding(                     CIMKeyBinding(
                         CIMNameCast(                         CIMNameCast(
                             NEWCIMSTR(theUserDefKBElement->name,inst.base)),                              _newCimString(theUserDefKBElement->name,inst.base)),
                     theKeyBindingValue));                     theKeyBindingValue));
             }             }
             theUserDefKBElement =             theUserDefKBElement =
Line 1658 
Line 1718 
         } // for all user def. key bindings.         } // for all user def. key bindings.
     }     }
  
     newObjectPath._rep->_host = NEWCIMSTR(inst.hdr->hostName,inst.base);      String host = _newCimString(inst.hdr->hostName,inst.base);
   
     // Use name space and class name of the instance     // Use name space and class name of the instance
     newObjectPath._rep->_nameSpace =      CIMNamespaceName nameSpace =
         CIMNamespaceNameCast(NEWCIMSTR(inst.hdr->instNameSpace,inst.base));          CIMNamespaceNameCast(_newCimString(inst.hdr->instNameSpace,inst.base));
     newObjectPath._rep->_className=  
         CIMNameCast(NEWCIMSTR(inst.hdr->instClassName,inst.base));  
  
     cimObj = newObjectPath;      CIMName className =
           CIMNameCast(_newCimString(inst.hdr->instClassName,inst.base));
   
       cimObj.set(host,nameSpace,className,keys);
 } }
  
 CIMProperty SCMOInstance::_getCIMPropertyAtNodeIndex(Uint32 nodeIdx) const CIMProperty SCMOInstance::_getCIMPropertyAtNodeIndex(Uint32 nodeIdx) const
Line 1674 
Line 1736 
     CIMProperty retProperty;     CIMProperty retProperty;
  
     // For better usability define pointers to SCMO Class data structures.     // For better usability define pointers to SCMO Class data structures.
     SCMBClass_Main* clshdr = inst.hdr->theClass->cls.hdr;      SCMBClass_Main* clshdr = inst.hdr->theClass.ptr->cls.hdr;
     char* clsbase = inst.hdr->theClass->cls.base;      char* clsbase = inst.hdr->theClass.ptr->cls.base;
  
  
     SCMBClassPropertyNode& clsProp =     SCMBClassPropertyNode& clsProp =
Line 1702 
Line 1764 
     if (inst.hdr->flags.includeClassOrigin)     if (inst.hdr->flags.includeClassOrigin)
     {     {
         retProperty = CIMProperty(         retProperty = CIMProperty(
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.name,clsbase)),              CIMNameCast(_newCimString(clsProp.theProperty.name,clsbase)),
             theValue,             theValue,
             theValue.getArraySize(),             theValue.getArraySize(),
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.refClassName,clsbase)),              CIMNameCast(
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.originClassName,clsbase)),                  _newCimString(clsProp.theProperty.refClassName,clsbase)),
               CIMNameCast(
                   _newCimString(clsProp.theProperty.originClassName,clsbase)),
             clsProp.theProperty.flags.propagated);             clsProp.theProperty.flags.propagated);
     }     }
     else     else
     {     {
          retProperty = CIMProperty(          retProperty = CIMProperty(
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.name,clsbase)),              CIMNameCast(_newCimString(clsProp.theProperty.name,clsbase)),
             theValue,             theValue,
             theValue.getArraySize(),             theValue.getArraySize(),
             CIMNameCast(NEWCIMSTR(clsProp.theProperty.refClassName,clsbase)),              CIMNameCast(
                   _newCimString(clsProp.theProperty.refClassName,clsbase)),
             CIMName(),             CIMName(),
             clsProp.theProperty.flags.propagated);             clsProp.theProperty.flags.propagated);
     }     }
Line 1994 
Line 2059 
  
                 for (Uint32 i = 0, k = arraySize; i < k ; i++)                 for (Uint32 i = 0, k = arraySize; i < k ; i++)
                 {                 {
                     x.append(NEWCIMSTR(pscmbArrayUn[i].stringValue,base));                      x.append(_newCimString(pscmbArrayUn[i].stringValue,base));
                 }                 }
                 cimV.set(x);                 cimV.set(x);
             }             }
             else             else
             {             {
                 cimV.set(NEWCIMSTR(scmbUn.stringValue,base));                  cimV.set(_newCimString(scmbUn.stringValue,base));
             }             }
             break;             break;
         }         }
Line 2064 
Line 2129 
         }         }
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
         {         {
             CIMInstance theInstance;              CIMInstance cimInstance;
             CIMClass theClass;              CIMClass cimClass;
  
             if(isArray)             if(isArray)
             {             {
Line 2079 
Line 2144 
                                inst.hdr->flags.isClassOnly)                                inst.hdr->flags.isClassOnly)
                         {                         {
                             pscmbArrayUn[i].extRefPtr->                             pscmbArrayUn[i].extRefPtr->
                                 inst.hdr->theClass->getCIMClass(theClass);                                  inst.hdr->theClass.ptr->getCIMClass(cimClass);
                             x.append(CIMObject(theClass));                              x.append(CIMObject(cimClass));
                         }                         }
                         else                         else
                         {                         {
                             pscmbArrayUn[i].extRefPtr->                             pscmbArrayUn[i].extRefPtr->
                                 getCIMInstance(theInstance);                                  getCIMInstance(cimInstance);
                             x.append(CIMObject(theInstance));                              x.append(CIMObject(cimInstance));
                         }                         }
                     }                     }
                     else                     else
Line 2106 
Line 2171 
                     if(scmbUn.extRefPtr->inst.hdr->flags.isClassOnly)                     if(scmbUn.extRefPtr->inst.hdr->flags.isClassOnly)
                     {                     {
                         scmbUn.extRefPtr->                         scmbUn.extRefPtr->
                             inst.hdr->theClass->getCIMClass(theClass);                              inst.hdr->theClass.ptr->getCIMClass(cimClass);
                         cimV.set(CIMObject(theClass));                          cimV.set(CIMObject(cimClass));
                     }                     }
                     else                     else
                     {                     {
                         scmbUn.extRefPtr->getCIMInstance(theInstance);                          scmbUn.extRefPtr->getCIMInstance(cimInstance);
                         cimV.set(CIMObject(theInstance));                          cimV.set(CIMObject(cimInstance));
                     }                     }
                 }                 }
                 else                 else
Line 2187 
Line 2252 
  
 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(
Line 2199 
Line 2262 
              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,
Line 2287 
Line 2350 
     _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, Uint64 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);
 } }
  
 const char* SCMOInstance::getHostName_l(Uint64& length) const  const char* SCMOInstance::getHostName_l(Uint32& length) const
 { {
     length = inst.hdr->hostName.size;     length = inst.hdr->hostName.size;
     if (0 == length)     if (0 == length)
Line 2331 
Line 2386 
     _setBinary(className,len+1,inst.hdr->instClassName,&inst.mem);     _setBinary(className,len+1,inst.hdr->instClassName,&inst.mem);
 } }
  
 void SCMOInstance::setClassName_l(const char* className, Uint64 len)  void SCMOInstance::setClassName_l(const char* className, Uint32 len)
 { {
     _copyOnWrite();     _copyOnWrite();
  
Line 2347 
Line 2402 
     return _getCharString(inst.hdr->instClassName,inst.base);     return _getCharString(inst.hdr->instClassName,inst.base);
 } }
  
 const char* SCMOInstance::getClassName_l(Uint64 & length) const  const char* SCMOInstance::getClassName_l(Uint32 & length) const
 { {
     length = inst.hdr->instClassName.size;     length = inst.hdr->instClassName.size;
     if (0 == length)     if (0 == length)
Line 2379 
Line 2434 
     _setBinary(nameSpace,len+1,inst.hdr->instNameSpace,&inst.mem);     _setBinary(nameSpace,len+1,inst.hdr->instNameSpace,&inst.mem);
 } }
  
 void SCMOInstance::setNameSpace_l(const char* nameSpace, Uint64 len)  void SCMOInstance::setNameSpace_l(const char* nameSpace, Uint32 len)
   {
       // Copy on Write is only necessary if a realloc() becomes necessary
       if (inst.mem->freeBytes < ((len+8) & ~7))
 { {
     _copyOnWrite();     _copyOnWrite();
       }
     // flag the instance as compromized     // flag the instance as compromized
     inst.hdr->flags.isCompromised=true;     inst.hdr->flags.isCompromised=true;
     // copy including trailing '\0'     // copy including trailing '\0'
Line 2394 
Line 2452 
     return _getCharString(inst.hdr->instNameSpace,inst.base);     return _getCharString(inst.hdr->instNameSpace,inst.base);
 } }
  
 const char* SCMOInstance::getNameSpace_l(Uint64 & length) const  const char* SCMOInstance::getNameSpace_l(Uint32 & length) const
 { {
     length = inst.hdr->instNameSpace.size;     length = inst.hdr->instNameSpace.size;
     if (0 == length)     if (0 == length)
Line 2408 
Line 2466 
     return _getCharString(inst.hdr->instNameSpace,inst.base);     return _getCharString(inst.hdr->instNameSpace,inst.base);
 } }
  
 void SCMOInstance::buildKeyBindingsFromProperties()  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])
 { {
     Uint32* theClassKeyPropList =          // Copy on Write is only necessary if a realloc() becomes necessary
         (Uint32*) &((inst.hdr->theClass->cls.base)          if (inst.mem->freeBytes < ((hnLen+8) & ~7))
                           [(inst.hdr->theClass->cls.hdr->keyIndexList.start)]);          {
               _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);
       }
   }
  
     SCMBKeyBindingValue* theKeyBindValueArray;  
     SCMBValue* theInstPropNodeArray;  
  
   void SCMOInstance::buildKeyBindingsFromProperties()
   {
     Uint32 propNode;     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*) &((inst.hdr->theClass.ptr->cls.base)
                       [(inst.hdr->theClass.ptr->cls.hdr->keyIndexList.start)]);
  
     for (Uint32 i = 0, k = inst.hdr->numberKeyBindings; i < k; i++)      SCMBKeyBindingValue* theKeyBindValueArray =
     {  
         // 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]);            (SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]);
       SCMBValue* theInstPropNodeArray=
         theInstPropNodeArray =  
             (SCMBValue*)&inst.base[inst.hdr->propertyArray.start];             (SCMBValue*)&inst.base[inst.hdr->propertyArray.start];
  
       inst.hdr->numberKeyBindings =
           inst.hdr->theClass.ptr->cls.hdr->keyBindingSet.number;
   
       for (Uint32 i = 0, k = inst.hdr->numberKeyBindings; i < k; i++)
       {
         // If the keybinding is not set.         // If the keybinding is not set.
         if (!theKeyBindValueArray[i].isSet)         if (!theKeyBindValueArray[i].isSet)
         {         {
Line 2441 
Line 2524 
                 !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];
   
             }             }
         }         }
     }     }
Line 2601 
Line 2701 
     inst.hdr->refCount=1;     inst.hdr->refCount=1;
  
     //Assign the SCMBClass structure this instance based on.     //Assign the SCMBClass structure this instance based on.
     inst.hdr->theClass = pClass;      inst.hdr->theClass.ptr = pClass;
  
     // Copy name space name and class name of the class     // Copy name space name and class name of the class
     _setBinary(     _setBinary(
         _getCharString(inst.hdr->theClass->cls.hdr->className,          _getCharString(inst.hdr->theClass.ptr->cls.hdr->className,
                        inst.hdr->theClass->cls.base),                         inst.hdr->theClass.ptr->cls.base),
         inst.hdr->theClass->cls.hdr->className.size,          inst.hdr->theClass.ptr->cls.hdr->className.size,
         inst.hdr->instClassName,         inst.hdr->instClassName,
         &inst.mem);         &inst.mem);
  
     _setBinary(     _setBinary(
         _getCharString(inst.hdr->theClass->cls.hdr->nameSpace,          _getCharString(inst.hdr->theClass.ptr->cls.hdr->nameSpace,
                        inst.hdr->theClass->cls.base),                         inst.hdr->theClass.ptr->cls.base),
         inst.hdr->theClass->cls.hdr->nameSpace.size,          inst.hdr->theClass.ptr->cls.hdr->nameSpace.size,
         inst.hdr->instNameSpace,         inst.hdr->instNameSpace,
         &inst.mem);         &inst.mem);
  
     // Number of key bindings     // Number of key bindings
     inst.hdr->numberKeyBindings =     inst.hdr->numberKeyBindings =
         inst.hdr->theClass->cls.hdr->keyBindingSet.number;          inst.hdr->theClass.ptr->cls.hdr->keyBindingSet.number;
  
     // Number of properties     // Number of properties
     inst.hdr->numberProperties =     inst.hdr->numberProperties =
         inst.hdr->theClass->cls.hdr->propertySet.number;          inst.hdr->theClass.ptr->cls.hdr->propertySet.number;
  
     // Allocate the SCMOInstanceKeyBindingArray     // Allocate the SCMOInstanceKeyBindingArray
     _getFreeSpace(     _getFreeSpace(
Line 2644 
Line 2744 
 { {
     CIMPropertyRep* propRep;     CIMPropertyRep* propRep;
     Uint32 propNode;     Uint32 propNode;
     Uint64 valueStart;  
     SCMO_RC rc;     SCMO_RC rc;
     CIMType realType;     CIMType realType;
  
Line 2654 
Line 2753 
     // The instance level qualifiers are stored on the associated SCMOClass.     // The instance level qualifiers are stored on the associated SCMOClass.
     inst.hdr->flags.includeQualifiers=(instRep->_qualifiers.getCount()>0);     inst.hdr->flags.includeQualifiers=(instRep->_qualifiers.getCount()>0);
  
       // To ensure that at converting a CIMInstance to a SCMOInstance
       // and vice versa do have the same property set.
       inst.hdr->flags.exportSetOnly=true;
   
     _setCIMObjectPath(instRep->_reference);     _setCIMObjectPath(instRep->_reference);
  
     // Copy all properties     // Copy all properties
Line 2676 
Line 2779 
         }         }
  
         // get the property node index for the property         // get the property node index for the property
         rc = inst.hdr->theClass->_getProperyNodeIndex(          rc = inst.hdr->theClass.ptr->_getProperyNodeIndex(
             propNode,             propNode,
             (const char*)propRep->_name.getString().getCString());             (const char*)propRep->_name.getString().getCString());
  
         if (rc != SCMO_OK)          if (rc == SCMO_OK)
         {         {
             throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NO_SUCH_PROPERTY,  
                propRep->_name.getString());  
         }  
         // 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.
         rc = inst.hdr->theClass->_isNodeSameType(              rc = inst.hdr->theClass.ptr->_isNodeSameType(
                  propNode,                  propNode,
                  propRep->_value._rep->type,                  propRep->_value._rep->type,
                  propRep->_value._rep->isArray,                  propRep->_value._rep->isArray,
                  realType);                  realType);
         if (rc == SCMO_OK)         if (rc == SCMO_OK)
         {         {
             _setCIMValueAtNodeIndex(propNode, propRep->_value._rep,realType);                  _setCIMValueAtNodeIndex(
                       propNode,
                       propRep->_value._rep,
                       realType);
               }
               else
               {
                   PEG_TRACE((TRC_DISCARDED_DATA,Tracer::LEVEL2,
                       "CIMProperty '%s' with type '%s' "
                           "can not be set at SCMOInstance."
                           "It is has not same type '%s' as defined in "
                           "class '%s' of name space '%s'",
                        cimTypeToString(propRep->_value._rep->type),
                       (const char*)propRep->_name.getString().getCString(),
                        cimTypeToString(realType),
                       (const char*)instRep->_reference._rep->
                              _className.getString().getCString(),
                       (const char*)instRep->_reference._rep->
                              _nameSpace.getString().getCString()));
               }
   
         }         }
         else         else
         {         {
             throw PEGASUS_CIM_EXCEPTION(CIM_ERR_TYPE_MISMATCH,  
                propRep->_name.getString());              PEG_TRACE((TRC_DISCARDED_DATA,Tracer::LEVEL2,
                   "CIMProperty '%s' can not be set at SCMOInstance."
                       "It is not part of class '%s' of name space '%s'",
                   (const char*)propRep->_name.getString().getCString(),
                   (const char*)instRep->_reference._rep->
                          _className.getString().getCString(),
                   (const char*)instRep->_reference._rep->
                          _nameSpace.getString().getCString()));
         }         }
     }     }
 } }
Line 2719 
Line 2846 
     isArray = false;     isArray = false;
     size = 0;     size = 0;
  
     rc = inst.hdr->theClass->_getProperyNodeIndex(node,name);      rc = inst.hdr->theClass.ptr->_getProperyNodeIndex(node,name);
     if (rc != SCMO_OK)     if (rc != SCMO_OK)
     {     {
         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);
 } }
  
Line 2752 
Line 2867 
     *pOutVal = 0;     *pOutVal = 0;
     isArray = false;     isArray = false;
     size = 0;     size = 0;
     Uint32 node;  
   
     // is filtering on ?  
     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;  
         }  
   
         // Get absolut pointer to property filter index map of the instance  
         Uint32* propertyFilterIndexMap =  
         (Uint32*)&(inst.base[inst.hdr->propertyFilterIndexMap.start]);  
  
         // get the real node index of the property.      if (idx >= inst.hdr->numberProperties)
         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 SCMO_INDEX_OUT_OF_BOUND;
         }         }
     }  
  
     return  _getPropertyAtNodeIndex(node,pname,type,pOutVal,isArray,size);      return  _getPropertyAtNodeIndex(idx,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
Line 2791 
Line 2884 
         return SCMO_INVALID_PARAMETER;         return SCMO_INVALID_PARAMETER;
     }     }
  
     rc = inst.hdr->theClass->_getProperyNodeIndex(node,name);      rc = inst.hdr->theClass.ptr->_getProperyNodeIndex(node,name);
  
     return rc;     return rc;
  
Line 2811 
Line 2904 
     SCMO_RC rc;     SCMO_RC rc;
     CIMType realType;     CIMType realType;
  
     rc = inst.hdr->theClass->_getProperyNodeIndex(node,name);      rc = inst.hdr->theClass.ptr->_getProperyNodeIndex(node,name);
     if (rc != SCMO_OK)     if (rc != SCMO_OK)
     {     {
         return rc;         return rc;
Line 2820 
Line 2913 
     // 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.
     rc = inst.hdr->theClass->_isNodeSameType(node,type,isArray,realType);      rc = inst.hdr->theClass.ptr->_isNodeSameType(node,type,isArray,realType);
     if (rc != SCMO_OK)     if (rc != SCMO_OK)
     {     {
         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)
     {     {
         if(!inst.hdr->theClass->_isSamePropOrigin(node,origin))          if(!inst.hdr->theClass.ptr->_isSamePropOrigin(node,origin))
         {         {
             return SCMO_NOT_SAME_ORIGIN;             return SCMO_NOT_SAME_ORIGIN;
         }         }
Line 2870 
Line 2951 
         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.
     rc = inst.hdr->theClass->_isNodeSameType(node,type,isArray,realType);      rc = inst.hdr->theClass.ptr->_isNodeSameType(node,type,isArray,realType);
     if (rc != SCMO_OK)     if (rc != SCMO_OK)
     {     {
         return rc;         return rc;
Line 2923 
Line 2993 
     }     }
     else     else
     {     {
           theInstPropNodeArray[node].flags.isNull=false;
         _setSCMBUnion(         _setSCMBUnion(
             pInVal,             pInVal,
             type,             type,
Line 3092 
Line 3163 
     CIMType type,     CIMType type,
     Uint32& n,     Uint32& n,
     Uint64 startNS,     Uint64 startNS,
     Uint64 sizeNS,      Uint32 sizeNS,
     Union& u)     Union& u)
 { {
     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);
Line 3466 
Line 3537 
  
             ptargetUnion = (SCMBUnion*)(&((char*)*pmem)[arrayStart]);             ptargetUnion = (SCMBUnion*)(&((char*)*pmem)[arrayStart]);
  
             SCMOClass* theRefClass;  
   
             for (Uint32 i = 0; i < loop ; i++)             for (Uint32 i = 0; i < loop ; i++)
             {             {
                 if (iterator[i].isUninitialized())                 if (iterator[i].isUninitialized())
Line 3479 
Line 3548 
                 {                 {
                     if (iterator[i].isClass())                     if (iterator[i].isClass())
                     {                     {
                         CIMClass theClass(iterator[i]);                          CIMClass cimClass(iterator[i]);
  
                         ptargetUnion[i].extRefPtr =                         ptargetUnion[i].extRefPtr =
                             new SCMOInstance(                             new SCMOInstance(
                                 theClass,                                  cimClass,
                                 (&((const char*)*pmem)[startNS]));                                 (&((const char*)*pmem)[startNS]));
                         // marke as class only !                         // marke as class only !
                         ptargetUnion[i].extRefPtr->                         ptargetUnion[i].extRefPtr->
Line 3588 
Line 3657 
     SCMBMgmt_Header** pmem,     SCMBMgmt_Header** pmem,
     CIMType type,     CIMType type,
     Uint64 startNS,     Uint64 startNS,
     Uint64 sizeNS,      Uint32 sizeNS,
     Union& u)     Union& u)
 { {
     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);
Line 3681 
Line 3750 
  
     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;
Line 3750 
Line 3823 
             }             }
  
             CIMObject* theCIMObject =(CIMObject*)((void*)&u._objectValue);             CIMObject* theCIMObject =(CIMObject*)((void*)&u._objectValue);
             SCMOClass* theRefClass;  
  
             if (theCIMObject->isUninitialized())             if (theCIMObject->isUninitialized())
             {             {
Line 3761 
Line 3833 
             {             {
                 if (theCIMObject->isClass())                 if (theCIMObject->isClass())
                 {                 {
                     CIMClass theClass(*theCIMObject);                      CIMClass cimClass(*theCIMObject);
  
                     scmoUnion->extRefPtr =                     scmoUnion->extRefPtr =
                         new SCMOInstance(                         new SCMOInstance(
                             theClass,                              cimClass,
                             (&((const char*)*pmem)[startNS]));                             (&((const char*)*pmem)[startNS]));
                     // marke as class only !                     // marke as class only !
                     scmoUnion->extRefPtr->inst.hdr->flags.isClassOnly=true;                     scmoUnion->extRefPtr->inst.hdr->flags.isClassOnly=true;
Line 3867 
Line 3939 
         (SCMBValue*)&inst.base[inst.hdr->propertyArray.start];         (SCMBValue*)&inst.base[inst.hdr->propertyArray.start];
  
     // create a pointer to property node array of the class.     // create a pointer to property node array of the class.
     Uint64 idx = inst.hdr->theClass->cls.hdr->propertySet.nodeArray.start;      Uint64 idx = inst.hdr->theClass.ptr->cls.hdr->propertySet.nodeArray.start;
     SCMBClassPropertyNode* theClassPropNodeArray =     SCMBClassPropertyNode* theClassPropNodeArray =
         (SCMBClassPropertyNode*)&(inst.hdr->theClass->cls.base)[idx];          (SCMBClassPropertyNode*)&(inst.hdr->theClass.ptr->cls.base)[idx];
  
     // the property name is always from the class.     // the property name is always from the class.
     // return the absolut pointer to the property name,     // return the absolut pointer to the property name,
     // the caller has to copy the name!     // the caller has to copy the name!
     *pname=_getCharString(     *pname=_getCharString(
         theClassPropNodeArray[node].theProperty.name,         theClassPropNodeArray[node].theProperty.name,
         inst.hdr->theClass->cls.base);          inst.hdr->theClass.ptr->cls.base);
  
     // the property was set by the provider.     // the property was set by the provider.
     if (theInstPropNodeArray[node].flags.isSet)     if (theInstPropNodeArray[node].flags.isSet)
Line 3924 
Line 3996 
     Uint64 start =     Uint64 start =
         (const char*)         (const char*)
                &(theClassPropNodeArray[node].theProperty.defaultValue.value) -                &(theClassPropNodeArray[node].theProperty.defaultValue.value) -
         (inst.hdr->theClass->cls.base);          (inst.hdr->theClass.ptr->cls.base);
  
     *pvalue = _resolveSCMBUnion(     *pvalue = _resolveSCMBUnion(
         type,         type,
         isArray,         isArray,
         size,         size,
         start,         start,
         (inst.hdr->theClass->cls.base)          (inst.hdr->theClass.ptr->cls.base)
         );         );
  
     return SCMO_OK;     return SCMO_OK;
Line 3943 
Line 4015 
     if (objectPathOnly)     if (objectPathOnly)
     {     {
         // Create a new, empty SCMOInstance         // Create a new, empty SCMOInstance
         SCMOInstance newInst(*(this->inst.hdr->theClass));          SCMOInstance newInst(*(this->inst.hdr->theClass.ptr));
  
         // Copy the host name to tha new instance-         // Copy the host name to tha new instance-
         _setBinary(         _setBinary(
Line 3989 
Line 4061 
 void SCMOInstance::_clone() void SCMOInstance::_clone()
 { {
     char* newBase;     char* newBase;
     newBase = (char*)malloc(inst.mem->totalSize);      newBase = (char*)malloc((size_t)inst.mem->totalSize);
     if (0 == newBase )     if (0 == newBase )
     {     {
         throw PEGASUS_STD(bad_alloc)();         throw PEGASUS_STD(bad_alloc)();
     }     }
  
     memcpy( newBase,inst.base,inst.mem->totalSize);      memcpy( newBase,inst.base,(size_t)inst.mem->totalSize);
  
     // make new new memory block to mine.     // make new new memory block to mine.
     inst.base = newBase;     inst.base = newBase;
     // reset the refcounter of this instance     // reset the refcounter of this instance
     inst.hdr->refCount = 1;     inst.hdr->refCount = 1;
     // keep the ref counter of the class correct !     // keep the ref counter of the class correct !
     inst.hdr->theClass = new SCMOClass(*(inst.hdr->theClass));      inst.hdr->theClass.ptr = new SCMOClass(*(inst.hdr->theClass.ptr));
     // keep the ref count for external references     // keep the ref count for external references
     _copyExternalReferences();     _copyExternalReferences();
  
Line 4016 
Line 4088 
         (SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]);         (SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]);
  
     // Address the class keybinding information     // Address the class keybinding information
     const SCMBClass_Main* clshdr = inst.hdr->theClass->cls.hdr;      const SCMBClass_Main* clshdr = inst.hdr->theClass.ptr->cls.hdr;
     const char * clsbase = inst.hdr->theClass->cls.base;      const char * clsbase = inst.hdr->theClass.ptr->cls.base;
     SCMBKeyBindingNode* scmoClassArray =     SCMBKeyBindingNode* scmoClassArray =
         (SCMBKeyBindingNode*)&(clsbase[clshdr->keyBindingSet.nodeArray.start]);         (SCMBKeyBindingNode*)&(clsbase[clshdr->keyBindingSet.nodeArray.start]);
  
Line 4168 
Line 4240 
  
 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);
 } }
  
Line 4224 
Line 4291 
             {             {
                 return(u);                 return(u);
             }             }
             break;  
         }         }
  
     case CIMTYPE_STRING:     case CIMTYPE_STRING:
Line 4259 
Line 4325 
             }             }
  
              return(ptr);              return(ptr);
             break;  
         }         }
     default:     default:
         {         {
Line 4287 
Line 4352 
           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
Line 4347 
Line 4418 
  
     *pvalue = 0;     *pvalue = 0;
  
     rc = inst.hdr->theClass->_getKeyBindingNodeIndex(node,name);      rc = inst.hdr->theClass.ptr->_getKeyBindingNodeIndex(node,name);
     if (rc != SCMO_OK)     if (rc != SCMO_OK)
     {     {
         // look at the user defined key bindings.         // look at the user defined key bindings.
Line 4389 
Line 4460 
             (SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]);             (SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]);
  
         // create a pointer to key binding node array of the class.         // create a pointer to key binding node array of the class.
         Uint64 idx = inst.hdr->theClass->cls.hdr->keyBindingSet.nodeArray.start;          Uint64 idx = inst.hdr->theClass.ptr->cls.hdr->
               keyBindingSet.nodeArray.start;
         SCMBKeyBindingNode* theClassKeyBindNodeArray =         SCMBKeyBindingNode* theClassKeyBindNodeArray =
             (SCMBKeyBindingNode*)&((inst.hdr->theClass->cls.base)[idx]);              (SCMBKeyBindingNode*)&((inst.hdr->theClass.ptr->cls.base)[idx]);
  
         type = theClassKeyBindNodeArray[node].type;         type = theClassKeyBindNodeArray[node].type;
  
Line 4399 
Line 4471 
         pnameLen = theClassKeyBindNodeArray[node].name.size;         pnameLen = theClassKeyBindNodeArray[node].name.size;
         *pname = _getCharString(         *pname = _getCharString(
             theClassKeyBindNodeArray[node].name,             theClassKeyBindNodeArray[node].name,
             inst.hdr->theClass->cls.base);              inst.hdr->theClass.ptr->cls.base);
  
         // There is no value set in the instance         // There is no value set in the instance
         if (!theInstKeyBindValueArray[node].isSet)         if (!theInstKeyBindValueArray[node].isSet)
Line 4439 
Line 4511 
  
     Uint32 len = strlen(name);     Uint32 len = strlen(name);
     node = 0;     node = 0;
     SCMBUserKeyBindingElement* theUserDefKBElement;  
  
     Uint64 elementStart = inst.hdr->userKeyBindingElement.start;     Uint64 elementStart = inst.hdr->userKeyBindingElement.start;
  
Line 4498 
Line 4569 
                         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:
Line 4728 
Line 4795 
             // 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:
         {         {
Line 4765 
Line 4831 
         {         {
             // From PEP 194: EmbeddedObjects cannot be keys.             // From PEP 194: EmbeddedObjects cannot be keys.
             throw TypeMismatchException();             throw TypeMismatchException();
             break;  
         }         }
     default:     default:
         {         {
Line 4782 
Line 4847 
     CIMType type,     CIMType type,
     String cimKeyBinding)     String cimKeyBinding)
 { {
     SCMO_RC rc;  
     Uint32 node;     Uint32 node;
  
     if (0 == name)     if (0 == name)
Line 4790 
Line 4854 
         return SCMO_INVALID_PARAMETER;         return SCMO_INVALID_PARAMETER;
     }     }
  
     if (SCMO_OK == inst.hdr->theClass->_getKeyBindingNodeIndex(node,name))      if (SCMO_OK == inst.hdr->theClass.ptr->_getKeyBindingNodeIndex(node,name))
     {     {
         // 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->cls.hdr->keyBindingSet.nodeArray.start;          Uint64 idx = inst.hdr->theClass.ptr->cls.hdr->
               keyBindingSet.nodeArray.start;
         SCMBKeyBindingNode* theClassKeyBindNodeArray =         SCMBKeyBindingNode* theClassKeyBindNodeArray =
             (SCMBKeyBindingNode*)&((inst.hdr->theClass->cls.base)[idx]);              (SCMBKeyBindingNode*)&((inst.hdr->theClass.ptr->cls.base)[idx]);
  
         // create a pointer to instance keybinding values         // create a pointer to instance keybinding values
         SCMBKeyBindingValue* theInstKeyBindValueArray =         SCMBKeyBindingValue* theInstKeyBindValueArray =
Line 4852 
Line 4917 
  
     _copyOnWrite();     _copyOnWrite();
  
     rc = inst.hdr->theClass->_getKeyBindingNodeIndex(node,name);      // 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);
     if (rc != SCMO_OK)     if (rc != SCMO_OK)
     {     {
         // the key bindig does not belong to the associated class         // the key bindig does not belong to the associated class
Line 4888 
Line 4962 
         CIMType type,         CIMType type,
         const SCMBUnion* keyvalue)         const SCMBUnion* keyvalue)
 { {
     SCMO_RC rc;  
   
     if (0 == keyvalue)     if (0 == keyvalue)
     {     {
         return SCMO_INVALID_PARAMETER;         return SCMO_INVALID_PARAMETER;
Line 4904 
Line 4976 
  
     _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->cls.hdr->keyBindingSet.nodeArray.start;      Uint64 idx = inst.hdr->theClass.ptr->cls.hdr->
           keyBindingSet.nodeArray.start;
     SCMBKeyBindingNode* theClassKeyBindNodeArray =     SCMBKeyBindingNode* theClassKeyBindNodeArray =
         (SCMBKeyBindingNode*)&((inst.hdr->theClass->cls.base)[idx]);          (SCMBKeyBindingNode*)&((inst.hdr->theClass.ptr->cls.base)[idx]);
  
     // is the node a user defined key binding ?     // is the node a user defined key binding ?
     if (node >= inst.hdr->numberKeyBindings)     if (node >= inst.hdr->numberKeyBindings)
Line 4989 
Line 5072 
                 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:
Line 4997 
Line 5079 
                 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:
Line 5005 
Line 5086 
                 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:
Line 5013 
Line 5093 
                 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)
Line 5034 
Line 5114 
                 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:
Line 5042 
Line 5121 
                 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:
Line 5050 
Line 5128 
                 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:
Line 5058 
Line 5135 
                 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)
Line 5078 
Line 5154 
                 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:
Line 5086 
Line 5161 
                 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
     {     {
Line 5119 
Line 5193 
                 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;  
             }             }
         }         }
     }     }
Line 5133 
Line 5205 
  
 } }
  
 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->_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->cls.hdr->keyPropertyMask.start;  
     Uint64* keyMask =(Uint64*)&(inst.hdr->theClass->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->cls.hdr->keyIndexList.start;  
     Uint32* keyIndex = (Uint32*)&(inst.hdr->theClass->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->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
  *****************************************************************************/  *****************************************************************************/
 SCMODump::SCMODump() SCMODump::SCMODump()
 { {
     _out = stdout;      _out = stderr;
     _fileOpen = false;     _fileOpen = false;
  
 #ifdef PEGASUS_OS_ZOS #ifdef PEGASUS_OS_ZOS
Line 5385 
Line 5280 
  
 Boolean SCMODump::compareFile(String master) Boolean SCMODump::compareFile(String master)
 { {
   
     if (!_fileOpen)     if (!_fileOpen)
     {     {
         return false;         return false;
     }     }
   
     closeFile();     closeFile();
  
     return (FileSystem::compareFiles(_filename, master));      ifstream isMaster;
       ifstream isDumpFile;
   
       Open(isDumpFile, _filename);
       Open(isMaster, master);
   
       String aLine;
       String bLine;
   
       while (GetLine(isDumpFile, aLine) && GetLine(isMaster, bLine))
       {
           if (aLine != bLine)
           {
               cout << "|" << aLine << "|" << endl;
               cout << "|" << bLine << "|" << endl;
               isDumpFile.close();
               isMaster.close();
               return false;
           }
       };
       isDumpFile.close();
       isMaster.close();
       return true;
 } }
  
 void SCMODump::dumpSCMOInstance(SCMOInstance& testInst) const  void SCMODump::dumpSCMOInstance(SCMOInstance& testInst, Boolean inclMemHdr)const
 { {
     SCMBInstance_Main* insthdr = testInst.inst.hdr;     SCMBInstance_Main* insthdr = testInst.inst.hdr;
     char* instbase = testInst.inst.base;     char* instbase = testInst.inst.base;
  
     fprintf(_out,"\n\nDump of SCMOInstance\n");     fprintf(_out,"\n\nDump of SCMOInstance\n");
     // The magic number for SCMO class  
     fprintf(_out,"\nheader.magic=%08X",insthdr->header.magic);      if (inclMemHdr)
     // Total size of the instance memory block( # bytes )      {
     fprintf(_out,"\nheader.totalSize=%llu",insthdr->header.totalSize);          _dumpSCMBMgmt_Header(insthdr->header,instbase);
       }
   
     // The reference counter for this c++ class     // The reference counter for this c++ class
     fprintf(_out,"\nrefCount=%i",insthdr->refCount.get());     fprintf(_out,"\nrefCount=%i",insthdr->refCount.get());
     fprintf(_out,"\ntheClass: %p",insthdr->theClass);      fprintf(_out,"\ntheClass: %p",insthdr->theClass.ptr);
     fprintf(_out,"\n\nThe Flags:");     fprintf(_out,"\n\nThe Flags:");
     fprintf(_out,"\n   includeQualifiers: %s",     fprintf(_out,"\n   includeQualifiers: %s",
            (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",
            (insthdr->flags.isCompromised ? "True" : "False"));            (insthdr->flags.isCompromised ? "True" : "False"));
       fprintf(_out,"\n   exportSetOnly: %s",
              (insthdr->flags.exportSetOnly ? "True" : "False"));
     fprintf(_out,"\n\ninstNameSpace: \'%s\'",     fprintf(_out,"\n\ninstNameSpace: \'%s\'",
            NULLSTR(_getCharString(insthdr->instNameSpace,instbase)));            NULLSTR(_getCharString(insthdr->instNameSpace,instbase)));
     fprintf(_out,"\n\ninstClassName: \'%s\'",     fprintf(_out,"\n\ninstClassName: \'%s\'",
Line 5429 
Line 5346 
  
     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
Line 5476 
Line 5369 
     for (Uint32 i = 0, k = insthdr->numberProperties; i < k; i++)     for (Uint32 i = 0, k = insthdr->numberProperties; i < k; i++)
     {     {
         fprintf(_out,"\n\nInstance property (#%3u) %s\n",i,         fprintf(_out,"\n\nInstance property (#%3u) %s\n",i,
                 NULLSTR(insthdr->theClass->_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;          printSCMOValue(val[i],instbase,verbose);
     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 =  
         (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,
Line 5602 
Line 5385 
     char* instbase = testInst.inst.base;     char* instbase = testInst.inst.base;
  
     // create a pointer to keybinding node array of the class.     // create a pointer to keybinding node array of the class.
     Uint64 idx = insthdr->theClass->cls.hdr->keyBindingSet.nodeArray.start;      Uint64 idx = insthdr->theClass.ptr->cls.hdr->keyBindingSet.nodeArray.start;
     SCMBKeyBindingNode* theClassKeyBindNodeArray =     SCMBKeyBindingNode* theClassKeyBindNodeArray =
         (SCMBKeyBindingNode*)&((insthdr->theClass->cls.base)[idx]);          (SCMBKeyBindingNode*)&((insthdr->theClass.ptr->cls.base)[idx]);
  
     SCMBKeyBindingValue* ptr =     SCMBKeyBindingValue* ptr =
         (SCMBKeyBindingValue*)         (SCMBKeyBindingValue*)
Line 5622 
Line 5405 
             fprintf(_out,"\n\nName: '%s'\nType: '%s'",             fprintf(_out,"\n\nName: '%s'\nType: '%s'",
                 NULLSTR(_getCharString(                 NULLSTR(_getCharString(
                     theClassKeyBindNodeArray[i].name,                     theClassKeyBindNodeArray[i].name,
                     insthdr->theClass->cls.base)),                      insthdr->theClass.ptr->cls.base)),
                 cimTypeToString(theClassKeyBindNodeArray[i].type));                 cimTypeToString(theClassKeyBindNodeArray[i].type));
             printUnionValue(             printUnionValue(
                 theClassKeyBindNodeArray[i].type,                 theClassKeyBindNodeArray[i].type,
Line 5635 
Line 5418 
             fprintf(_out,"\n\nName: '%s': Not Set",             fprintf(_out,"\n\nName: '%s': Not Set",
                 NULLSTR(_getCharString(                 NULLSTR(_getCharString(
                     theClassKeyBindNodeArray[i].name,                     theClassKeyBindNodeArray[i].name,
                     insthdr->theClass->cls.base)));                      insthdr->theClass.ptr->cls.base)));
         }         }
     }     }
  
Line 5674 
Line 5457 
  
 } }
  
 void SCMODump::dumpSCMOClass(SCMOClass& testCls) const  void SCMODump::_dumpSCMBMgmt_Header(SCMBMgmt_Header& header,char* base) const
   {
       fprintf(_out,"\nThe Management Header:");
       // The magic number
       fprintf(_out,"\n   magic=%08X",header.magic);
       // Total size of the memory block( # bytes )
       fprintf(_out,"\n   totalSize=%llu",header.totalSize);
       // Free bytes in the block
       fprintf(_out,"\n   freeBytes=%llu",header.freeBytes);
       // Index to the start of the free space in this SCMB memory block.
       fprintf(_out,"\n   startOfFreeSpace=%llu",header.startOfFreeSpace);
       // Number of external references in this instance.
       fprintf(_out,"\n   numberExtRef=%u",header.numberExtRef);
       // Size of external reference index array;
       fprintf(_out,"\n   sizeExtRefIndexArray=%u",header.sizeExtRefIndexArray);
   
       if (header.numberExtRef > 0)
       {
           fprintf(_out,"\n   extRefIndexArray=[");
           Uint64* extRefIndexArray =
               (Uint64*)&(base[header.extRefIndexArray.start]);
   
           for (Uint32 i = 0; i < header.numberExtRef;)
           {
               fprintf(_out,"%llu",extRefIndexArray[i]);
               i++;
               if (i != header.numberExtRef)
               {
                   fprintf(_out,", ");
               }
           }
           fprintf(_out,"\n");
       }
       else
       {
              fprintf(_out,"\n   extRefIndexArray=[NO INDEX]\n");
       }
   }
   
   void SCMODump::dumpSCMOClass(SCMOClass& testCls, Boolean inclMemHdr) const
 { {
     SCMBClass_Main* clshdr = testCls.cls.hdr;     SCMBClass_Main* clshdr = testCls.cls.hdr;
     char* clsbase = testCls.cls.base;     char* clsbase = testCls.cls.base;
  
     fprintf(_out,"\n\nDump of SCMOClass\n");     fprintf(_out,"\n\nDump of SCMOClass\n");
     // The magic number for SCMO class  
     fprintf(_out,"\nheader.magic=%08X",clshdr->header.magic);      if (inclMemHdr)
     // Total size of the instance memory block( # bytes )      {
     fprintf(_out,"\nheader.totalSize=%llu",clshdr->header.totalSize);          _dumpSCMBMgmt_Header(clshdr->header,clsbase);
       }
   
     // The reference counter for this c++ class     // The reference counter for this c++ class
     fprintf(_out,"\nrefCount=%i",clshdr->refCount.get());     fprintf(_out,"\nrefCount=%i",clshdr->refCount.get());
       fprintf(_out,"\n\nThe Flags:");
       fprintf(_out,"\n   isEmpty: %s",
              (clshdr->flags.isEmpty ? "True" : "False"));
     fprintf(_out,"\n\nsuperClassName: \'%s\'",     fprintf(_out,"\n\nsuperClassName: \'%s\'",
            NULLSTR(_getCharString(clshdr->superClassName,clsbase)));            NULLSTR(_getCharString(clshdr->superClassName,clsbase)));
     fprintf(_out,"\nnameSpace: \'%s\'",     fprintf(_out,"\nnameSpace: \'%s\'",
Line 5729 
Line 5555 
  
 void SCMODump::hexDumpSCMOClass(SCMOClass& testCls) const void SCMODump::hexDumpSCMOClass(SCMOClass& testCls) const
 { {
     char* tmp;  
   
     SCMBClass_Main* clshdr = testCls.cls.hdr;     SCMBClass_Main* clshdr = testCls.cls.hdr;
     char* clsbase = testCls.cls.base;     char* clsbase = testCls.cls.base;
  
Line 5760 
Line 5584 
         }         }
         else         else
         {         {
             line = clshdr->propertySet.number%16;              line = clshdr->propertySet.number & 15;
         }         }
  
  
Line 5785 
Line 5609 
 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");
Line 5828 
Line 5651 
  
         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));
  
Line 5839 
Line 5662 
 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");
Line 5889 
Line 5711 
  
     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")
Line 5923 
Line 5745 
         }         }
         else         else
         {         {
             line = size%16;              line = size & 15;
         }         }
  
  
Line 6041 
Line 5863 
          }          }
          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," ");
              }              }
Line 6068 
Line 5890 
      }      }
 } }
  
 void SCMODump::_hexDump(char* buffer,int length) const  void SCMODump::_hexDump(char* buffer,Uint64 length) const
 { {
  
     unsigned char printLine[3][80];     unsigned char printLine[3][80];
Line 6076 
Line 5898 
     int len;     int len;
     unsigned char item;     unsigned char item;
  
     for (int i = 0; i < length;i=i+1)      for (Uint64 i = 0; i < length;i=i+1)
     {     {
         p = i%80;          p = (int)i%80;
  
         if ((p == 0 && i > 0) || i == length-1 )         if ((p == 0 && i > 0) || i == length-1 )
         {         {
Line 6119 
Line 5941 
         }         }
  
         printLine[1][p] = item/16;         printLine[1][p] = item/16;
         printLine[2][p] = item%16;          printLine[2][p] = item & 15;
  
     }     }
 } }
Line 6332 
Line 6154 
  
     case CIMTYPE_STRING:     case CIMTYPE_STRING:
         {         {
             SCMBDataPtr* p = (SCMBDataPtr*)&(base[u.arrayValue.start]);  
             for (Uint32 i = 0; i < size; i++)             for (Uint32 i = 0; i < size; i++)
             {             {
                 if ( 0 != p[i].size)                  if ( 0 != p[i].stringValue.size)
                 {                 {
                     out.append('\'');                     out.append('\'');
                     out.append((const char*)_getCharString(p[i],base),                      out.append(
                                p[i].size-1);                          (const char*)_getCharString(p[i].stringValue,base),
                           p[i].stringValue.size-1);
                     out.append('\'');                     out.append('\'');
                 }                 }
                 else                 else
Line 6354 
Line 6176 
  
     case CIMTYPE_DATETIME:     case CIMTYPE_DATETIME:
         {         {
             SCMBDateTime* p = (SCMBDateTime*)&(base[u.arrayValue.start]);  
             CIMDateTime x;             CIMDateTime x;
             for (Uint32 i = 0; i < size; i++)             for (Uint32 i = 0; i < size; i++)
             {             {
                 memcpy(x._rep,&(p[i]),sizeof(SCMBDateTime));                  memcpy(x._rep,&(p[i].dateTimeValue),sizeof(SCMBDateTime));
                 _toString(out,x);                 _toString(out,x);
                 out.append(' ');                 out.append(' ');
             }             }
Line 6377 
Line 6198 
                     fprintf(_out,"\n-----------> "                     fprintf(_out,"\n-----------> "
                                   "Start of embedded external reference [%d]"                                   "Start of embedded external reference [%d]"
                                   " <-----------\n\n",i);                                   " <-----------\n\n",i);
                     dumpSCMOInstance(*u.extRefPtr);                      dumpSCMOInstance(*(p[i].extRefPtr));
                     fprintf(_out,"\n-----------> "                     fprintf(_out,"\n-----------> "
                                   "End of embedded external reference [%d]"                                   "End of embedded external reference [%d]"
                                   " <-----------\n\n",i);                                   " <-----------\n\n",i);
Line 6556 
Line 6377 
  
   return;   return;
 } }
   #endif // PEGASUS_DEBUG (class SCMODump only in debug builds available)
  
  
 /***************************************************************************** /*****************************************************************************
  * The constant functions  * The constant functions
  *****************************************************************************/  *****************************************************************************/
  
 #ifdef PEGASUS_STRING_ENABLE_ICU  #ifdef PEGASUS_HAS_ICU
 Uint32 _utf8ICUncasecmp( Uint32 _utf8ICUncasecmp(
     const char* a,     const char* a,
     const char* b,     const char* b,
Line 6659 
Line 6481 
  *            e.g. &cls.mem  *            e.g. &cls.mem
  * @return The relaive index of the free memory slot.  * @return The relaive index of the free memory slot.
  */  */
   Uint64 _getFreeSpace(
 static Uint64 _getFreeSpace(  
     SCMBDataPtr& ptr,     SCMBDataPtr& ptr,
     Uint64 size,      Uint32 size,
     SCMBMgmt_Header** pmem)     SCMBMgmt_Header** pmem)
 { {
     Uint64 oldSize, start;     Uint64 oldSize, start;
       Uint64 alignedStart, reqAlignSize;
  
     if (size == 0)     if (size == 0)
     {     {
Line 6676 
Line 6498 
  
     // The SCMBDataPtr has to be set before any reallocation.     // The SCMBDataPtr has to be set before any reallocation.
     start = (*pmem)->startOfFreeSpace;     start = (*pmem)->startOfFreeSpace;
     ptr.start = start;  
     ptr.size = size;  
  
     while ((*pmem)->freeBytes < size)      // Need to align the start of freespace to 8 byte
       // boundaries to avoid alignment issues on some architectures
       // Round up to nearest multiple of 8
       alignedStart = (start + 7) & ~7;
       // due to the alignment, a little more room is needed in the SCMB
       reqAlignSize = (size + alignedStart - start);
   
       ptr.start = alignedStart;
       ptr.size = size;
       // add 8 bytes of size for later alignment on the next pointer
       while ((*pmem)->freeBytes < reqAlignSize)
     {     {
         // save old size of buffer         // save old size of buffer
         oldSize = (*pmem)->totalSize;         oldSize = (*pmem)->totalSize;
         // reallocate the buffer, double the space !         // reallocate the buffer, double the space !
         // This is a working approach until a better algorithm is found.         // This is a working approach until a better algorithm is found.
         void* newBlockPtr = realloc((*pmem),oldSize*2);          void* newBlockPtr = realloc((*pmem),(size_t)oldSize*2);
         if ((newBlockPtr) == 0)         if ((newBlockPtr) == 0)
         {         {
             // Not enough memory!             // Not enough memory!
Line 6697 
Line 6527 
         (*pmem)->totalSize+=oldSize;         (*pmem)->totalSize+=oldSize;
     }     }
  
     (*pmem)->freeBytes -= size;      (*pmem)->freeBytes -= reqAlignSize;
     (*pmem)->startOfFreeSpace += size;      (*pmem)->startOfFreeSpace = alignedStart + size;
  
     // Init memory to 0.      // Init memory from unaligned start up to the size required with alignment
     memset(&((char*)(*pmem))[start],0,size);      // to zero.
       memset(&((char*)(*pmem))[start],0,(size_t)reqAlignSize);
       PEGASUS_DEBUG_ASSERT(
           ((*pmem)->freeBytes+(*pmem)->startOfFreeSpace) == (*pmem)->totalSize);
  
     return start;      return alignedStart;
 } }
  
 static void _setString(  void _setString(
     const String& theString,     const String& theString,
     SCMBDataPtr& ptr,     SCMBDataPtr& ptr,
     SCMBMgmt_Header** pmem)     SCMBMgmt_Header** pmem)
Line 6717 
Line 6550 
     // Get the real size of the UTF8 sting + \0.     // Get the real size of the UTF8 sting + \0.
     // It maybe greater then the length in the String due to     // It maybe greater then the length in the String due to
     // 4 byte encoding of non ASCII chars.     // 4 byte encoding of non ASCII chars.
     Uint64 start,length = strlen((const char*)theCString)+1;      Uint64 start;
       Uint32 length = strlen((const char*)theCString)+1;
  
     // If the string is not empty.     // If the string is not empty.
     if (length != 1)     if (length != 1)
Line 6737 
Line 6571 
     }     }
 } }
  
 static void _setBinary(  void _setBinary(
     const void* theBuffer,     const void* theBuffer,
     Uint64 bufferSize,      Uint32 bufferSize,
     SCMBDataPtr& ptr,     SCMBDataPtr& ptr,
     SCMBMgmt_Header** pmem)     SCMBMgmt_Header** pmem)
 { {
Line 6766 
Line 6600 
     }     }
 } }
  
 static void _destroyExternalReferencesInternal(SCMBMgmt_Header* memHdr)  void _destroyExternalReferencesInternal(SCMBMgmt_Header* memHdr)
 { {
  
     Uint32 number = memHdr->numberExtRef;     Uint32 number = memHdr->numberExtRef;


Legend:
Removed from v.1.2.2.72  
changed lines
  Added in v.1.24

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2