(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.14.2.4 and 1.24

version 1.14.2.4, 2012/05/25 13:04:22 version 1.24, 2013/02/13 11:39:58
Line 27 
Line 27 
 // //
 ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
 // //
   // This code implements part of PEP#348 - The CMPI infrastructure using SCMO
   // (Single Chunk Memory Objects).
   // The design document can be found on the OpenPegasus website openpegasus.org
   // at https://collaboration.opengroup.org/pegasus/pp/documents/21210/PEP_348.pdf
   //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <Pegasus/Common/SCMO.h> #include <Pegasus/Common/SCMO.h>
Line 570 
Line 575 
     tag = _generateStringTag((const char*)name, len);     tag = _generateStringTag((const char*)name, len);
     // get the node index of the hash table     // get the node index of the hash table
     hashIdx =     hashIdx =
         cls.hdr->keyBindingSet.hashTable[tag%PEGASUS_KEYBINDIG_SCMB_HASHSIZE];        cls.hdr->keyBindingSet.hashTable[tag&(PEGASUS_KEYBINDIG_SCMB_HASHSIZE-1)];
     // there is no entry in the hash table on this hash table index.     // there is no entry in the hash table on this hash table index.
     if (hashIdx == 0)     if (hashIdx == 0)
     {     {
Line 625 
Line 630 
     tag = _generateStringTag((const char*)name, len);     tag = _generateStringTag((const char*)name, len);
     // get the node index of the hash table     // get the node index of the hash table
     hashIdx =     hashIdx =
         cls.hdr->propertySet.hashTable[tag%PEGASUS_PROPERTY_SCMB_HASHSIZE];        cls.hdr->propertySet.hashTable[tag&(PEGASUS_PROPERTY_SCMB_HASHSIZE -1)];
     // there is no entry in the hash table on this hash table index.     // there is no entry in the hash table on this hash table index.
     if (hashIdx == 0)     if (hashIdx == 0)
     {     {
Line 792 
Line 797 
     Uint32 *hashTable = cls.hdr->keyBindingSet.hashTable;     Uint32 *hashTable = cls.hdr->keyBindingSet.hashTable;
  
     // calculate the new hash index of the new property.     // calculate the new hash index of the new property.
     Uint32 hash = newKeyNode->nameHashTag % PEGASUS_KEYBINDIG_SCMB_HASHSIZE;      Uint32 hash = newKeyNode->nameHashTag &
           (PEGASUS_KEYBINDIG_SCMB_HASHSIZE - 1);
  
     // 0 is an invalid index in the hash table     // 0 is an invalid index in the hash table
     if (hashTable[hash] == 0)     if (hashTable[hash] == 0)
Line 843 
Line 849 
     Uint32 *hashTable = cls.hdr->propertySet.hashTable;     Uint32 *hashTable = cls.hdr->propertySet.hashTable;
  
     // calcuate the new hash index of the new property.     // calcuate the new hash index of the new property.
     Uint32 hash = newPropNode->theProperty.nameHashTag %      Uint32 hash = newPropNode->theProperty.nameHashTag &
         PEGASUS_PROPERTY_SCMB_HASHSIZE;          (PEGASUS_PROPERTY_SCMB_HASHSIZE -1);
  
     // 0 is an invalid index in the hash table     // 0 is an invalid index in the hash table
     if (hashTable[hash] == 0)     if (hashTable[hash] == 0)
Line 916 
Line 922 
  
     // Create a filter to set the bit.     // Create a filter to set the bit.
     // Modulo division with 64. Shift left a bit by the remainder.     // Modulo division with 64. Shift left a bit by the remainder.
     Uint64 filter = ( (Uint64)1 << (i%64));      Uint64 filter = ( (Uint64)1 << (i & 63));
  
     // Calculate the real pointer to the Uint64 array     // Calculate the real pointer to the Uint64 array
     keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]);     keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]);
Line 936 
Line 942 
  
     // Create a filter to check if the bit is set:     // Create a filter to check if the bit is set:
     // Modulo division with 64. Shift left a bit by the remainder.     // Modulo division with 64. Shift left a bit by the remainder.
     Uint64 filter = ( (Uint64)1 << (i%64));      Uint64 filter = ( (Uint64)1 << (i & 63));
  
     // Calculate the real pointer to the Uint64 array     // Calculate the real pointer to the Uint64 array
     keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]);     keyMask = (Uint64*)&(cls.base[cls.hdr->keyPropertyMask.start]);
Line 1255 
Line 1261 
 SCMOInstance::SCMOInstance( SCMOInstance::SCMOInstance(
     SCMOClass& baseClass,     SCMOClass& baseClass,
     Boolean includeQualifiers,     Boolean includeQualifiers,
     Boolean includeClassOrigin,      Boolean includeClassOrigin)
     const char** propertyList)  
 { {
  
     _initSCMOInstance(new SCMOClass(baseClass));     _initSCMOInstance(new SCMOClass(baseClass));
Line 4286 
Line 4291 
             {             {
                 return(u);                 return(u);
             }             }
             break;  
         }         }
  
     case CIMTYPE_STRING:     case CIMTYPE_STRING:
Line 4321 
Line 4325 
             }             }
  
              return(ptr);              return(ptr);
             break;  
         }         }
     default:     default:
         {         {
Line 4566 
Line 4569 
                         return CIMTYPE_REAL64;                         return CIMTYPE_REAL64;
                     }                     }
                 }                 }
                 break;  
             }             }
  
  
         case CIMKeyBinding::STRING:         case CIMKeyBinding::STRING:
         {         {
             return CIMTYPE_STRING;             return CIMTYPE_STRING;
             break;  
         }         }
  
         case CIMKeyBinding::BOOLEAN:         case CIMKeyBinding::BOOLEAN:
         {         {
             return CIMTYPE_BOOLEAN;             return CIMTYPE_BOOLEAN;
             break;  
         }         }
  
         case CIMKeyBinding::REFERENCE:         case CIMKeyBinding::REFERENCE:
         {         {
             return CIMTYPE_REFERENCE;             return CIMTYPE_REFERENCE;
             break;  
         }         }
  
         default:         default:
Line 4796 
Line 4795 
             // Can cause reallocation !             // Can cause reallocation !
             _setString(kbs,scmoKBV.data.stringValue,&inst.mem);             _setString(kbs,scmoKBV.data.stringValue,&inst.mem);
             return true;             return true;
             break;  
         }         }
     case CIMTYPE_REFERENCE:     case CIMTYPE_REFERENCE:
         {         {
Line 4833 
Line 4831 
         {         {
             // From PEP 194: EmbeddedObjects cannot be keys.             // From PEP 194: EmbeddedObjects cannot be keys.
             throw TypeMismatchException();             throw TypeMismatchException();
             break;  
         }         }
     default:     default:
         {         {
Line 5075 
Line 5072 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.u8=Uint8(keyValue->simple.val.u64);                 kbValue.data.simple.val.u8=Uint8(keyValue->simple.val.u64);
                 return SCMO_OK;  
                 break;                 break;
             }             }
         case CIMTYPE_UINT16:         case CIMTYPE_UINT16:
Line 5083 
Line 5079 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.u16=Uint16(keyValue->simple.val.u64);                 kbValue.data.simple.val.u16=Uint16(keyValue->simple.val.u64);
                 return SCMO_OK;  
                 break;                 break;
             }             }
         case CIMTYPE_UINT32:         case CIMTYPE_UINT32:
Line 5091 
Line 5086 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.u32=Uint32(keyValue->simple.val.u64);                 kbValue.data.simple.val.u32=Uint32(keyValue->simple.val.u64);
                 return SCMO_OK;  
                 break;                 break;
             }             }
         case CIMTYPE_UINT64:         case CIMTYPE_UINT64:
Line 5099 
Line 5093 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.u64=keyValue->simple.val.u64;                 kbValue.data.simple.val.u64=keyValue->simple.val.u64;
                 return SCMO_OK;  
                 break;                 break;
             }             }
         default:         default:
             {             {
                 return SCMO_TYPE_MISSMATCH;                 return SCMO_TYPE_MISSMATCH;
                 break;  
             }             }
         }         }
           return SCMO_OK;
   
     }     }
  
     if (setType == CIMTYPE_SINT64)     if (setType == CIMTYPE_SINT64)
Line 5120 
Line 5114 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.s8=Sint8(keyValue->simple.val.s64);                 kbValue.data.simple.val.s8=Sint8(keyValue->simple.val.s64);
                 return SCMO_OK;  
                 break;                 break;
             }             }
         case CIMTYPE_SINT16:         case CIMTYPE_SINT16:
Line 5128 
Line 5121 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.s16=Sint16(keyValue->simple.val.s64);                 kbValue.data.simple.val.s16=Sint16(keyValue->simple.val.s64);
                 return SCMO_OK;  
                 break;                 break;
             }             }
         case CIMTYPE_SINT32:         case CIMTYPE_SINT32:
Line 5136 
Line 5128 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.s32=Sint32(keyValue->simple.val.s64);                 kbValue.data.simple.val.s32=Sint32(keyValue->simple.val.s64);
                 return SCMO_OK;  
                 break;                 break;
             }             }
         case CIMTYPE_SINT64:         case CIMTYPE_SINT64:
Line 5144 
Line 5135 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.s64=keyValue->simple.val.s64;                 kbValue.data.simple.val.s64=keyValue->simple.val.s64;
                 return SCMO_OK;  
                 break;                 break;
             }             }
         default:         default:
             {             {
                 return SCMO_TYPE_MISSMATCH;                 return SCMO_TYPE_MISSMATCH;
                 break;  
             }             }
         }         }
           return SCMO_OK;
     }     }
  
     if (setType == CIMTYPE_REAL64)     if (setType == CIMTYPE_REAL64)
Line 5164 
Line 5154 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.r32=Real32(keyValue->simple.val.r64);                 kbValue.data.simple.val.r32=Real32(keyValue->simple.val.r64);
                 return SCMO_OK;  
                 break;                 break;
             }             }
         case CIMTYPE_REAL64:         case CIMTYPE_REAL64:
Line 5172 
Line 5161 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 kbValue.data.simple.hasValue=true;                 kbValue.data.simple.hasValue=true;
                 kbValue.data.simple.val.r64=keyValue->simple.val.r64;                 kbValue.data.simple.val.r64=keyValue->simple.val.r64;
                 return SCMO_OK;  
                 break;                 break;
             }             }
         default:         default:
             {             {
                 return SCMO_TYPE_MISSMATCH;                 return SCMO_TYPE_MISSMATCH;
                 break;  
             }             }
         }         }
           return SCMO_OK;
     }     }
     else     else
     {     {
Line 5205 
Line 5193 
                 kbValue.isSet=true;                 kbValue.isSet=true;
                 _setSCMBUnion(keyValue,classType,false, 0,kbValue.data);                 _setSCMBUnion(keyValue,classType,false, 0,kbValue.data);
                 return SCMO_OK;                 return SCMO_OK;
                 break;  
             }             }
         default:         default:
             {             {
                 return SCMO_TYPE_MISSMATCH;                 return SCMO_TYPE_MISSMATCH;
                 break;  
             }             }
         }         }
     }     }
Line 5219 
Line 5205 
  
 } }
  
 static int _indexComp(const void* left, const void* right)  // class SCMODump only in debug builds available
 {  #ifdef PEGASUS_DEBUG
     return((*(Uint32 *)left)-(*(Uint32 *)right));  
 }  
   
 void SCMOInstance::setPropertyFilter(const char **propertyList)  
 {  
     return;  
 }  
   
   
 /****************************************************************************** /******************************************************************************
  * SCMODump Print and Dump functions  * SCMODump Print and Dump functions
  *****************************************************************************/  *****************************************************************************/
Line 5607 
Line 5584 
         }         }
         else         else
         {         {
             line = clshdr->propertySet.number%16;              line = clshdr->propertySet.number & 15;
         }         }
  
  
Line 5674 
Line 5651 
  
         fprintf(_out,"\nHash Tag %3u Hash Index %3u",         fprintf(_out,"\nHash Tag %3u Hash Index %3u",
                nodeArray[i].nameHashTag,                nodeArray[i].nameHashTag,
                nodeArray[i].nameHashTag%PEGASUS_KEYBINDIG_SCMB_HASHSIZE);                 nodeArray[i].nameHashTag & (PEGASUS_KEYBINDIG_SCMB_HASHSIZE -1));
  
         fprintf(_out,"\nType: %s",cimTypeToString(nodeArray[i].type));         fprintf(_out,"\nType: %s",cimTypeToString(nodeArray[i].type));
  
Line 5734 
Line 5711 
  
     fprintf(_out,"\nHash Tag %3u Hash Index %3u",     fprintf(_out,"\nHash Tag %3u Hash Index %3u",
            prop.nameHashTag,            prop.nameHashTag,
            prop.nameHashTag%PEGASUS_PROPERTY_SCMB_HASHSIZE);             prop.nameHashTag & (PEGASUS_PROPERTY_SCMB_HASHSIZE -1));
     fprintf(_out,"\nPropagated: %s isKey: %s",     fprintf(_out,"\nPropagated: %s isKey: %s",
            (prop.flags.propagated?"TRUE":"FALSE"),            (prop.flags.propagated?"TRUE":"FALSE"),
            (prop.flags.isKey?"TRUE":"FALSE")            (prop.flags.isKey?"TRUE":"FALSE")
Line 5768 
Line 5745 
         }         }
         else         else
         {         {
             line = size%16;              line = size & 15;
         }         }
  
  
Line 5886 
Line 5863 
          }          }
          else          else
          {          {
              end = noProperties%64;               end = noProperties & 63;
          }          }
  
          fprintf(_out,"\nkeyPropertyMask[%02u]= ",i);          fprintf(_out,"\nkeyPropertyMask[%02u]= ",i);
  
          for (Uint32 j = 0; j < end; j++)          for (Uint32 j = 0; j < end; j++)
          {          {
              if (j > 0 && !(j%8))               if (j > 0 && !(j & 7))
              {              {
                  fprintf(_out," ");                  fprintf(_out," ");
              }              }
Line 5964 
Line 5941 
         }         }
  
         printLine[1][p] = item/16;         printLine[1][p] = item/16;
         printLine[2][p] = item%16;          printLine[2][p] = item & 15;
  
     }     }
 } }
Line 6400 
Line 6377 
  
   return;   return;
 } }
   #endif // PEGASUS_DEBUG (class SCMODump only in debug builds available)
  
  
 /***************************************************************************** /*****************************************************************************


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2