(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.38 and 1.2.2.68

version 1.2.2.38, 2009/10/13 09:36:35 version 1.2.2.68, 2009/11/13 16:34:11
Line 48 
Line 48 
 #include <Pegasus/Common/StringConversion.h> #include <Pegasus/Common/StringConversion.h>
 #include <Pegasus/Common/ArrayIterator.h> #include <Pegasus/Common/ArrayIterator.h>
 #include <Pegasus/Common/PegasusAssert.h> #include <Pegasus/Common/PegasusAssert.h>
   #include <Pegasus/Common/CIMValueRep.h>
   
   # if defined PEGASUS_OS_ZOS
 #include <strings.h> #include <strings.h>
   # else
   #  include <string.h>
   # endif
  
 #ifdef PEGASUS_OS_ZOS #ifdef PEGASUS_OS_ZOS
   #include <Pegasus/General/SetFileDescriptorToEBCDICEncoding.h>   #include <Pegasus/General/SetFileDescriptorToEBCDICEncoding.h>
Line 77 
Line 83 
 #define NULLSTR(x) ((x) == 0 ? "" : (x)) #define NULLSTR(x) ((x) == 0 ? "" : (x))
  
 #define NEWCIMSTR(ptr,base) \ #define NEWCIMSTR(ptr,base) \
       ((ptr).length == 0 ?  \        ((ptr).size == 0 ?  \
       (String()) :           \       (String()) :           \
       (String(&(base)[(ptr).start],((ptr).length)-1)))        (String(&(base)[(ptr).start],((ptr).size)-1)))
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 171 
Line 177 
  * Internal inline functions.  * Internal inline functions.
  *****************************************************************************/  *****************************************************************************/
  
 inline SCMOClass* _getSCMOClass(  
     const CIMObjectPath& theCIMObj,  
     const char* altNS,  
     Uint64 altNSlength)  
 {  
     SCMOClass* theClass=0;  
   
     if (theCIMObj.getClassName().isNull())  
     {  
         return 0;  
     }  
   
     if (theCIMObj.getNameSpace().isNull())  
     {  
         // the name space of the object path is empty,  
         // use alternative name space.  
         CString clsName = theCIMObj.getClassName().getString().getCString();  
   
         SCMOClassCache* theCache = SCMOClassCache::getInstance();  
         theClass = theCache->getSCMOClass(  
             altNS,  
             altNSlength,  
             (const char*)clsName,  
             strlen(clsName));  
   
     }  
     else  
     {  
         CString nameSpace = theCIMObj.getNameSpace().getString().getCString();  
         CString clsName = theCIMObj.getClassName().getString().getCString();  
   
         SCMOClassCache* theCache = SCMOClassCache::getInstance();  
         theClass = theCache->getSCMOClass(  
             (const char*)nameSpace,  
             strlen(nameSpace),  
             (const char*)clsName,  
             strlen(clsName));  
     }  
   
     return theClass;  
 }  
   
 inline void _deleteArrayExtReference( inline void _deleteArrayExtReference(
     SCMBDataPtr& theArray,     SCMBDataPtr& theArray,
     SCMBMgmt_Header** pmem )     SCMBMgmt_Header** pmem )
Line 220 
Line 184 
     SCMBUnion* ptr;     SCMBUnion* ptr;
     // if the array was already set,     // if the array was already set,
     // the previous references has to be deleted     // the previous references has to be deleted
     if(theArray.length != 0)      if(theArray.size != 0)
     {     {
         Uint32 oldArraySize=(theArray.length/sizeof(SCMBUnion));          Uint32 oldArraySize=(theArray.size/sizeof(SCMBUnion));
  
         ptr = (SCMBUnion*)&(((char*)*pmem)[theArray.start]);         ptr = (SCMBUnion*)&(((char*)*pmem)[theArray.start]);
         for (Uint32 i = 0 ; i < oldArraySize ; i++)         for (Uint32 i = 0 ; i < oldArraySize ; i++)
         {         {
             delete ptr[i].extRefPtr;             delete ptr[i].extRefPtr;
         }              ptr[i].extRefPtr = 0;
     }  
 }  
   
 inline void _copyArrayExtReference(  
     SCMBDataPtr& theArray,  
     SCMBMgmt_Header** pmem )  
 {  
     SCMBUnion* ptr;  
     // if the array was already set,  
     // the previous references has to be deleted  
     if(theArray.length != 0)  
     {  
         Uint32 oldArraySize=(theArray.length/sizeof(SCMBUnion));  
   
         ptr = (SCMBUnion*)&(((char*)*pmem)[theArray.start]);  
         for (Uint32 i = 0 ; i < oldArraySize ; i++)  
         {  
             if (ptr[i].extRefPtr != 0)  
             {  
                 ptr[i].extRefPtr = new SCMOInstance(*ptr[i].extRefPtr);  
             }  
         }         }
     }     }
 } }
Line 259 
Line 202 
  *****************************************************************************/  *****************************************************************************/
 SCMOClass::SCMOClass() SCMOClass::SCMOClass()
 { {
     cls.mem = 0;      _initSCMOClass();
 }  
   
 void SCMOClass::_destroyExternalReferences()  
 {  
     // TODO: Has to be optimized not to loop through all props.  
     // Address the property array  
     SCMBClassPropertyNode* nodeArray =  
         (SCMBClassPropertyNode*)  
             &(cls.base[cls.hdr->propertySet.nodeArray.start]);  
   
     SCMBValue* theValue;  
   
     for (Uint32 i = 0; i < cls.hdr->propertySet.number; i++)  
     {  
         theValue = &(nodeArray[i].theProperty.defaultValue);  
  
         // if not an NULL value !      _setBinary("",1,cls.hdr->className,&cls.mem );
         if(!theValue->flags.isNull)      _setBinary("",1,cls.hdr->nameSpace,&cls.mem );
         {      cls.hdr->flags.isEmpty=true;
             if (theValue->valueType == CIMTYPE_REFERENCE ||  
                 theValue->valueType == CIMTYPE_OBJECT ||  
                 theValue->valueType == CIMTYPE_INSTANCE )  
             {  
                 if (theValue->flags.isArray)  
                 {  
                     _deleteArrayExtReference(  
                         theValue->value.arrayValue,  
                         &cls.mem);  
                 }  
                 else  
                 {  
                     delete theValue->value.extRefPtr;  
                 }  // end is Array  
             } // end is ext. reference.  
         }// end is not null  
     }// loop throug all properties  
 } }
  
 inline void SCMOClass::_initSCMOClass() inline void SCMOClass::_initSCMOClass()
Line 328 
Line 239 
  
 SCMOClass::SCMOClass(const char* className, const char* nameSpaceName ) SCMOClass::SCMOClass(const char* className, const char* nameSpaceName )
 { {
       Uint32 clsNameLen = strlen(className);
       Uint32 nsNameLen = strlen(nameSpaceName);
   
     if (0 == className)     if (0 == className)
     {     {
         String message("SCMOClass: Class name not set (null pointer)!");         String message("SCMOClass: Class name not set (null pointer)!");
Line 342 
Line 256 
  
     _initSCMOClass();     _initSCMOClass();
  
     _setBinary(className,      _setBinary(className,clsNameLen+1,cls.hdr->className,&cls.mem );
                strlen(className)+1,  
                cls.hdr->className,  
                &cls.mem );  
  
     _setBinary(nameSpaceName,      _setBinary(nameSpaceName,nsNameLen+1,cls.hdr->nameSpace,&cls.mem );
                strlen(nameSpaceName)+1,  
                cls.hdr->nameSpace,      cls.hdr->flags.isEmpty=true;
                &cls.mem );  
  
 } }
  
Line 371 
Line 281 
     {     {
         // there is no Super ClassName         // there is no Super ClassName
         cls.hdr->superClassName.start=0;         cls.hdr->superClassName.start=0;
         cls.hdr->superClassName.length=0;          cls.hdr->superClassName.size=0;
     }     }
  
     CIMObjectPath theObjectPath=theCIMClass.getPath();     CIMObjectPath theObjectPath=theCIMClass.getPath();
Line 404 
Line 314 
  
 } }
  
   void SCMOClass::_destroyExternalReferences()
   {
       _destroyExternalReferencesInternal(cls.mem);
   }
   
   const char* SCMOClass::getSuperClassName() const
   {
       return _getCharString(cls.hdr->superClassName,cls.base);
   }
   
   const char* SCMOClass::getSuperClassName_l(Uint64 & length) const
   {
       length = cls.hdr->superClassName.size;
       if (0 == length)
       {
           return 0;
       }
       else
       {
           length--;
       }
       return _getCharString(cls.hdr->superClassName,cls.base);
   }
   
 void  SCMOClass::getCIMClass(CIMClass& cimClass) const void  SCMOClass::getCIMClass(CIMClass& cimClass) const
 { {
     CIMClass newCimClass(     CIMClass newCimClass(
Line 547 
Line 481 
  
     keyNames.clear();     keyNames.clear();
  
     for (Uint32 i = 0, k = cls.hdr->propertySet.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.
         // The length has to be reduces by 1 not to copy the trailing '\0'          keyNames.append(NEWCIMSTR(nodeArray[i].name,cls.base));
         keyNames.append(  
             String((const char*)_getCharString(nodeArray[i].name,cls.base),  
                    nodeArray[i].name.length-1));  
   
     }     }
 } }
  
Line 599 
Line 529 
         if (nodeArray[node].nameHashTag == tag)         if (nodeArray[node].nameHashTag == tag)
         {         {
             // Now it is worth to compare the two names             // Now it is worth to compare the two names
             if (_equalUTF8Strings(              if (_equalNoCaseUTF8Strings(nodeArray[node].name,cls.base,name,len))
                 nodeArray[node].name,cls.base,name,len))  
             {             {
                 // we found the property !                 // we found the property !
                 return SCMO_OK;                 return SCMO_OK;
Line 655 
Line 584 
         if (nodeArray[node].theProperty.nameHashTag == tag)         if (nodeArray[node].theProperty.nameHashTag == tag)
         {         {
             // Now it is worth to compare the two names             // Now it is worth to compare the two names
             if (_equalUTF8Strings(              if (_equalNoCaseUTF8Strings(
                 nodeArray[node].theProperty.name,cls.base,name,len))                 nodeArray[node].theProperty.name,cls.base,name,len))
             {             {
                 // we found the property !                 // we found the property !
Line 686 
Line 615 
     Uint32 noKeys = 0;     Uint32 noKeys = 0;
     Boolean isKey = false;     Boolean isKey = false;
  
     Uint32 keyIndex[noProps];      Array<Uint32> keyIndex(noProps);
  
     cls.hdr->propertySet.number=noProps;     cls.hdr->propertySet.number=noProps;
  
Line 694 
Line 623 
     startKeyIndexList = _getFreeSpace(     startKeyIndexList = _getFreeSpace(
         cls.hdr->keyIndexList,         cls.hdr->keyIndexList,
         noProps*sizeof(Uint32),         noProps*sizeof(Uint32),
         &cls.mem,          &cls.mem);
         true);  
  
     if(noProps != 0)     if(noProps != 0)
     {     {
Line 709 
Line 637 
         // (68 - 1) / 64 = 1 --> The mask consists of two Uint64 values.         // (68 - 1) / 64 = 1 --> The mask consists of two Uint64 values.
         _getFreeSpace(cls.hdr->keyPropertyMask,         _getFreeSpace(cls.hdr->keyPropertyMask,
               sizeof(Uint64)*(((noProps-1)/64)+1),               sizeof(Uint64)*(((noProps-1)/64)+1),
               &cls.mem,true);                &cls.mem);
  
         // allocate property array and save the start index of the array.         // allocate property array and save the start index of the array.
         start = _getFreeSpace(cls.hdr->propertySet.nodeArray,         start = _getFreeSpace(cls.hdr->propertySet.nodeArray,
                       sizeof(SCMBClassPropertyNode)*noProps,                       sizeof(SCMBClassPropertyNode)*noProps,
                       &cls.mem,true);                        &cls.mem);
  
         // clear the hash table         // clear the hash table
         memset(cls.hdr->propertySet.hashTable,         memset(cls.hdr->propertySet.hashTable,
Line 757 
Line 685 
             // fill the key index list             // fill the key index list
             memcpy(             memcpy(
                 &(cls.base[startKeyIndexList]),                 &(cls.base[startKeyIndexList]),
                 keyIndex,                  keyIndex.getData(),
                 noKeys*sizeof(Uint32));                 noKeys*sizeof(Uint32));
  
             for (Uint32 i = 0 ; i < noKeys; i++)             for (Uint32 i = 0 ; i < noKeys; i++)
Line 774 
Line 702 
         else         else
         {         {
             cls.hdr->keyBindingSet.nodeArray.start=0;             cls.hdr->keyBindingSet.nodeArray.start=0;
             cls.hdr->keyBindingSet.nodeArray.length=0;              cls.hdr->keyBindingSet.nodeArray.size=0;
         }         }
     }     }
     else     else
     {     {
         cls.hdr->propertySet.nodeArray.start=0;         cls.hdr->propertySet.nodeArray.start=0;
         cls.hdr->propertySet.nodeArray.length=0;          cls.hdr->propertySet.nodeArray.size=0;
         cls.hdr->keyPropertyMask.start=0;         cls.hdr->keyPropertyMask.start=0;
         cls.hdr->keyPropertyMask.length=0;          cls.hdr->keyPropertyMask.size=0;
         cls.hdr->keyBindingSet.nodeArray.start=0;         cls.hdr->keyBindingSet.nodeArray.start=0;
         cls.hdr->keyBindingSet.nodeArray.length=0;          cls.hdr->keyBindingSet.nodeArray.size=0;
     }     }
 } }
  
Line 800 
Line 728 
  
     Uint32 *hashTable = cls.hdr->keyBindingSet.hashTable;     Uint32 *hashTable = cls.hdr->keyBindingSet.hashTable;
  
     if ( newIndex >= cls.hdr->keyBindingSet.number)  
     {  
         throw IndexOutOfBoundsException();  
     }  
   
     // 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;
  
Line 856 
Line 779 
  
     Uint32 *hashTable = cls.hdr->propertySet.hashTable;     Uint32 *hashTable = cls.hdr->propertySet.hashTable;
  
     if ( newIndex >= cls.hdr->propertySet.number)  
     {  
         throw IndexOutOfBoundsException();  
     }  
   
     // 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;
Line 1055 
Line 973 
     else     else
     {     {
         scmoPropNode->theProperty.qualifierArray.start=0;         scmoPropNode->theProperty.qualifierArray.start=0;
         scmoPropNode->theProperty.qualifierArray.length=0;          scmoPropNode->theProperty.qualifierArray.size=0;
     }     }
  
     return isKey;     return isKey;
Line 1086 
Line 1004 
     else     else
     {     {
         cls.hdr->qualifierArray.start=0;         cls.hdr->qualifierArray.start=0;
         cls.hdr->qualifierArray.length=0;          cls.hdr->qualifierArray.size=0;
     }     }
 } }
  
Line 1150 
Line 1068 
             // Is set to the number of array members by the function.             // Is set to the number of array members by the function.
             scmoValue->valueArraySize,             scmoValue->valueArraySize,
             cls.hdr->nameSpace.start,             cls.hdr->nameSpace.start,
             cls.hdr->nameSpace.length,              cls.hdr->nameSpace.size,
             rep->u);             rep->u);
     }     }
     else     else
Line 1160 
Line 1078 
             &cls.mem,             &cls.mem,
             rep->type,             rep->type,
             cls.hdr->nameSpace.start,             cls.hdr->nameSpace.start,
             cls.hdr->nameSpace.length,              cls.hdr->nameSpace.size,
             rep->u);             rep->u);
     }     }
 } }
Line 1202 
Line 1120 
        (SCMBClassPropertyNode*)        (SCMBClassPropertyNode*)
            &(cls.base[cls.hdr->propertySet.nodeArray.start]);            &(cls.base[cls.hdr->propertySet.nodeArray.start]);
  
    return(_equalUTF8Strings(     return(_equalNoCaseUTF8Strings(
        nodeArray[node].theProperty.originClassName,        nodeArray[node].theProperty.originClassName,
        cls.base,        cls.base,
        origin,        origin,
Line 1267 
Line 1185 
     inst.base = 0;     inst.base = 0;
 } }
  
 SCMOInstance::SCMOInstance(SCMOClass baseClass)  SCMOInstance::SCMOInstance(SCMOClass& baseClass)
 { {
     _initSCMOInstance(new SCMOClass(baseClass));     _initSCMOInstance(new SCMOClass(baseClass));
 } }
  
 SCMOInstance::SCMOInstance( SCMOInstance::SCMOInstance(
     SCMOClass baseClass,      SCMOClass& baseClass,
     Boolean includeQualifiers,     Boolean includeQualifiers,
     Boolean includeClassOrigin,     Boolean includeClassOrigin,
     const char** propertyList)     const char** propertyList)
Line 1288 
Line 1206 
  
 } }
  
 SCMOInstance::SCMOInstance(SCMOClass baseClass, const CIMObjectPath& cimObj)  SCMOInstance::SCMOInstance(SCMOClass& baseClass, const CIMObjectPath& cimObj)
 { {
     _initSCMOInstance(new SCMOClass(baseClass));     _initSCMOInstance(new SCMOClass(baseClass));
  
     _setCIMObjectPath(cimObj);     _setCIMObjectPath(cimObj);
 } }
  
 SCMOInstance::SCMOInstance(SCMOClass baseClass, const CIMInstance& cimInstance)  SCMOInstance::SCMOInstance(SCMOClass& baseClass, const CIMInstance& cimInstance)
 { {
  
     _initSCMOInstance(new SCMOClass(baseClass));     _initSCMOInstance(new SCMOClass(baseClass));
Line 1304 
Line 1222 
  
 } }
  
   SCMOInstance::SCMOInstance(CIMClass& theCIMClass, const char* altNameSpace)
   {
       _initSCMOInstance(new SCMOClass(theCIMClass,altNameSpace));
  
 void SCMOInstance::_copyExternalReferences()  }
   
   SCMOInstance::SCMOInstance(
       const CIMInstance& cimInstance,
       const char* altNameSpace,
       Uint64 altNSLen)
   {
       SCMOClass theSCMOClass = _getSCMOClass(
           cimInstance._rep->_reference,
           altNameSpace,
           altNSLen);
   
       _initSCMOInstance( new SCMOClass(theSCMOClass));
   
       if(theSCMOClass.isEmpty())
 { {
     // TODO: Has to be optimized not to loop through all props.          // flag the instance as compromized
     // create a pointer to keybinding node array of the class.          inst.hdr->flags.isCompromised=true;
     Uint64 idx = inst.hdr->theClass->cls.hdr->keyBindingSet.nodeArray.start;      }
     SCMBKeyBindingNode* theClassKeyBindNodeArray =      else
         (SCMBKeyBindingNode*)&((inst.hdr->theClass->cls.base)[idx]);      {
           _setCIMInstance(cimInstance);
       }
   }
  
     // create a pointer to instanc key binding array.  SCMOInstance::SCMOInstance(
     SCMBKeyBindingValue* theInstanceKeyBindingNodeArray =      const CIMObject& cimObject,
         (SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]);      const char* altNameSpace,
       Uint64 altNSLen)
   {
       if (cimObject.isClass())
       {
           CIMClass cimClass(cimObject);
  
     for (Uint32 i = 0; i < inst.hdr->numberKeyBindings; i++)          _initSCMOInstance(new SCMOClass(cimClass,altNameSpace));
   
           inst.hdr->flags.isClassOnly=true;
       }
       else
     {     {
         if (theInstanceKeyBindingNodeArray[i].isSet)          CIMInstance cimInstance(cimObject);
   
           SCMOClass theSCMOClass = _getSCMOClass(
               cimInstance._rep->_reference,
               altNameSpace,
               altNSLen);
   
           _initSCMOInstance( new SCMOClass(theSCMOClass));
   
           if(theSCMOClass.isEmpty())
         {         {
             // only references can be a key binding.              // flag the instance as compromized
             if (theClassKeyBindNodeArray[i].type == CIMTYPE_REFERENCE)              inst.hdr->flags.isCompromised=true;
           }
           else
             {             {
                 // Use the copy constructro to ref. count the reference.              _setCIMInstance(cimInstance);
                 // These objects are handeld by the SCMOInstance it sef.          }
                 // No one can modify these instances.  
                 theInstanceKeyBindingNodeArray[i].data.extRefPtr =  
                     new SCMOInstance(  
                         *theInstanceKeyBindingNodeArray[i].data.extRefPtr);  
             }             }
         }         }
     }// for all key bindings defined in the class  
  
     // Are there user defined key bindings ?  SCMOInstance::SCMOInstance(
     if (0 != inst.hdr->numberUserKeyBindindigs)      const CIMObjectPath& cimObj,
       const char* altNameSpace,
       Uint64 altNSLen)
   {
       SCMOClass theSCMOClass = _getSCMOClass(
           cimObj,
           altNameSpace,
           altNSLen);
   
       _initSCMOInstance( new SCMOClass(theSCMOClass));
   
       if(theSCMOClass.isEmpty())
     {     {
         SCMBUserKeyBindingElement* theUserDefKBElement =          // flag the instance as compromized
             (SCMBUserKeyBindingElement*)          inst.hdr->flags.isCompromised=true;
                  &(inst.base[inst.hdr->userKeyBindingElement.start]);      }
       else
       {
           _setCIMObjectPath(cimObj);
       }
   }
   
  
         for(Uint32 i = 0; i < inst.hdr->numberUserKeyBindindigs; i++)  void SCMOInstance::_destroyExternalReferences()
         {         {
             if (theUserDefKBElement->value.isSet)      _destroyExternalReferencesInternal(inst.mem);
   }
   
   SCMOClass SCMOInstance::_getSCMOClass(
       const CIMObjectPath& theCIMObj,
       const char* altNS,
       Uint64 altNSlength)
             {             {
                 // only references can be a key binding.      SCMOClass theClass;
                 if (theUserDefKBElement->type == CIMTYPE_REFERENCE)  
       if (theCIMObj.getClassName().isNull())
                 {                 {
                     // Use the copy constructro to ref. count the reference.          return SCMOClass();
                     // These objects are handeld by the SCMOInstance it sef.  
                     // No one can modify these instances.  
                     theUserDefKBElement->value.data.extRefPtr =  
                         new SCMOInstance(  
                             *theUserDefKBElement->value.data.extRefPtr);  
                 }                 }
   
       if (theCIMObj.getNameSpace().isNull())
       {
           // the name space of the object path is empty,
           // use alternative name space.
           CString clsName = theCIMObj.getClassName().getString().getCString();
   
           SCMOClassCache* theCache = SCMOClassCache::getInstance();
           theClass = theCache->getSCMOClass(
               altNS,
               altNSlength,
               (const char*)clsName,
               strlen(clsName));
       }
       else
       {
           CString nameSpace = theCIMObj.getNameSpace().getString().getCString();
           CString clsName = theCIMObj.getClassName().getString().getCString();
   
           SCMOClassCache* theCache = SCMOClassCache::getInstance();
           theClass = theCache->getSCMOClass(
               (const char*)nameSpace,
               strlen(nameSpace),
               (const char*)clsName,
               strlen(clsName));
             }             }
  
             theUserDefKBElement =      return theClass;
                 (SCMBUserKeyBindingElement*)  
                      &(inst.base[theUserDefKBElement->nextElement.start]);  
         } // for all user def. key bindings.  
     }     }
  
     SCMBValue* theInstPropArray =  #define PEGASUS_SIZE_REFERENCE_INDEX_ARRAY 8
         (SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]);  
  
     for (Uint32 i = 0; i < inst.hdr->numberProperties; i++)  void SCMOInstance::_setExtRefIndex(SCMBUnion* pInst, SCMBMgmt_Header** pmem)
     {     {
         // was the property set by the provider ?  
         if(theInstPropArray[i].flags.isSet)      Uint64 refPtr =(((char *)pInst) - (char *)(*pmem));
       SCMBMgmt_Header* memHdr = (*pmem);
       // Save the number of external references in the array
       Uint32 noExtRef = memHdr->numberExtRef;
   
       // Allocate the external reflerence array
       // if it is full or empty ( 0 == 0 ).
       if (noExtRef == memHdr->sizeExtRefIndexArray)
         {         {
             // is the property type reference,instance or object?          Uint64 oldArrayStart = memHdr->extRefIndexArray.start;
             if (theInstPropArray[i].valueType == CIMTYPE_REFERENCE ||          Uint32 newSize =
                 theInstPropArray[i].valueType == CIMTYPE_OBJECT ||              memHdr->sizeExtRefIndexArray + PEGASUS_SIZE_REFERENCE_INDEX_ARRAY;
                 theInstPropArray[i].valueType == CIMTYPE_INSTANCE )  
           // Allocate the external reference index array
           _getFreeSpace(
                 memHdr->extRefIndexArray,
                 sizeof(Uint64)*newSize,
                 pmem);
   
           // reset the pointer. It could be changed due to reallocation !
           memHdr = (*pmem);
   
           // Assign new size.
           memHdr->sizeExtRefIndexArray=newSize;
   
           // Get absolute pointer to old index array.
           Uint64* oldArray = (Uint64*)&(((char*)(*pmem))[oldArrayStart]);
           // Get absolute pointer to new index array
           Uint64* newArray =
               (Uint64*)&(((char*)(*pmem))[memHdr->extRefIndexArray.start]);
   
           // Copy all elements of the old array to the new.
           // If noExtRef = 0, no elements are copied.
           for (Uint32 i = 0 ; i < noExtRef ; i++)
             {             {
                 if (theInstPropArray[i].flags.isArray)              newArray[i] = oldArray[i];
           }
       }
   
       // Get absolute pointer to the array
       Uint64* array =
           (Uint64*)&(((char*)(*pmem))[memHdr->extRefIndexArray.start]);
       // look in the table if the index is already in the array
       for (Uint32 i = 0 ; i < noExtRef ; i++)
                 {                 {
                     _copyArrayExtReference(          // is the index already part of the array
                         theInstPropArray[i].value.arrayValue,          if (array[i] == refPtr)
                         &inst.mem);          {
               // leave.
               return;
                 }                 }
                 else      }
       // It is not part of the array -> set the new index.
       array[noExtRef] = refPtr;
       // increment the nuber of external references of this instance.
       memHdr->numberExtRef++;
   
   }
   
   SCMOInstance* SCMOInstance::getExtRef(Uint32 idx)
                 {                 {
                     theInstPropArray[i].value.extRefPtr =      Uint64* array =
                         new SCMOInstance(*theInstPropArray[i].value.extRefPtr);          (Uint64*)&(inst.base[inst.mem->extRefIndexArray.start]);
                 } // end is arry      SCMBUnion* pUnion;
             } // end is reference      pUnion = (SCMBUnion*)(&(inst.base[array[idx]]));
         }// end is set      return pUnion->extRefPtr;
     } // for all properties.  
 } }
  
 void SCMOInstance::_destroyExternalReferences()  void SCMOInstance::putExtRef(Uint32 idx,SCMOInstance* ptr)
 { {
     // TODO: Has to be optimized not to loop through all props.      Uint64* array =
     // create a pointer to keybinding node array of the class.          (Uint64*)&(inst.base[inst.mem->extRefIndexArray.start]);
       SCMBUnion* pUnion;
       pUnion = (SCMBUnion*)(&(inst.base[array[idx]]));
       pUnion->extRefPtr = ptr;
   }
   
   void SCMOInstance::_copyExternalReferences()
   {
       Uint32 number = inst.mem->numberExtRef;
   
       if (0 != number)
       {
           SCMBUnion* pUnion;
           Uint64* array =
               (Uint64*)&(inst.base[inst.mem->extRefIndexArray.start]);
           for (Uint32 i = 0; i < number; i++)
           {
               pUnion = (SCMBUnion*)(&(inst.base[array[i]]));
               if (0 != pUnion)
               {
                   pUnion->extRefPtr = new SCMOInstance(*(pUnion->extRefPtr));
               }
           }
   
       }
   
   }
   
   void SCMOInstance::_destroyExternalKeyBindings()
   {
       // 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->cls.hdr->keyBindingSet.nodeArray.start;
     SCMBKeyBindingNode* theClassKeyBindNodeArray =     SCMBKeyBindingNode* theClassKeyBindNodeArray =
         (SCMBKeyBindingNode*)&((inst.hdr->theClass->cls.base)[idx]);         (SCMBKeyBindingNode*)&((inst.hdr->theClass->cls.base)[idx]);
Line 1417 
Line 1485 
     }// for all key bindings     }// for all key bindings
  
     // Are there user defined key bindings ?     // Are there user defined key bindings ?
     if (0 != inst.hdr->numberUserKeyBindindigs)      if (0 != inst.hdr->numberUserKeyBindings)
     {     {
         SCMBUserKeyBindingElement* theUserDefKBElement =         SCMBUserKeyBindingElement* theUserDefKBElement =
             (SCMBUserKeyBindingElement*)             (SCMBUserKeyBindingElement*)
                  &(inst.base[inst.hdr->userKeyBindingElement.start]);                  &(inst.base[inst.hdr->userKeyBindingElement.start]);
  
         for(Uint32 i = 0; i < inst.hdr->numberUserKeyBindindigs; i++)          for(Uint32 i = 0; i < inst.hdr->numberUserKeyBindings; i++)
         {         {
             if (theUserDefKBElement->value.isSet)             if (theUserDefKBElement->value.isSet)
             {             {
Line 1439 
Line 1507 
                      &(inst.base[theUserDefKBElement->nextElement.start]);                      &(inst.base[theUserDefKBElement->nextElement.start]);
         } // for all user def. key bindings.         } // for all user def. key bindings.
     }     }
   
     SCMBValue* theInstPropArray =  
         (SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]);  
   
     for (Uint32 i = 0; i < inst.hdr->numberProperties; i++)  
     {  
         // was the property set by the provider ?  
         if(theInstPropArray[i].flags.isSet)  
         {  
             // is the property type reference,instance or object?  
             if (theInstPropArray[i].valueType == CIMTYPE_REFERENCE ||  
                 theInstPropArray[i].valueType == CIMTYPE_OBJECT ||  
                 theInstPropArray[i].valueType == CIMTYPE_INSTANCE )  
             {  
                 if (theInstPropArray[i].flags.isArray)  
                 {  
                     _deleteArrayExtReference(  
                         theInstPropArray[i].value.arrayValue,  
                         &inst.mem);  
                 }  
                 else  
                 {  
                     delete theInstPropArray[i].value.extRefPtr;  
                 } // end is arry  
             } // end is reference  
         }// end is set  
     } // for all properties.  
 } }
  
 SCMO_RC SCMOInstance::getCIMInstance(CIMInstance& cimInstance) const SCMO_RC SCMOInstance::getCIMInstance(CIMInstance& cimInstance) const
Line 1587 
Line 1628 
     }     }
  
     // Are there user defined key bindings ?     // Are there user defined key bindings ?
     if (0 != inst.hdr->numberUserKeyBindindigs)      if (0 != inst.hdr->numberUserKeyBindings)
     {     {
         SCMBUserKeyBindingElement* theUserDefKBElement =         SCMBUserKeyBindingElement* theUserDefKBElement =
             (SCMBUserKeyBindingElement*)             (SCMBUserKeyBindingElement*)
                  &(inst.base[inst.hdr->userKeyBindingElement.start]);                  &(inst.base[inst.hdr->userKeyBindingElement.start]);
  
         for(Uint32 i = 0; i < inst.hdr->numberUserKeyBindindigs; i++)          for(Uint32 i = 0; i < inst.hdr->numberUserKeyBindings; i++)
         {         {
             if (theUserDefKBElement->value.isSet)             if (theUserDefKBElement->value.isSet)
             {             {
Line 1645 
Line 1686 
     SCMBValue& instValue =     SCMBValue& instValue =
         ((SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]))[nodeIdx];         ((SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]))[nodeIdx];
  
       if (instValue.flags.isSet)
       {
     _getCIMValueFromSCMBValue(theValue,instValue,inst.base);     _getCIMValueFromSCMBValue(theValue,instValue,inst.base);
       }
       else
       {
           _getCIMValueFromSCMBValue(
               theValue,
               clsProp.theProperty.defaultValue,
               clsbase);
       }
   
  
  
     if (inst.hdr->flags.includeClassOrigin)     if (inst.hdr->flags.includeClassOrigin)
Line 1905 
Line 1957 
                 Array<Char16> x;                 Array<Char16> x;
                 for (Uint32 i = 0, k = arraySize; i < k ; i++)                 for (Uint32 i = 0, k = arraySize; i < k ; i++)
                 {                 {
                     x.append(pscmbArrayUn[i].simple.val.c16);                      x.append(Char16(pscmbArrayUn[i].simple.val.c16));
                 }                 }
                 cimV.set(x);                 cimV.set(x);
             }             }
             else             else
             {             {
                 cimV.set(scmbUn.simple.val.c16);                  cimV.set(Char16(scmbUn.simple.val.c16));
             }             }
             break;             break;
         }         }
Line 2137 
Line 2189 
 void SCMOInstance::_setCIMObjectPath(const CIMObjectPath& cimObj) void SCMOInstance::_setCIMObjectPath(const CIMObjectPath& cimObj)
 { {
     CIMObjectPathRep* objRep = cimObj._rep;     CIMObjectPathRep* objRep = cimObj._rep;
     SCMO_RC rc;  
  
     CString className = objRep->_className.getString().getCString();     CString className = objRep->_className.getString().getCString();
  
Line 2158 
Line 2209 
     for (Uint32 i = 0, k = objRep->_keyBindings.size(); i < k; i++)     for (Uint32 i = 0, k = objRep->_keyBindings.size(); i < k; i++)
     {     {
         String key = objRep->_keyBindings[i].getValue();         String key = objRep->_keyBindings[i].getValue();
         rc = _setKeyBindingFromString(          _setKeyBindingFromString(
             (const char*)             (const char*)
                 objRep->_keyBindings[i].getName().getString().getCString(),                 objRep->_keyBindings[i].getName().getString().getCString(),
             _CIMTypeFromKeyBindingType(             _CIMTypeFromKeyBindingType(
                 (const char*)key.getCString(),                 (const char*)key.getCString(),
                 objRep->_keyBindings[i].getType()),                 objRep->_keyBindings[i].getType()),
             key);             key);
   
         if (rc != SCMO_OK)  
         {  
                String message("Can not set CIMObjectPath key binding:'");  
                message.append(  
                    objRep->_keyBindings[i].getName().getString());  
                message.append("'");  
                throw CIMException(CIM_ERR_FAILED, message);  
         }  
     }     }
  
 } }
Line 2210 
Line 2252 
             // Is set to the number of array members by the function.             // Is set to the number of array members by the function.
             theInstProp.valueArraySize,             theInstProp.valueArraySize,
             inst.hdr->instNameSpace.start,             inst.hdr->instNameSpace.start,
             inst.hdr->instNameSpace.length,              inst.hdr->instNameSpace.size,
             valRep->u);             valRep->u);
     }     }
     else     else
Line 2220 
Line 2262 
             &inst.mem,             &inst.mem,
             realType,             realType,
             inst.hdr->instNameSpace.start,             inst.hdr->instNameSpace.start,
             inst.hdr->instNameSpace.length,              inst.hdr->instNameSpace.size,
             valRep->u);             valRep->u);
     }     }
 } }
Line 2239 
Line 2281 
     {     {
  
         len = strlen((const char*)hostName);         len = strlen((const char*)hostName);
         if(len != 0)  
         {  
   
             // copy including trailing '\0'             // copy including trailing '\0'
             _setBinary(hostName,len+1,inst.hdr->hostName,&inst.mem);             _setBinary(hostName,len+1,inst.hdr->hostName,&inst.mem);
             return;             return;
         }  
  
     }     }
     inst.hdr->hostName.start=0;     inst.hdr->hostName.start=0;
     inst.hdr->hostName.length=0;      inst.hdr->hostName.size=0;
   }
   
   void SCMOInstance::setHostName_l(const char* hostName, Uint64 len)
   {
       // copy including trailing '\0'
       _setBinary(hostName,len+1,inst.hdr->hostName,&inst.mem);
 } }
  
 const char* SCMOInstance::getHostName() const const char* SCMOInstance::getHostName() const
Line 2259 
Line 2303 
  
 const char* SCMOInstance::getHostName_l(Uint64& length) const const char* SCMOInstance::getHostName_l(Uint64& length) const
 { {
     length = inst.hdr->hostName.length;      length = inst.hdr->hostName.size;
       if (0 == length)
       {
           return 0;
       }
       else
       {
           length--;
       }
     return _getCharString(inst.hdr->hostName,inst.base);     return _getCharString(inst.hdr->hostName,inst.base);
 } }
  
 void SCMOInstance::setClassName(const char* className) void SCMOInstance::setClassName(const char* className)
 { {
     Uint32 len;      Uint32 len=0;
       // flag the instance as compromized
       inst.hdr->flags.isCompromised=true;
     if (className!=0)     if (className!=0)
     {     {
   
         len = strlen((const char*)className);         len = strlen((const char*)className);
         if(len != 0)      }
         {  
   
             // copy including trailing '\0'             // copy including trailing '\0'
       // _setBinary also sets the name to 0 if either className==0 or len+1==1
             _setBinary(className,len+1,inst.hdr->instClassName,&inst.mem);             _setBinary(className,len+1,inst.hdr->instClassName,&inst.mem);
             return;  
         }         }
  
     }  void SCMOInstance::setClassName_l(const char* className, Uint64 len)
   {
     inst.hdr->instClassName.start=0;      // flag the instance as compromised
     inst.hdr->instClassName.length=0;  
   
     // flag the instance as compromized  
     inst.hdr->flags.isCompromised=true;     inst.hdr->flags.isCompromised=true;
       // copy including trailing '\0'
       // _setBinary also sets the name to 0 if either className==0 or len+1==1
       _setBinary(className,len+1,inst.hdr->instClassName,&inst.mem);
 } }
  
 const char* SCMOInstance::getClassName() const const char* SCMOInstance::getClassName() const
Line 2296 
Line 2345 
  
 const char* SCMOInstance::getClassName_l(Uint64 & length) const const char* SCMOInstance::getClassName_l(Uint64 & length) const
 { {
     length = inst.hdr->instClassName.length;      length = inst.hdr->instClassName.size;
       if (0 == length)
       {
           return 0;
       }
       else
       {
           length--;
       }
     return _getCharString(inst.hdr->instClassName,inst.base);     return _getCharString(inst.hdr->instClassName,inst.base);
 } }
  
Line 2304 
Line 2361 
 { {
     Uint32 len;     Uint32 len;
  
       // flag the instance as compromized
       inst.hdr->flags.isCompromised=true;
   
     if (nameSpace!=0)     if (nameSpace!=0)
     {     {
  
         len = strlen((const char*)nameSpace);         len = strlen((const char*)nameSpace);
         if(len != 0)  
         {  
   
             // copy including trailing '\0'             // copy including trailing '\0'
             _setBinary(nameSpace,len+1,inst.hdr->instNameSpace,&inst.mem);             _setBinary(nameSpace,len+1,inst.hdr->instNameSpace,&inst.mem);
             return;             return;
         }         }
   
     }  
   
     inst.hdr->instNameSpace.start=0;     inst.hdr->instNameSpace.start=0;
     inst.hdr->instNameSpace.length=0;      inst.hdr->instNameSpace.size=0;
   }
  
   void SCMOInstance::setNameSpace_l(const char* nameSpace, Uint64 len)
   {
     // flag the instance as compromized     // flag the instance as compromized
     inst.hdr->flags.isCompromised=true;     inst.hdr->flags.isCompromised=true;
       // copy including trailing '\0'
       _setBinary(nameSpace,len+1,inst.hdr->instNameSpace,&inst.mem);
 } }
  
 const char* SCMOInstance::getNameSpace() const const char* SCMOInstance::getNameSpace() const
Line 2333 
Line 2391 
  
 const char* SCMOInstance::getNameSpace_l(Uint64 & length) const const char* SCMOInstance::getNameSpace_l(Uint64 & length) const
 { {
     length = inst.hdr->instNameSpace.length;      length = inst.hdr->instNameSpace.size;
       if (0 == length)
       {
           return 0;
       }
       else
       {
           length--;
       }
     return _getCharString(inst.hdr->instNameSpace,inst.base);     return _getCharString(inst.hdr->instNameSpace,inst.base);
 } }
  
Line 2355 
Line 2421 
         // because in _setKeyBindingFromSCMBUnion()         // because in _setKeyBindingFromSCMBUnion()
         // a reallocation can take place.         // a reallocation can take place.
         theKeyBindValueArray =         theKeyBindValueArray =
            (SCMBKeyBindingValue*)&inst.base[inst.hdr->keyBindingArray.start];             (SCMBKeyBindingValue*)&(inst.base[inst.hdr->keyBindingArray.start]);
  
         theInstPropNodeArray =         theInstPropNodeArray =
             (SCMBValue*)&inst.base[inst.hdr->propertyArray.start];             (SCMBValue*)&inst.base[inst.hdr->propertyArray.start];
Line 2366 
Line 2432 
             // get the node index for this key binding form class             // get the node index for this key binding form class
             propNode = theClassKeyPropList[i];             propNode = theClassKeyPropList[i];
  
             // if property was not set by the provider or it is null.              // if property was set by the provider and it is not null.
             if (!theInstPropNodeArray[propNode].flags.isSet ||              if ( theInstPropNodeArray[propNode].flags.isSet &&
                  theInstPropNodeArray[propNode].flags.isNull)                  !theInstPropNodeArray[propNode].flags.isNull)
             {              {
                 const char * propName =  
                     inst.hdr->theClass->_getPropertyNameAtNode(propNode);  
                 throw NoSuchProperty(String(propName));  
             }  
   
             _setKeyBindingFromSCMBUnion(             _setKeyBindingFromSCMBUnion(
                 theInstPropNodeArray[propNode].valueType,                 theInstPropNodeArray[propNode].valueType,
                 theInstPropNodeArray[propNode].value,                 theInstPropNodeArray[propNode].value,
Line 2383 
Line 2444 
         }         }
     }     }
 } }
   }
  
 void SCMOInstance::_setKeyBindingFromSCMBUnion( void SCMOInstance::_setKeyBindingFromSCMBUnion(
     CIMType type,     CIMType type,
Line 2404 
Line 2466 
     case CIMTYPE_REAL64:     case CIMTYPE_REAL64:
     case CIMTYPE_CHAR16:     case CIMTYPE_CHAR16:
     case CIMTYPE_BOOLEAN:     case CIMTYPE_BOOLEAN:
           {
               memcpy(&keyData.data,&u,sizeof(SCMBUnion));
               keyData.data.simple.hasValue=true;
               keyData.isSet=true;
               break;
           }
     case CIMTYPE_DATETIME:     case CIMTYPE_DATETIME:
         {         {
             memcpy(&keyData.data,&u,sizeof(SCMBUnion));             memcpy(&keyData.data,&u,sizeof(SCMBUnion));
Line 2415 
Line 2483 
             keyData.isSet=true;             keyData.isSet=true;
             _setBinary(             _setBinary(
                 &uBase[u.stringValue.start],                 &uBase[u.stringValue.start],
                 u.stringValue.length,                  u.stringValue.size,
                 keyData.data.stringValue,                 keyData.data.stringValue,
                 &inst.mem);                 &inst.mem);
             break;             break;
Line 2430 
Line 2498 
             if(u.extRefPtr)             if(u.extRefPtr)
             {             {
                 keyData.data.extRefPtr = new SCMOInstance(*u.extRefPtr);                 keyData.data.extRefPtr = new SCMOInstance(*u.extRefPtr);
                   keyData.isSet=true;
                   // This function can cause a reallocation !
                   // Pointers can be invalid after the call.
                   _setExtRefIndex(&(keyData.data),&inst.mem);
             }             }
             else             else
             {             {
                   keyData.isSet=true;
                 keyData.data.extRefPtr=0;                 keyData.data.extRefPtr=0;
             }             }
             keyData.isSet=true;  
             break;             break;
         }         }
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
Line 2486 
Line 2558 
     _setBinary(     _setBinary(
         _getCharString(inst.hdr->theClass->cls.hdr->className,         _getCharString(inst.hdr->theClass->cls.hdr->className,
                        inst.hdr->theClass->cls.base),                        inst.hdr->theClass->cls.base),
         inst.hdr->theClass->cls.hdr->className.length,          inst.hdr->theClass->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->cls.hdr->nameSpace,
                        inst.hdr->theClass->cls.base),                        inst.hdr->theClass->cls.base),
         inst.hdr->theClass->cls.hdr->nameSpace.length,          inst.hdr->theClass->cls.hdr->nameSpace.size,
         inst.hdr->instNameSpace,         inst.hdr->instNameSpace,
         &inst.mem);         &inst.mem);
  
Line 2509 
Line 2581 
     _getFreeSpace(     _getFreeSpace(
           inst.hdr->keyBindingArray,           inst.hdr->keyBindingArray,
           sizeof(SCMBKeyBindingValue)*inst.hdr->numberKeyBindings,           sizeof(SCMBKeyBindingValue)*inst.hdr->numberKeyBindings,
           &inst.mem,            &inst.mem);
           true);  
  
     // Allocate the SCMBInstancePropertyArray     // Allocate the SCMBInstancePropertyArray
     _getFreeSpace(     _getFreeSpace(
         inst.hdr->propertyArray,         inst.hdr->propertyArray,
         sizeof(SCMBValue)*inst.hdr->numberProperties,         sizeof(SCMBValue)*inst.hdr->numberProperties,
         &inst.mem,          &inst.mem);
         true);  
  
 } }
  
Line 2664 
Line 2734 
     return  _getPropertyAtNodeIndex(node,pname,type,pOutVal,isArray,size);     return  _getPropertyAtNodeIndex(node,pname,type,pOutVal,isArray,size);
 } }
  
 SCMO_RC SCMOInstance::getPropertyAt(  
     Uint32 pos,  
     SCMBValue** value,  
     const char ** valueBase,  
     SCMBClassProperty ** propDef) const  
 {  
     Uint32 node;  
     // is filtering on ?  
     if (inst.hdr->flags.isFiltered)  
     {  
         // check the number of properties part of the filter  
         if (pos >= 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.  
         node = propertyFilterIndexMap[pos];  
     }  
     else  
     {  
         // the index is used as node index.  
         node = pos;  
         if (node >= inst.hdr->numberProperties)  
         {  
             return SCMO_INDEX_OUT_OF_BOUND;  
         }  
     }  
   
     SCMBValue* theInstPropNodeArray =  
         (SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]);  
   
     // create a pointer to property node array of the class.  
     Uint64 idx = inst.hdr->theClass->cls.hdr->propertySet.nodeArray.start;  
     SCMBClassPropertyNode* theClassPropNodeArray =  
         (SCMBClassPropertyNode*)&(inst.hdr->theClass->cls.base)[idx];  
   
     // return the absolute pointer to the property definition  
     *propDef= &(theClassPropNodeArray[node].theProperty);  
   
     // need check if property set or not, if not set use the default value  
     if (theInstPropNodeArray[node].flags.isSet)  
     {  
         // return the absolute pointer to the property value in the instance  
         *value = &(theInstPropNodeArray[node]);  
         *valueBase = inst.base;  
     }  
     else  
     {  
         // return the absolute pointer to  
         *value = &(theClassPropNodeArray[node].theProperty.defaultValue);  
         *valueBase = inst.hdr->theClass->cls.base;  
     }  
   
     return SCMO_OK;  
 }  
   
   
 SCMO_RC SCMOInstance::getPropertyNodeIndex(const char* name, Uint32& node) const SCMO_RC SCMOInstance::getPropertyNodeIndex(const char* name, Uint32& node) const
 { {
     SCMO_RC rc;     SCMO_RC rc;
Line 2890 
Line 2898 
     case CIMTYPE_REAL32:     case CIMTYPE_REAL32:
     case CIMTYPE_REAL64:     case CIMTYPE_REAL64:
     case CIMTYPE_CHAR16:     case CIMTYPE_CHAR16:
           {
               if (isArray)
               {
                   _setBinary(pInVal,size*sizeof(SCMBUnion),
                              u.arrayValue,
                              &inst.mem );
               }
               else
               {
                   memcpy(&u,pInVal,sizeof(SCMBUnion));
                   u.simple.hasValue=true;
               }
               break;
           }
     case CIMTYPE_DATETIME:     case CIMTYPE_DATETIME:
         {         {
             if (isArray)             if (isArray)
Line 2901 
Line 2923 
             else             else
             {             {
                 memcpy(&u,pInVal,sizeof(SCMBUnion));                 memcpy(&u,pInVal,sizeof(SCMBUnion));
   
             }             }
             break;             break;
         }         }
Line 2914 
Line 2937 
                 startPtr = _getFreeSpace(                 startPtr = _getFreeSpace(
                     u.arrayValue,                     u.arrayValue,
                     size*sizeof(SCMBUnion),                     size*sizeof(SCMBUnion),
                     &inst.mem,true);                      &inst.mem);
  
                 for (Uint32 i = 0; i < size; i++)                 for (Uint32 i = 0; i < size; i++)
                 {                 {
Line 2955 
Line 2978 
                 startPtr = _getFreeSpace(                 startPtr = _getFreeSpace(
                     u.arrayValue,                     u.arrayValue,
                     size*sizeof(SCMBUnion),                     size*sizeof(SCMBUnion),
                     &inst.mem,false);                      &inst.mem);
  
                 ptr = (SCMBUnion*)&(inst.base[startPtr]);                 ptr = (SCMBUnion*)&(inst.base[startPtr]);
  
Line 2965 
Line 2988 
                     {                     {
                         ptr[i].extRefPtr=                         ptr[i].extRefPtr=
                             new SCMOInstance(*(pInVal[i].extRefPtr));                             new SCMOInstance(*(pInVal[i].extRefPtr));
   
                           // This function can cause a reallocation !
                           // Pointers can be invalid after the call.
                           _setExtRefIndex(&(ptr[i]),&inst.mem);
                     }                     }
                     else                     else
                     {                     {
Line 2983 
Line 3010 
                 if(pInVal->extRefPtr)                 if(pInVal->extRefPtr)
                 {                 {
                     u.extRefPtr = new SCMOInstance(*(pInVal->extRefPtr));                     u.extRefPtr = new SCMOInstance(*(pInVal->extRefPtr));
                       // This function can cause a reallocation !
                       // Pointers can be invalid after the call.
                       _setExtRefIndex(&u,&inst.mem);
   
                 }                 }
                 else                 else
                 {                 {
Line 3005 
Line 3036 
     CIMType type,     CIMType type,
     Uint32& n,     Uint32& n,
     Uint64 startNS,     Uint64 startNS,
     Uint64 lenNS,      Uint64 sizeNS,
     Union& u)     Union& u)
 { {
     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);
Line 3023 
Line 3054 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Boolean> iterator(*x);             ConstArrayIterator<Boolean> iterator(*x);
  
Line 3045 
Line 3075 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Uint8> iterator(*x);             ConstArrayIterator<Uint8> iterator(*x);
  
Line 3067 
Line 3096 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Sint8> iterator(*x);             ConstArrayIterator<Sint8> iterator(*x);
  
Line 3089 
Line 3117 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Uint16> iterator(*x);             ConstArrayIterator<Uint16> iterator(*x);
  
Line 3111 
Line 3138 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Sint16> iterator(*x);             ConstArrayIterator<Sint16> iterator(*x);
  
Line 3133 
Line 3159 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Uint32> iterator(*x);             ConstArrayIterator<Uint32> iterator(*x);
  
Line 3155 
Line 3180 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Sint32> iterator(*x);             ConstArrayIterator<Sint32> iterator(*x);
  
Line 3177 
Line 3201 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Uint64> iterator(*x);             ConstArrayIterator<Uint64> iterator(*x);
  
Line 3199 
Line 3222 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Sint64> iterator(*x);             ConstArrayIterator<Sint64> iterator(*x);
  
Line 3221 
Line 3243 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Real32> iterator(*x);             ConstArrayIterator<Real32> iterator(*x);
  
Line 3243 
Line 3264 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Real64> iterator(*x);             ConstArrayIterator<Real64> iterator(*x);
  
Line 3265 
Line 3285 
             arrayStart = _getFreeSpace(             arrayStart = _getFreeSpace(
                 scmoUnion->arrayValue,                 scmoUnion->arrayValue,
                 loop*sizeof(SCMBUnion),                 loop*sizeof(SCMBUnion),
                 pmem,                  pmem);
                 true);  
  
             ConstArrayIterator<Char16> iterator(*x);             ConstArrayIterator<Char16> iterator(*x);
  
Line 3348 
Line 3367 
  
             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++)
             {             {
  
                 theRefClass = _getSCMOClass(                  ptargetUnion[i].extRefPtr =
                       new SCMOInstance(
                     iterator[i],                     iterator[i],
                     &(((const char*)*pmem)[startNS]),                     &(((const char*)*pmem)[startNS]),
                     lenNS);                          sizeNS-1);
                   // Was the conversion successful?
                 if (theRefClass != 0)                  if (ptargetUnion[i].extRefPtr->isEmpty())
                 {                 {
                     ptargetUnion[i].extRefPtr =                      // N0, delete the SCMOInstance.
                         new SCMOInstance(*theRefClass,iterator[i]);                      delete ptargetUnion[i].extRefPtr;
                 } else  
                 {  
                     //There is no reference class for the object path  
                     ptargetUnion[i].extRefPtr = 0;                     ptargetUnion[i].extRefPtr = 0;
                 }                 }
                   else
                   {
                       _setExtRefIndex(&(ptargetUnion[i]),pmem);
                   }
             }             }
  
             break;             break;
Line 3405 
Line 3424 
                     if (iterator[i].isClass())                     if (iterator[i].isClass())
                     {                     {
                         CIMClass theClass(iterator[i]);                         CIMClass theClass(iterator[i]);
                         ptargetUnion[i].extRefPtr = new SCMOInstance(theClass);  
                           ptargetUnion[i].extRefPtr =
                               new SCMOInstance(
                                   theClass,
                                   (&((const char*)*pmem)[startNS]));
                         // marke as class only !                         // marke as class only !
                         ptargetUnion[i].extRefPtr->                         ptargetUnion[i].extRefPtr->
                             inst.hdr->flags.isClassOnly=true;                             inst.hdr->flags.isClassOnly=true;
   
                           // This function can cause a reallocation !
                           // Pointers can be invalid after the call.
                           _setExtRefIndex(&(ptargetUnion[i]),pmem);
                     }                     }
                     else                     else
                     {                     {
                         CIMInstance theInst(iterator[i]);                         CIMInstance theInst(iterator[i]);
                         theRefClass = _getSCMOClass(  
                             theInst.getPath(),  
                             &(((const char*)*pmem)[startNS]),  
                             lenNS);  
  
                         if (theRefClass != 0)  
                         {  
                             ptargetUnion[i].extRefPtr =                             ptargetUnion[i].extRefPtr =
                                 new SCMOInstance(*theRefClass,theInst);                              new SCMOInstance(
                         } else                                  theInst,
                                   &(((const char*)*pmem)[startNS]),
                                   sizeNS-1);
                            // Was the conversion successful?
                            if (ptargetUnion[i].extRefPtr->isEmpty())
                         {                         {
                             //There is no reference class for the object path                               // N0, delete the SCMOInstance.
                                delete ptargetUnion[i].extRefPtr;
                             ptargetUnion[i].extRefPtr = 0;                             ptargetUnion[i].extRefPtr = 0;
                         }                         }
                            else
                            {
                                // This function can cause a reallocation !
                                // Pointers can be invalid after the call.
                                _setExtRefIndex(&(ptargetUnion[i]),pmem);
                            }
                     }                     }
                 }                 }
             }             }
Line 3454 
Line 3485 
  
             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 3465 
Line 3494 
                 }                 }
                 else                 else
                 {                 {
                     theRefClass = _getSCMOClass(  
                         iterator[i].getPath(),  
                         &(((const char*)*pmem)[startNS]),  
                         lenNS);  
   
   
                     if (theRefClass != 0)  
                     {  
                         ptargetUnion[i].extRefPtr =                         ptargetUnion[i].extRefPtr =
                             new SCMOInstance(*theRefClass,iterator[i]);                          new SCMOInstance(
                     } else                              iterator[i],
                               &(((const char*)*pmem)[startNS]),
                               sizeNS-1);
                       // Was the conversion successful?
                       if (ptargetUnion[i].extRefPtr->isEmpty())
                     {                     {
                         //There is no reference class for the object path                          // N0, delete the SCMOInstance.
                           delete ptargetUnion[i].extRefPtr;
                         ptargetUnion[i].extRefPtr = 0;                         ptargetUnion[i].extRefPtr = 0;
                     }                     }
                       else
                       {
                           // This function can cause a reallocation !
                           // Pointers can be invalid after the call.
                           _setExtRefIndex(&(ptargetUnion[i]),pmem);
                       }
   
                 }                 }
             }             }
  
Line 3499 
Line 3532 
     SCMBMgmt_Header** pmem,     SCMBMgmt_Header** pmem,
     CIMType type,     CIMType type,
     Uint64 startNS,     Uint64 startNS,
     Uint64 lenNS,      Uint64 sizeNS,
     Union& u)     Union& u)
 { {
     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);     SCMBUnion* scmoUnion = (SCMBUnion*)&(((char*)*pmem)[start]);
Line 3624 
Line 3657 
             CIMObjectPath* theCIMObj =             CIMObjectPath* theCIMObj =
                 (CIMObjectPath*)((void*)&u._referenceValue);                 (CIMObjectPath*)((void*)&u._referenceValue);
  
             SCMOClass* theRefClass = _getSCMOClass(              scmoUnion->extRefPtr =
                   new SCMOInstance(
                 *theCIMObj,                 *theCIMObj,
                 &(((const char*)*pmem)[startNS]),                 &(((const char*)*pmem)[startNS]),
                 lenNS);                      sizeNS-1);
  
             if (theRefClass != 0)              // Was the conversion successful?
             {              if (scmoUnion->extRefPtr->isEmpty())
                 scmoUnion->extRefPtr =  
                     new SCMOInstance(*theRefClass,*theCIMObj);  
             } else  
             {             {
                 //There is no reference class for the object path                  // N0, delete the SCMOInstance.
                   delete scmoUnion->extRefPtr;
                 scmoUnion->extRefPtr = 0;                 scmoUnion->extRefPtr = 0;
             }             }
               else
               {
                   // This function can cause a reallocation !
                   // Pointers can be invalid after the call.
                   _setExtRefIndex(scmoUnion,pmem);
               }
   
             break;             break;
         }         }
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
Line 3667 
Line 3706 
                 if (theCIMObject->isClass())                 if (theCIMObject->isClass())
                 {                 {
                     CIMClass theClass(*theCIMObject);                     CIMClass theClass(*theCIMObject);
                     scmoUnion->extRefPtr = new SCMOInstance(theClass);  
                       scmoUnion->extRefPtr =
                           new SCMOInstance(
                               theClass,
                               (&((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;
   
                       // This function can cause a reallocation !
                       // Pointers can be invalid after the call.
                       _setExtRefIndex(scmoUnion,pmem);
                 }                 }
                 else                 else
                 {                 {
                     CIMInstance theInst(*theCIMObject);                      CIMInstance theCIMInst(*theCIMObject);
                     theRefClass = _getSCMOClass(  
                         theInst.getPath(),  
                         &(((const char*)*pmem)[startNS]),  
                         lenNS);  
  
                     if (theRefClass != 0)  
                     {  
                         scmoUnion->extRefPtr =                         scmoUnion->extRefPtr =
                             new SCMOInstance(*theRefClass,theInst);                          new SCMOInstance(
                     } else                              theCIMInst,
                               &(((const char*)*pmem)[startNS]),
                               sizeNS-1);
   
                        // Was the conversion successful?
                        if (scmoUnion->extRefPtr->isEmpty())
                     {                     {
                         //There is no reference class for the object path                           // N0, delete the SCMOInstance.
                            delete scmoUnion->extRefPtr;
                         scmoUnion->extRefPtr = 0;                         scmoUnion->extRefPtr = 0;
                     }                     }
                        else
                        {
                            // This function can cause a reallocation !
                            // Pointers can be invalid after the call.
                            _setExtRefIndex(scmoUnion,pmem);
                        }
                 }                 }
             }             }
             break;             break;
Line 3717 
Line 3769 
             }             }
             else             else
             {             {
                 SCMOClass* theRefClass = _getSCMOClass(  
                     theCIMInst->getPath(),  
                     &(((const char*)*pmem)[startNS]),  
                     lenNS);  
                 if (theRefClass != 0)  
                 {  
                     scmoUnion->extRefPtr =                     scmoUnion->extRefPtr =
                         new SCMOInstance(*theRefClass,*theCIMInst);                      new SCMOInstance(
                 } else                          *theCIMInst,
                           &(((const char*)*pmem)[startNS]),
                           sizeNS-1);
   
                    // Was the conversion successful?
                    if (scmoUnion->extRefPtr->isEmpty())
                 {                 {
                     //There is no reference class for the object path                       // N0, delete the SCMOInstance.
                        delete scmoUnion->extRefPtr;
                     scmoUnion->extRefPtr = 0;                     scmoUnion->extRefPtr = 0;
                 }                 }
                    else
                    {
                        // This function can cause a reallocation !
                        // Pointers can be invalid after the call.
                        _setExtRefIndex(scmoUnion,pmem);
                    }
             }             }
             break;             break;
         }         }
Line 3834 
Line 3892 
         // Copy the host name to tha new instance-         // Copy the host name to tha new instance-
         _setBinary(         _setBinary(
             _resolveDataPtr(this->inst.hdr->hostName,this->inst.base),             _resolveDataPtr(this->inst.hdr->hostName,this->inst.base),
             this->inst.hdr->hostName.length,              this->inst.hdr->hostName.size,
             newInst.inst.hdr->hostName,             newInst.inst.hdr->hostName,
             &newInst.inst.mem);             &newInst.inst.mem);
  
           newInst.inst.hdr->flags.isCompromised =
               this->inst.hdr->flags.isCompromised;
   
           // If the instance contains a user set class and/or name space name
           if (this->inst.hdr->flags.isCompromised)
           {
               // Copy the class name to tha new instance-
               _setBinary(
                   _resolveDataPtr(this->inst.hdr->instClassName,this->inst.base),
                   this->inst.hdr->instClassName.size,
                   newInst.inst.hdr->instClassName,
                   &newInst.inst.mem);
   
               // Copy the name space name to tha new instance-
               _setBinary(
                   _resolveDataPtr(this->inst.hdr->instNameSpace,this->inst.base),
                   this->inst.hdr->instNameSpace.size,
                   newInst.inst.hdr->instNameSpace,
                   &newInst.inst.mem);
           }
   
         // Copy the key bindings to that new instance.         // Copy the key bindings to that new instance.
         this->_copyKeyBindings(newInst);         this->_copyKeyBindings(newInst);
  
Line 3894 
Line 3973 
     }     }
  
     // Are there user defined key bindings ?     // Are there user defined key bindings ?
     if (0 != inst.hdr->numberUserKeyBindindigs)      if (0 != inst.hdr->numberUserKeyBindings)
     {     {
         SCMBUserKeyBindingElement* theUserDefKBElement =         SCMBUserKeyBindingElement* theUserDefKBElement =
             (SCMBUserKeyBindingElement*)             (SCMBUserKeyBindingElement*)
                  &(inst.base[inst.hdr->userKeyBindingElement.start]);                  &(inst.base[inst.hdr->userKeyBindingElement.start]);
  
         for(Uint32 i = 0; i < inst.hdr->numberUserKeyBindindigs; i++)          for(Uint32 i = 0; i < inst.hdr->numberUserKeyBindings; i++)
         {         {
             if (theUserDefKBElement->value.isSet)             if (theUserDefKBElement->value.isSet)
             {             {
Line 3927 
Line 4006 
     ptrNewElement = _getUserDefinedKeyBinding(     ptrNewElement = _getUserDefinedKeyBinding(
         _getCharString(theInsertElement.name,elementBase),         _getCharString(theInsertElement.name,elementBase),
         // lenght is without the trailing '\0'         // lenght is without the trailing '\0'
         theInsertElement.name.length-1,          theInsertElement.name.size-1,
         theInsertElement.type);         theInsertElement.type);
  
     // Copy the data     // Copy the data
Line 3992 
Line 4071 
         //   to the next element of the new element.         //   to the next element of the new element.
         ptrNewElement->nextElement.start =         ptrNewElement->nextElement.start =
             inst.hdr->userKeyBindingElement.start;             inst.hdr->userKeyBindingElement.start;
         ptrNewElement->nextElement.length =          ptrNewElement->nextElement.size =
             inst.hdr->userKeyBindingElement.length;              inst.hdr->userKeyBindingElement.size;
         // - Assing the the new element         // - Assing the the new element
         //   to the  start point of user key binding element chain         //   to the  start point of user key binding element chain
         inst.hdr->userKeyBindingElement.start = newElement.start;         inst.hdr->userKeyBindingElement.start = newElement.start;
         inst.hdr->userKeyBindingElement.length = newElement.length;          inst.hdr->userKeyBindingElement.size = newElement.size;
         // Adjust the couter of user defined key bindings.         // Adjust the couter of user defined key bindings.
         inst.hdr->numberUserKeyBindindigs++;          inst.hdr->numberUserKeyBindings++;
  
  
         // Copy the type         // Copy the type
Line 4100 
Line 4179 
                     ptr[i].extString.pchar =                     ptr[i].extString.pchar =
                         (char*)_getCharString(av[i].stringValue,base);                         (char*)_getCharString(av[i].stringValue,base);
                     // lenght with out the trailing /0 !                     // lenght with out the trailing /0 !
                     ptr[i].extString.length = av[i].stringValue.length-1;                      ptr[i].extString.length = av[i].stringValue.size-1;
                 }                 }
             }             }
             else             else
Line 4109 
Line 4188 
                 ptr->extString.pchar =                 ptr->extString.pchar =
                     (char*)_getCharString(u->stringValue,base);                     (char*)_getCharString(u->stringValue,base);
                 // lenght with out the trailing /0 !                 // lenght with out the trailing /0 !
                 ptr->extString.length = u->stringValue.length-1;                  ptr->extString.length = u->stringValue.size-1;
             }             }
  
              return(ptr);              return(ptr);
Line 4124 
Line 4203 
     return 0;     return 0;
 } }
  
   void SCMOInstance::clearKeyBindings()
   {
       // First destroy all external references in the key bindings
       _destroyExternalKeyBindings();
   
       // reset user keybindings
       inst.hdr->numberUserKeyBindings = 0;
       inst.hdr->userKeyBindingElement.start = 0;
       inst.hdr->userKeyBindingElement.size = 0;
   
       // Allocate a clean the SCMOInstanceKeyBindingArray
       _getFreeSpace(
             inst.hdr->keyBindingArray,
             sizeof(SCMBKeyBindingValue)*inst.hdr->numberKeyBindings,
             &inst.mem);
   }
   
 Uint32 SCMOInstance::getKeyBindingCount() const Uint32 SCMOInstance::getKeyBindingCount() const
 { {
     // count of class keys + user definded keys     // count of class keys + user definded keys
     return(inst.hdr->numberKeyBindings+     return(inst.hdr->numberKeyBindings+
            inst.hdr->numberUserKeyBindindigs);             inst.hdr->numberUserKeyBindings);
 } }
  
  
Line 4147 
Line 4243 
  
     // count of class keys + user definded keys     // count of class keys + user definded keys
     if (node >= (inst.hdr->numberKeyBindings+     if (node >= (inst.hdr->numberKeyBindings+
                  inst.hdr->numberUserKeyBindindigs))                   inst.hdr->numberUserKeyBindings))
     {     {
         return SCMO_INDEX_OUT_OF_BOUND;         return SCMO_INDEX_OUT_OF_BOUND;
     }     }
Line 4231 
Line 4327 
         type = theClassKeyBindNodeArray[node].type;         type = theClassKeyBindNodeArray[node].type;
  
         // First resolve pointer to the key binding name         // First resolve pointer to the key binding name
         pnameLen = theClassKeyBindNodeArray[node].name.length;          pnameLen = theClassKeyBindNodeArray[node].name.size;
         *pname = _getCharString(         *pname = _getCharString(
             theClassKeyBindNodeArray[node].name,             theClassKeyBindNodeArray[node].name,
             inst.hdr->theClass->cls.base);             inst.hdr->theClass->cls.base);
Line 4251 
Line 4347 
  
         type = theElem->type;         type = theElem->type;
  
         pnameLen = theElem->name.length;          pnameLen = theElem->name.size;
         *pname = _getCharString(theElem->name,inst.base);         *pname = _getCharString(theElem->name,inst.base);
  
         // There is no value set in the instance         // There is no value set in the instance
Line 4283 
Line 4379 
         SCMBUserKeyBindingElement* theUserDefKBElement =         SCMBUserKeyBindingElement* theUserDefKBElement =
             (SCMBUserKeyBindingElement*)&(inst.base[elementStart]);             (SCMBUserKeyBindingElement*)&(inst.base[elementStart]);
  
         if (_equalUTF8Strings(theUserDefKBElement->name,inst.base,name,len))          if (_equalNoCaseUTF8Strings(
               theUserDefKBElement->name,inst.base,name,len))
         {         {
             // the node index of a user defined key binding has an offset             // the node index of a user defined key binding has an offset
             // by the number of key bindings defined in the class             // by the number of key bindings defined in the class
Line 4367 
Line 4464 
     )     )
 { {
     scmoKBV.isSet=false;     scmoKBV.isSet=false;
       // If it not a simple value, it will be over written.
       scmoKBV.data.simple.hasValue=false;
  
     if ( kbs.size() == 0 && type != CIMTYPE_STRING)     if ( kbs.size() == 0 && type != CIMTYPE_STRING)
     {     {
Line 4386 
Line 4485 
                 StringConversion::checkUintBounds(x, type))                 StringConversion::checkUintBounds(x, type))
             {             {
               scmoKBV.data.simple.val.u8 = Uint8(x);               scmoKBV.data.simple.val.u8 = Uint8(x);
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4397 
Line 4497 
                 StringConversion::checkUintBounds(x, type))                 StringConversion::checkUintBounds(x, type))
             {             {
               scmoKBV.data.simple.val.u16 = Uint16(x);               scmoKBV.data.simple.val.u16 = Uint16(x);
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4409 
Line 4510 
                 StringConversion::checkUintBounds(x, type))                 StringConversion::checkUintBounds(x, type))
             {             {
               scmoKBV.data.simple.val.u32 = Uint32(x);               scmoKBV.data.simple.val.u32 = Uint32(x);
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4420 
Line 4522 
             if (StringConversion::stringToUnsignedInteger(v, x))             if (StringConversion::stringToUnsignedInteger(v, x))
             {             {
               scmoKBV.data.simple.val.u64 = x;               scmoKBV.data.simple.val.u64 = x;
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4432 
Line 4535 
                 StringConversion::checkSintBounds(x, type))                 StringConversion::checkSintBounds(x, type))
             {             {
               scmoKBV.data.simple.val.s8 = Sint8(x);               scmoKBV.data.simple.val.s8 = Sint8(x);
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4444 
Line 4548 
                 StringConversion::checkSintBounds(x, type))                 StringConversion::checkSintBounds(x, type))
             {             {
               scmoKBV.data.simple.val.s16 = Sint16(x);               scmoKBV.data.simple.val.s16 = Sint16(x);
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4456 
Line 4561 
                 StringConversion::checkSintBounds(x, type))                 StringConversion::checkSintBounds(x, type))
             {             {
               scmoKBV.data.simple.val.s32 = Sint32(x);               scmoKBV.data.simple.val.s32 = Sint32(x);
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4467 
Line 4573 
             if (StringConversion::stringToSignedInteger(v, x))             if (StringConversion::stringToSignedInteger(v, x))
             {             {
               scmoKBV.data.simple.val.s64 = x;               scmoKBV.data.simple.val.s64 = x;
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4500 
Line 4607 
             if (StringConversion::stringToReal64(v, x))             if (StringConversion::stringToReal64(v, x))
             {             {
               scmoKBV.data.simple.val.r32 = Real32(x);               scmoKBV.data.simple.val.r32 = Real32(x);
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4512 
Line 4620 
             if (StringConversion::stringToReal64(v, x))             if (StringConversion::stringToReal64(v, x))
             {             {
               scmoKBV.data.simple.val.r64 = x;               scmoKBV.data.simple.val.r64 = x;
                 scmoKBV.data.simple.hasValue=true;
               scmoKBV.isSet=true;               scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4522 
Line 4631 
             if (kbs.size() == 1)             if (kbs.size() == 1)
             {             {
                 scmoKBV.data.simple.val.c16 = kbs[0];                 scmoKBV.data.simple.val.c16 = kbs[0];
                   scmoKBV.data.simple.hasValue=true;
                 scmoKBV.isSet=true;                 scmoKBV.isSet=true;
             }             }
             break;             break;
Line 4531 
Line 4641 
             if (String::equalNoCase(kbs,"TRUE"))             if (String::equalNoCase(kbs,"TRUE"))
             {             {
                 scmoKBV.data.simple.val.bin = true;                 scmoKBV.data.simple.val.bin = true;
                   scmoKBV.data.simple.hasValue=true;
                 scmoKBV.isSet=true;                 scmoKBV.isSet=true;
             }             }
             else if (String::equalNoCase(kbs,"FALSE"))             else if (String::equalNoCase(kbs,"FALSE"))
                  {                  {
                      scmoKBV.data.simple.val.bin = false;                      scmoKBV.data.simple.val.bin = false;
                        scmoKBV.data.simple.hasValue=true;
                      scmoKBV.isSet=true;                      scmoKBV.isSet=true;
                  }                  }
             break;             break;
Line 4559 
Line 4671 
             }             }
             // TBD: Optimize parsing and SCMOInstance creation.             // TBD: Optimize parsing and SCMOInstance creation.
             CIMObjectPath theCIMObj(kbs);             CIMObjectPath theCIMObj(kbs);
             SCMOClass* theRefClass = _getSCMOClass(  
                 theCIMObj,  
                 _getCharString(inst.hdr->instNameSpace,inst.base),  
                 inst.hdr->instNameSpace.length);  
  
             if (theRefClass != 0)              scmoKBV.data.extRefPtr = new SCMOInstance(theCIMObj);
             {              scmoKBV.isSet=true;
                 scmoKBV.data.extRefPtr =  
                     new SCMOInstance(*theRefClass,theCIMObj);              // Was the conversion successful?
             } else              if (scmoKBV.data.extRefPtr->isEmpty())
             {             {
                   // N0, delete the SCMOInstance.
                   delete scmoKBV.data.extRefPtr;
                 scmoKBV.data.extRefPtr = 0;                 scmoKBV.data.extRefPtr = 0;
                   scmoKBV.isSet=false;
               }
               else
               {
                   // This function can cause a reallocation !
                   // Pointers can be invalid after the call.
                   _setExtRefIndex(&(scmoKBV.data),&inst.mem);
             }             }
             scmoKBV.isSet=true;  
             break;             break;
         }         }
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
Line 4715 
Line 4831 
  
     // count of class keys + user definded keys     // count of class keys + user definded keys
     if (node >= (inst.hdr->numberKeyBindings+     if (node >= (inst.hdr->numberKeyBindings+
                  inst.hdr->numberUserKeyBindindigs))                   inst.hdr->numberUserKeyBindings))
     {     {
         return SCMO_INDEX_OUT_OF_BOUND;         return SCMO_INDEX_OUT_OF_BOUND;
     }     }
Line 4909 
Line 5025 
     }     }
     else     else
     {     {
           // If type defined in the class and the provided type does not match
           // at this point, no convertaion can be done and the provided type
           // is handlend as type missmatch.
           if (classType != setType)
           {
               return SCMO_TYPE_MISSMATCH;
           }
   
         switch (classType)         switch (classType)
         {         {
           case CIMTYPE_DATETIME:
         case CIMTYPE_BOOLEAN:         case CIMTYPE_BOOLEAN:
         case CIMTYPE_UINT64:         case CIMTYPE_UINT64:
         case CIMTYPE_SINT64:         case CIMTYPE_SINT64:
Line 4935 
Line 5060 
  
 } }
  
   static int _indexComp(const void* left, const void* right)
   {
       return((*(Uint32 *)left)-(*(Uint32 *)right));
   }
  
 void SCMOInstance::setPropertyFilter(const char **propertyList) void SCMOInstance::setPropertyFilter(const char **propertyList)
 { {
Line 4947 
Line 5076 
         _getFreeSpace(         _getFreeSpace(
             inst.hdr->propertyFilter,             inst.hdr->propertyFilter,
             sizeof(Uint64)*(((inst.hdr->numberProperties-1)/64)+1),             sizeof(Uint64)*(((inst.hdr->numberProperties-1)/64)+1),
             &inst.mem,              &inst.mem);
             true);  
  
         // Allocate the SCMBPropertyFilterIndexMap         // Allocate the SCMBPropertyFilterIndexMap
         _getFreeSpace(         _getFreeSpace(
             inst.hdr->propertyFilterIndexMap,             inst.hdr->propertyFilterIndexMap,
             sizeof(Uint32)*inst.hdr->numberProperties,             sizeof(Uint32)*inst.hdr->numberProperties,
             &inst.mem,              &inst.mem);
             true);  
     }     }
     // Get absolut pointer to property filter index map of the instance     // Get absolut pointer to property filter index map of the instance
     Uint32* propertyFilterIndexMap =     Uint32* propertyFilterIndexMap =
Line 5008 
Line 5135 
         i++;         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() Uint32 SCMOInstance::_initPropFilterWithKeys()
 { {
  
Line 5251 
Line 5383 
  
 } }
  
 void SCMODump::dumpInstanceProperties(SCMOInstance& testInst) const  void SCMODump::dumpInstanceProperties(
       SCMOInstance& testInst,
       Boolean verbose) const
 { {
     SCMBInstance_Main* insthdr = testInst.inst.hdr;     SCMBInstance_Main* insthdr = testInst.inst.hdr;
     char* instbase = testInst.inst.base;     char* instbase = testInst.inst.base;
Line 5274 
Line 5408 
         }         }
         else         else
         {         {
             printSCMOValue(val[i],instbase);              printSCMOValue(val[i],instbase,verbose);
         }         }
     }     }
  
Line 5385 
Line 5519 
      }      }
 } }
  
 void SCMODump::dumpSCMOInstanceKeyBindings(SCMOInstance& testInst) const  void SCMODump::dumpSCMOInstanceKeyBindings(
       SCMOInstance& testInst,
       Boolean verbose) const
 { {
     SCMBInstance_Main* insthdr = testInst.inst.hdr;     SCMBInstance_Main* insthdr = testInst.inst.hdr;
     char* instbase = testInst.inst.base;     char* instbase = testInst.inst.base;
Line 5401 
Line 5537 
  
     fprintf(_out,"\n\nInstance Key Bindings :");     fprintf(_out,"\n\nInstance Key Bindings :");
     fprintf(_out,"\n=======================");     fprintf(_out,"\n=======================");
     fprintf(_out,"\n\nNumber of Key Bindings : %u",insthdr->numberKeyBindings);      fprintf(_out,"\n\nNumber of Key Bindings defined in the Class: %u",
               insthdr->numberKeyBindings);
  
     for (Uint32 i = 0, k = insthdr->numberKeyBindings; i < k; i++)     for (Uint32 i = 0, k = insthdr->numberKeyBindings; i < k; i++)
     {     {
         if (ptr[i].isSet)         if (ptr[i].isSet)
         {         {
             fprintf(_out,"\n\nNo %u : '%s'",i,              fprintf(_out,"\n\nName: '%s'\nType: '%s'",
                 (const char*)printUnionValue(                  NULLSTR(_getCharString(
                       theClassKeyBindNodeArray[i].name,
                       insthdr->theClass->cls.base)),
                   cimTypeToString(theClassKeyBindNodeArray[i].type));
               printUnionValue(
                     theClassKeyBindNodeArray[i].type,                     theClassKeyBindNodeArray[i].type,
                     ptr[i].data,                     ptr[i].data,
                     instbase).getCString());                  instbase,
                   verbose);
         }         }
         else         else
         {         {
             fprintf(_out,"\n\nNo %u : Not Set",i);              fprintf(_out,"\n\nName: '%s': Not Set",
                   NULLSTR(_getCharString(
                       theClassKeyBindNodeArray[i].name,
                       insthdr->theClass->cls.base)));
           }
       }
   
       fprintf(_out,"\n\nNumber of User Defined Key Bindings: %u",
               insthdr->numberUserKeyBindings);
   
   
       SCMBUserKeyBindingElement* theUserDefKBElement;
   
       Uint64 start = insthdr->userKeyBindingElement.start;
       while (start != 0)
       {
           theUserDefKBElement = (SCMBUserKeyBindingElement*)&(instbase[start]);
  
           if (theUserDefKBElement->value.isSet)
           {
               fprintf(_out,"\n\nName: '%s'\nType: '%s'",
                   NULLSTR(_getCharString(theUserDefKBElement->name,instbase)),
                   cimTypeToString(theUserDefKBElement->type));
               printUnionValue(
                   theUserDefKBElement->type,
                   theUserDefKBElement->value.data,
                   instbase,
                   verbose);
         }         }
           else
           {
               fprintf(_out,"\n\n    %s : Not Set",
                   NULLSTR(_getCharString(theUserDefKBElement->name,instbase)));
   
     }     }
     fprintf(_out,"\n");          start = theUserDefKBElement->nextElement.start;
       } // for all user def. key bindings.
   
       fprintf(_out,"\n\n");
   
 } }
  
 void SCMODump::dumpSCMOClass(SCMOClass& testCls) const void SCMODump::dumpSCMOClass(SCMOClass& testCls) const
Line 5736 
Line 5913 
  
 void SCMODump::printSCMOValue( void SCMODump::printSCMOValue(
     const SCMBValue& theValue,     const SCMBValue& theValue,
     char* base) const      char* base,
       Boolean verbose) const
 { {
    fprintf(_out,"\nValueType : %s",cimTypeToString(theValue.valueType));    fprintf(_out,"\nValueType : %s",cimTypeToString(theValue.valueType));
    fprintf(_out,"\nValue was set: %s",    fprintf(_out,"\nValue was set: %s",
Line 5748 
Line 5926 
    }    }
    if (theValue.flags.isArray)    if (theValue.flags.isArray)
    {    {
        fprintf(_out,         fprintf(
              _out,
                "\nThe value is an Array of size: %u",                "\nThe value is an Array of size: %u",
                theValue.valueArraySize);                theValue.valueArraySize);
        fprintf(_out,"\nThe values are: %s",         printArrayValue(
               (const char*)printArrayValue(  
                   theValue.valueType,                   theValue.valueType,
                   theValue.valueArraySize,                   theValue.valueArraySize,
                   theValue.value,                   theValue.value,
                   base).getCString());             base,
              verbose);
    }    }
    else    else
    {    {
       fprintf(_out,"\nThe Value is: '%s'",         printUnionValue(theValue.valueType,theValue.value,base,verbose);
           (const char*)  
              printUnionValue(theValue.valueType,theValue.value,base)  
              .getCString());  
    }    }
  
    return;    return;
Line 5873 
Line 6049 
     }     }
 } }
  
 String SCMODump::printArrayValue(  void SCMODump::printArrayValue(
     CIMType type,     CIMType type,
     Uint32 size,     Uint32 size,
     SCMBUnion u,     SCMBUnion u,
     char* base) const      char* base,
       Boolean verbose) const
 { {
     Buffer out;     Buffer out;
  
Line 5898 
Line 6075 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 5913 
Line 6091 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 5928 
Line 6107 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 5943 
Line 6123 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 5958 
Line 6139 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 5973 
Line 6155 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 5988 
Line 6171 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6003 
Line 6187 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6018 
Line 6203 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6033 
Line 6219 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6048 
Line 6235 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6063 
Line 6251 
                           STRLIT("FALSE)"));                           STRLIT("FALSE)"));
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6071 
Line 6260 
             SCMBDataPtr* p = (SCMBDataPtr*)&(base[u.arrayValue.start]);             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].length)                  if ( 0 != p[i].size)
                 {                 {
                     out.append('\'');                     out.append('\'');
                     out.append((const char*)_getCharString(p[i],base),                     out.append((const char*)_getCharString(p[i],base),
                                p[i].length-1);                                 p[i].size-1);
                     out.append('\'');                     out.append('\'');
                 }                 }
                 else                 else
Line 6084 
Line 6273 
                 }                 }
                 out.append(';');                 out.append(';');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6097 
Line 6287 
                 _toString(out,x);                 _toString(out,x);
                 out.append(' ');                 out.append(' ');
             }             }
               fprintf(_out,"\nThe values are: %s",out.getData());
             break;             break;
         }         }
  
Line 6104 
Line 6295 
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
     case CIMTYPE_INSTANCE:     case CIMTYPE_INSTANCE:
         {         {
             // TODO: has to dump SCMOInstance ...              if (verbose)
               {
                   for (Uint32 i = 0; i < size; i++)
                   {
                       fprintf(_out,"\n-----------> "
                                     "Start of embedded external reference [%d]"
                                     " <-----------\n\n",i);
                       dumpSCMOInstance(*u.extRefPtr);
                       fprintf(_out,"\n-----------> "
                                     "End of embedded external reference [%d]"
                                     " <-----------\n\n",i);
                   }
   
               } else
               {
                   fprintf(_out,"\nThe values are: ");
   
                   for (Uint32 i = 0; i < size; i++)
                   {
                       fprintf(
                           _out,
                           "Pointer to external Reference[%d] : \'%p\';",
                           i,p[i].extRefPtr);
                   }
               }
   
             break;             break;
   
         }         }
     default:     default:
         {         {
Line 6114 
Line 6331 
         }         }
     }     }
  
     return out.getData();      return;
 } }
  
 String SCMODump::printUnionValue(  void SCMODump::printUnionValue(
     CIMType type,     CIMType type,
     SCMBUnion u,     SCMBUnion u,
     char* base) const      char* base,
       Boolean verbose) const
 { {
  
     Buffer out;     Buffer out;
Line 6130 
Line 6348 
     case CIMTYPE_BOOLEAN:     case CIMTYPE_BOOLEAN:
         {         {
             _toString(out,u.simple.val.bin);             _toString(out,u.simple.val.bin);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_UINT8:     case CIMTYPE_UINT8:
         {         {
             _toString(out,u.simple.val.u8);             _toString(out,u.simple.val.u8);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_SINT8:     case CIMTYPE_SINT8:
         {         {
             _toString(out,u.simple.val.s8);             _toString(out,u.simple.val.s8);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_UINT16:     case CIMTYPE_UINT16:
         {         {
             _toString(out,(Uint32)u.simple.val.u16);             _toString(out,(Uint32)u.simple.val.u16);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_SINT16:     case CIMTYPE_SINT16:
         {         {
             _toString(out,u.simple.val.s16);             _toString(out,u.simple.val.s16);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_UINT32:     case CIMTYPE_UINT32:
         {         {
             _toString(out,u.simple.val.u32);             _toString(out,u.simple.val.u32);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_SINT32:     case CIMTYPE_SINT32:
         {         {
             _toString(out,u.simple.val.s32);             _toString(out,u.simple.val.s32);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_UINT64:     case CIMTYPE_UINT64:
         {         {
             _toString(out,u.simple.val.u64);             _toString(out,u.simple.val.u64);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_SINT64:     case CIMTYPE_SINT64:
         {         {
             _toString(out,u.simple.val.s64);             _toString(out,u.simple.val.s64);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_REAL32:     case CIMTYPE_REAL32:
         {         {
             _toString(out,u.simple.val.r32);             _toString(out,u.simple.val.r32);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_REAL64:     case CIMTYPE_REAL64:
         {         {
             _toString(out,u.simple.val.r32);             _toString(out,u.simple.val.r32);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_CHAR16:     case CIMTYPE_CHAR16:
         {         {
             _toString(out,u.simple.val.c16);             _toString(out,u.simple.val.c16);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
     case CIMTYPE_STRING:     case CIMTYPE_STRING:
         {         {
             if ( 0 != u.stringValue.length)              if ( 0 != u.stringValue.size)
             {             {
                 out.append((const char*)_getCharString(u.stringValue,base),                 out.append((const char*)_getCharString(u.stringValue,base),
                            u.stringValue.length-1);                             u.stringValue.size-1);
             }             }
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
Line 6214 
Line 6445 
             CIMDateTime x;             CIMDateTime x;
             memcpy(x._rep,&(u.dateTimeValue),sizeof(SCMBDateTime));             memcpy(x._rep,&(u.dateTimeValue),sizeof(SCMBDateTime));
             _toString(out,x);             _toString(out,x);
               fprintf(_out,"\nThe Value is: '%s'",out.getData());
             break;             break;
         }         }
  
Line 6221 
Line 6453 
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
     case CIMTYPE_INSTANCE:     case CIMTYPE_INSTANCE:
         {         {
             // TODO: Has to dump SCMOInstance.              if (verbose)
               {
                   fprintf(_out,"\n-----------> "
                                 "Start of embedded external reference"
                                 " <-----------\n\n");
                   dumpSCMOInstance(*u.extRefPtr);
                   fprintf(_out,"\n-----------> "
                                "End of embedded external reference"
                                " <-----------\n\n");
               } else
               {
                   fprintf(
                       _out,
                       "Pointer to external Reference : \'%p\'",
                       u.extRefPtr);
               }
   
             break;             break;
         }         }
     default:     default:
Line 6231 
Line 6479 
         }         }
     }     }
  
   return out.getData();    return;
 } }
  
  
Line 6239 
Line 6487 
  * The constant functions  * The constant functions
  *****************************************************************************/  *****************************************************************************/
  
 static Boolean _equalUTF8Strings(  
     const SCMBDataPtr& ptr_a,  
     char* base,  
     const char* name,  
     Uint32 len)  
   
 {  
     // size without trailing '\0' !!  
     if (ptr_a.length-1 != len)  
     {  
         return false;  
     }  
     const char* a = (const char*)_getCharString(ptr_a,base);  
   
     // lets do a loop-unrolling optimized compare here  
     while (len >= 8)  
     {  
         if ((a[0] - name[0]) || (a[1] - name[1]) ||  
             (a[2] - name[2]) || (a[3] - name[3]) ||  
             (a[4] - name[4]) || (a[5] - name[5]) ||  
             (a[6] - name[6]) || (a[7] - name[7]))  
         {  
             return false;  
         }  
         len -= 8;  
         a += 8;  
         name += 8;  
     }  
     while (len >= 4)  
     {  
         if ((a[0] - name[0]) || (a[1] - name[1]) ||  
             (a[2] - name[2]) || (a[3] - name[3]))  
         {  
             return false;  
         }  
         len -= 4;  
         a += 4;  
         name += 4;  
     }  
     while (len--)  
     {  
         if (a[0] - name[0])  
         {  
             return false;  
         }  
         a++;  
         name++;  
     }  
     return true;  
 }  
   
   
 static Boolean _equalNoCaseUTF8Strings(  
     const SCMBDataPtr& ptr_a,  
     char* base,  
     const char* name,  
     Uint32 len)  
   
 {  
   
     //both are empty strings, so they are equal.  
     if (ptr_a.length == 0 && len == 0)  
     {  
         return true;  
     }  
   
     // size without trailing '\0' !!  
     if (ptr_a.length-1 != len)  
     {  
         return false;  
     }  
   
     const char* a = (const char*)_getCharString(ptr_a,base);  
   
 #ifdef PEGASUS_HAS_ICU  
     return ( _utf8ICUncasecmp(a,name,len)== 0);  
 #else  
     return ( strncasecmp(a,name,len )== 0 );  
 #endif  
 }  
   
 #ifdef PEGASUS_HAS_ICU #ifdef PEGASUS_HAS_ICU
 static Uint32 _utf8ICUncasecmp(  Uint32 _utf8ICUncasecmp(
     const char* a,     const char* a,
     const char* b,     const char* b,
     Uint32 len)     Uint32 len)
Line 6421 
Line 6588 
 static Uint64 _getFreeSpace( static Uint64 _getFreeSpace(
     SCMBDataPtr& ptr,     SCMBDataPtr& ptr,
     Uint64 size,     Uint64 size,
     SCMBMgmt_Header** pmem,      SCMBMgmt_Header** pmem)
     Boolean clear)  
 { {
     Uint64 oldSize, start;     Uint64 oldSize, start;
  
     if (size == 0)     if (size == 0)
     {     {
         ptr.start = 0;         ptr.start = 0;
         ptr.length = 0;          ptr.size = 0;
         return 0;         return 0;
     }     }
  
     // 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.start = start;
     ptr.length = size;      ptr.size = size;
  
     while ((*pmem)->freeBytes < size)     while ((*pmem)->freeBytes < size)
     {     {
Line 6444 
Line 6610 
         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.
         (*pmem) = (SCMBMgmt_Header*)realloc((*pmem),oldSize*2);          void* newBlockPtr = realloc((*pmem),oldSize*2);
         if ((*pmem) == 0)          if ((newBlockPtr) == 0)
         {         {
             // Not enough memory!             // Not enough memory!
             throw PEGASUS_STD(bad_alloc)();             throw PEGASUS_STD(bad_alloc)();
         }         }
           (*pmem) = (SCMBMgmt_Header*)newBlockPtr;
         // increase the total size and free space         // increase the total size and free space
         (*pmem)->freeBytes+=oldSize;         (*pmem)->freeBytes+=oldSize;
         (*pmem)->totalSize+=oldSize;         (*pmem)->totalSize+=oldSize;
Line 6458 
Line 6625 
     (*pmem)->freeBytes -= size;     (*pmem)->freeBytes -= size;
     (*pmem)->startOfFreeSpace += size;     (*pmem)->startOfFreeSpace += size;
  
     if (clear)      // Init memory to 0.
     {  
         // If requested, set memory to 0.  
         memset(&((char*)(*pmem))[start],0,size);         memset(&((char*)(*pmem))[start],0,size);
     }  
     return start;     return start;
 } }
  
Line 6493 
Line 6658 
     else     else
     {     {
         ptr.start = 0;         ptr.start = 0;
         ptr.length = 0;          ptr.size = 0;
     }     }
 } }
  
Line 6505 
Line 6670 
 { {
  
     // If buffer is not empty.     // If buffer is not empty.
     if (bufferSize != 1 && theBuffer != 0)      if (bufferSize != 0 && theBuffer != 0)
     {     {
  
         Uint64 start;         Uint64 start;
Line 6522 
Line 6687 
     else     else
     {     {
         ptr.start = 0;         ptr.start = 0;
         ptr.length = 0;          ptr.size = 0;
       }
   }
   
   static void _destroyExternalReferencesInternal(SCMBMgmt_Header* memHdr)
   {
   
       Uint32 number = memHdr->numberExtRef;
   
       if (0 != number)
       {
           char * base = ((char*)memHdr);
           Uint64* array =
               (Uint64*)&(base[memHdr->extRefIndexArray.start]);
           for (Uint32 i = 0; i < number; i++)
           {
                delete ((SCMBUnion*)(&(base[array[i]])))->extRefPtr;
           }
   
     }     }
 } }
  


Legend:
Removed from v.1.2.2.38  
changed lines
  Added in v.1.2.2.68

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2