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

Diff for /pegasus/src/Pegasus/Common/SCMOInstance.h between version 1.1.2.38 and 1.10

version 1.1.2.38, 2009/11/16 17:07:31 version 1.10, 2014/11/13 01:47:06
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
   //
   // This file defines the SCMOInstance interfaces. The implementation of
   // these methods is in SCMO.cpp
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #ifndef _SCMOINSTANCE_H_ #ifndef _SCMOINSTANCE_H_
Line 41 
Line 48 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   PEGASUS_USING_STD;
   
 #define PEGASUS_SCMB_INSTANCE_MAGIC 0xD00D1234 #define PEGASUS_SCMB_INSTANCE_MAGIC 0xD00D1234
  
 class PEGASUS_COMMON_LINKAGE SCMOInstance class PEGASUS_COMMON_LINKAGE SCMOInstance
Line 92 
Line 101 
  
     /**     /**
      * Assignment operator for the SCMO instance,      * Assignment operator for the SCMO instance,
      * @param theSCMOClass The right hand value       * @param theSCMOInstance The right hand value
      **/      **/
     SCMOInstance& operator=(const SCMOInstance& theSCMOInstance)     SCMOInstance& operator=(const SCMOInstance& theSCMOInstance)
     {     {
Line 125 
Line 134 
      * instance.  The TOINSTANCE flavor is ignored.      * instance.  The TOINSTANCE flavor is ignored.
      * @param includeClassOrigin A Boolean indicating whether ClassOrigin      * @param includeClassOrigin A Boolean indicating whether ClassOrigin
      * attributes are to be added to the instance.      * attributes are to be added to the instance.
      * @param propertyList Is an NULL terminated array of char* to property  
      * names defining the properties that are included in the created instance.  
      * If the propertyList is NULL, all properties are included to the instance.  
      * If the propertyList is empty, no properties are added.  
      *      *
      * Note that this function does NOT generate an error if a property name      * Note that this function does NOT generate an error if a property name
      * is supplied that is NOT in the class;      * is supplied that is NOT in the class;
Line 138 
Line 143 
     SCMOInstance(     SCMOInstance(
         SCMOClass& baseClass,         SCMOClass& baseClass,
         Boolean includeQualifiers,         Boolean includeQualifiers,
         Boolean includeClassOrigin,          Boolean includeClassOrigin);
         const char** propertyList);  
  
     /**     /**
      * Builds a SCMOInstance from the given SCMOClass and copies all      * Builds a SCMOInstance from the given SCMOClass and copies all
Line 177 
Line 181 
     SCMOInstance(     SCMOInstance(
         const CIMInstance& cimInstance,         const CIMInstance& cimInstance,
         const char* altNameSpace=0,         const char* altNameSpace=0,
         Uint64 altNSLen=0);          Uint32 altNSLen=0);
  
     /**     /**
      * Builds a SCMOInstance from the given CIMObjectPath copying all data.      * Builds a SCMOInstance from the given CIMObjectPath copying all data.
Line 194 
Line 198 
     SCMOInstance(     SCMOInstance(
         const CIMObjectPath& cimObj,         const CIMObjectPath& cimObj,
         const char* altNameSpace=0,         const char* altNameSpace=0,
         Uint64 altNSLen=0);          Uint32 altNSLen=0);
  
     /**     /**
      * Builds a SCMOInstance from the given CIMObject copying all data.      * Builds a SCMOInstance from the given CIMObject copying all data.
Line 212 
Line 216 
     SCMOInstance(     SCMOInstance(
         const CIMObject& cimObject,         const CIMObject& cimObject,
         const char* altNameSpace=0,         const char* altNameSpace=0,
         Uint64 altNSLen=0);          Uint32 altNSLen=0);
  
     /**     /**
      * Converts the SCMOInstance into a CIMInstance.      * Converts the SCMOInstance into a CIMInstance.
Line 253 
Line 257 
      *              Has to be copied by caller.      *              Has to be copied by caller.
      *              It is set to NULL if rc != SCMO_OK.      *              It is set to NULL if rc != SCMO_OK.
      * @param pvalue Returns a pointer to the value of property.      * @param pvalue Returns a pointer to the value of property.
      *               The value is strored in a SCMBUnion       *               The value is stored in a SCMBUnion
      *                and has to be copied by the caller !      *                and has to be copied by the caller !
      *               It returns NULL if rc != SCMO_OK.      *               It returns NULL if rc != SCMO_OK.
      *      *
Line 289 
Line 293 
         Boolean& isArray,         Boolean& isArray,
         Uint32& size ) const;         Uint32& size ) const;
  
       // KS_FUTURE removed this as not used. Compiles without it
   ////  void getSCMBValuePropertyAt(
   ////      Uint32 pos,
   ////      SCMBValue** value,
   ////      const char ** valueBase,
   ////      SCMBClassProperty ** propDef,
   ////      const char ** classBase) const;
   
     /**     /**
      * Gets the type and value of the named property.      * Gets the type and value of the named property.
      * The value has to be copied by the caller !      * The value has to be copied by the caller !
      * @param name The property name      * @param name The property name
      * @param pvalue Returns a pointer to the value of property.      * @param pvalue Returns a pointer to the value of property.
      *               The value is strored in a SCMBUnion       *               The value is stored in a SCMBUnion
      *                and has to be copied by the caller !      *                and has to be copied by the caller !
      *               It returns NULL if rc != SCMO_OK.      *               It returns NULL if rc != SCMO_OK.
      *      *
Line 330 
Line 342 
  
     /**     /**
      * Set/replace a property in the instance.      * Set/replace a property in the instance.
      * If the class origin is specified, it is honored at identifying       * If the class origin is specified, it is honored when the
      * the property within the instance.       * property is identified within the instance.
        *
      * Note: Only properties which are already part of the instance/class can      * Note: Only properties which are already part of the instance/class can
      * be set/replaced.       * be set/replaced except in for special case where the flag
        * lags.noClassForInstance is set when the instance is created.
        * If the class is not found in the repository, the instance is
        * are marked as noClassForInstance and properties are set in
        * the UserDefined properties area.
      * @param name The name of the property to be set.      * @param name The name of the property to be set.
      * @param type The CIMType of the property       * @param theType The CIMType of the property
      * @param value A pointer to the value to be set at the named property.      * @param value A pointer to the value to be set at the named property.
      *              The value has to be in a SCMBUnion.       *              The value must be in a SCMBUnion.
      *              The value is copied into the instance      *              The value is copied into the instance
      *              If the value == NULL, a null value is assumed.      *              If the value == NULL, a null value is assumed.
      *              If the value is an array, the value array has to be      *              If the value is an array, the value array has to be
Line 351 
Line 368 
      *              If the value is type of CIMTYPE_STRING,      *              If the value is type of CIMTYPE_STRING,
      *              the string is referenced by the structure      *              the string is referenced by the structure
      *              SCMBUnion.extString:      *              SCMBUnion.extString:
      *                       pchar contains the absolut pointer to the string       *                       pchar contains the absolute pointer to
      *                       length contains the size of the string       *                       the string length contains the size of
        *                       the string
      *                              without trailing '\0'.      *                              without trailing '\0'.
      * @param isArray Indicate that the value is an array. Default false.      * @param isArray Indicate that the value is an array. Default false.
      * @param size Returns the size of the array. If not an array this      * @param size Returns the size of the array. If not an array this
      *         this parameter is ignorer. Default 0.       *         this parameter is ignored. Default 0.
      * @param origin The class originality of the property.      * @param origin The class originality of the property.
      *               If NULL, then it is ignorred. Default NULL.       *               If NULL, then it is ignored. Default NULL.
      * @return     SCMO_OK      * @return     SCMO_OK
      *             SCMO_NOT_SAME_ORIGIN : The property name was found, but      *             SCMO_NOT_SAME_ORIGIN : The property name was found, but
      *                                    the origin was not the same.      *                                    the origin was not the same.
Line 369 
Line 387 
      */      */
     SCMO_RC setPropertyWithOrigin(     SCMO_RC setPropertyWithOrigin(
         const char* name,         const char* name,
         CIMType type,          CIMType theType,
         const SCMBUnion* value,         const SCMBUnion* value,
         Boolean isArray=false,         Boolean isArray=false,
         Uint32 size = 0,         Uint32 size = 0,
Line 383 
Line 401 
     void buildKeyBindingsFromProperties();     void buildKeyBindingsFromProperties();
  
     /**     /**
      * Set/replace a property filter on an instance.  
      * The filter is a white list of property names.  
      * A property part of the list can be accessed by name or index and  
      * is eligible to be returned to requester.  
      * Key properties can not be filtered. They are always a part of the  
      * instance. If a key property is not part of the property list,  
      * it will not be filtered out.  
      * @param propertyList Is an NULL terminated array of char* to  
      * property names  
      */  
     void setPropertyFilter(const char **propertyList);  
   
     /**  
      * Gets the hash index for the named property. Filtering is ignored.      * Gets the hash index for the named property. Filtering is ignored.
      * @param theName The property name      * @param theName The property name
      * @param pos Returns the hash index.      * @param pos Returns the hash index.
Line 405 
Line 410 
      */      */
     SCMO_RC getPropertyNodeIndex(const char* name, Uint32& pos) const;     SCMO_RC getPropertyNodeIndex(const char* name, Uint32& pos) const;
  
       // KS_FUTURE confirm that the following is used in OpenPegasus
       // Apprently never referenced within any of OpenPegasus code
     /**     /**
      * Set/replace a property in the instance at node index.      * Set/replace a property in the instance at node index.
      * Note: If node is filtered, the property is not set but the return value  
      * is still SCMO_OK.  
      * @param index The node index.      * @param index The node index.
      * @param type The CIMType of the property      * @param type The CIMType of the property
      * @param pInVal A pointer to the value to be set at the named property.      * @param pInVal A pointer to the value to be set at the named property.
Line 540 
Line 545 
         CIMType& type,         CIMType& type,
         const SCMBUnion** keyvalue) const;         const SCMBUnion** keyvalue) const;
  
       SCMO_RC getKeyBindingAtUnresolved(
           Uint32 node,
           const char** pname,
           Uint32 & pnameLen,
           CIMType& type,
           const SCMBUnion** pdata,
           const char** valueBase) const;
   
     /**     /**
      * Get the named key binding.      * Get the named key binding.
      * @parm name The name of the key binding.      * @parm name The name of the key binding.
      * @param type Returns the type as CIMType.      * @param type Returns the type as CIMType.
      *             It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.      *             It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.
      * @param keyvalue Returns a pointer to the value of keybinding.      * @param keyvalue Returns a pointer to the value of keybinding.
      *               The value is strored in a SCMBUnion       *               The value is stored in a SCMBUnion
      *                and has to be copied by the caller !      *                and has to be copied by the caller !
      *               It returns NULL if rc != SCMO_OK.      *               It returns NULL if rc != SCMO_OK.
      *      *
Line 578 
Line 591 
     /**     /**
      * Determines if the SCMOInstance does not contain any property information.      * Determines if the SCMOInstance does not contain any property information.
      * Maybe only the class name and/or name space are available.      * Maybe only the class name and/or name space are available.
      * @return True if the SCMOInstacne is empty, false otherwise.       * @return True if the SCMOInstance is empty, false otherwise.
      */      */
     Boolean isEmpty( ) const {return (inst.hdr->theClass->isEmpty()); };      Boolean isEmpty( ) const;
  
     /**     /**
      * Determines whether the instance is used as a class container.      * Determines whether the instance is used as a class container.
Line 612 
Line 625 
     void setHostName(const char* hostName);     void setHostName(const char* hostName);
  
     /**     /**
      * Sets the provided host name unchecked at the instance.  
      * @param hostName The host name as UTF8.  
      * @param len The strlen of the host name.  
      */  
     void setHostName_l(const char* hostName, Uint64 len);  
   
     /**  
      * Get the host name of the instance. The caller has to make a copy !      * Get the host name of the instance. The caller has to make a copy !
      * @return The host name as UTF8.      * @return The host name as UTF8.
      */      */
Line 629 
Line 635 
      * @param Return strlen of result string.      * @param Return strlen of result string.
      * @return The class name as UTF8.      * @return The class name as UTF8.
      */      */
     const char* getHostName_l(Uint64 & length) const;      const char* getHostName_l(Uint32 & length) const;
  
     /**     /**
      * Sets the provided class name at the instance. By caling this function      * Sets the provided class name at the instance. By caling this function
Line 644 
Line 650 
      * @param className The class name as UTF8.      * @param className The class name as UTF8.
      * @param len The strlen of the name space.      * @param len The strlen of the name space.
      */      */
     void setClassName_l(const char* className, Uint64 len);      void setClassName_l(const char* className, Uint32 len);
  
     /**     /**
      * Get the class name of the instance. The caller has to make a copy !      * Get the class name of the instance. The caller has to make a copy !
Line 657 
Line 663 
      * @param lenght Return strlen of result string.      * @param lenght Return strlen of result string.
      * @return The class name as UTF8.      * @return The class name as UTF8.
      */      */
     const char* getClassName_l(Uint64 & length) const;      const char* getClassName_l(Uint32 & length) const;
  
     /**     /**
      * Sets the provided name space name at the instance.      * Sets the provided name space name at the instance.
Line 674 
Line 680 
      * @param nameSpaceName The name space name as UTF8.      * @param nameSpaceName The name space name as UTF8.
      * @param len The strlen of the name space.      * @param len The strlen of the name space.
      */      */
     void setNameSpace_l(const char* nameSpace, Uint64 len);      void setNameSpace_l(const char* nameSpace, Uint32 len);
  
     /**     /**
      * Get the name space of the instance. The caller has to make a copy !      * Get the name space of the instance. The caller has to make a copy !
Line 687 
Line 693 
      * @param Return strlen of result string.      * @param Return strlen of result string.
      * @return The class name as UTF8.      * @return The class name as UTF8.
      */      */
     const char* getNameSpace_l(Uint64 & length) const;      const char* getNameSpace_l(Uint32 & length) const;
   
       /**
        * If hostname or namespace of the SCMOInstance are NULL or empty string,
        * replace them with the given input.
        * @param hn The host name to apply to the SCMOInstance.
        * @param hnLen The length of the hostname in byte without closing zero.
        * @param ns The namespace name to apply to the SCMOInstance.
        * @param nsLen The length of the hostname in byte without closing zero.
        */
       void completeHostNameAndNamespace(
           const char* hn,
           Uint32 hnLen,
           const char* ns,
           Uint32 nsLen);
  
     /**     /**
      * Is the name space or class name of the instance the origianl values      * Is the name space or class name of the instance the origianl values
Line 701 
Line 721 
         return inst.hdr->flags.isCompromised;         return inst.hdr->flags.isCompromised;
     };     };
  
       /**
           returns true if there is no class defined for this instance.
           The flag is set when the SCMO instance is created and the
           repository returns no class.
       */
       Boolean noClassForInstance() const
       {
           return inst.hdr->flags.noClassForInstance;
       };
  
     /**     /**
      * Mark the instance as a non validated instance.      * Mark the instance as a non validated instance.
Line 711 
Line 740 
     };     };
  
     /**     /**
           Sets the flag indicating that there is no class for this
           instance. This property is used for Instances that are
           created where there is no class in the repository.
       */
       void markNoClassForInstance(Boolean x)
       {
           inst.hdr->flags.noClassForInstance = x;
       };
   
       /**
      *  To indicate the export processing ( eg. XMLWriter )      *  To indicate the export processing ( eg. XMLWriter )
      *  to include qualifiers for this instance.      *  to include qualifiers for this instance.
      */      */
Line 775 
Line 814 
     void Ref()     void Ref()
     {     {
         inst.hdr->refCount++;         inst.hdr->refCount++;
         // printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get());  
     };     };
  
     void Unref()     void Unref()
     {     {
         if (inst.hdr->refCount.decAndTestIfZero())         if (inst.hdr->refCount.decAndTestIfZero())
         {         {
             // printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get());              // All external references have to be destroyed.
             // All external references has to be destroyed.  
             _destroyExternalReferences();             _destroyExternalReferences();
             // The class has also be dereferenced.             // The class has also be dereferenced.
             delete inst.hdr->theClass;              delete inst.hdr->theClass.ptr;
             free(inst.base);             free(inst.base);
             inst.base=NULL;             inst.base=NULL;
         }         }
         else  
         {  
             // printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get());  
         }  
  
     };     };
  
Line 802 
Line 835 
     {     {
         if ( 1 < inst.hdr->refCount.get() )         if ( 1 < inst.hdr->refCount.get() )
         {         {
             fprintf(stderr,"!! Copy on Write (%d) !!\n",              SCMBInstance_Main * oldRef = inst.hdr;
                     inst.hdr->refCount.get() );              SCMBMgmt_Header* oldMgmt = inst.mem;
   
             _clone();             _clone();
               if (oldRef->refCount.decAndTestIfZero())
               {
                   // All external references have to be destroyed.
                   _destroyExternalReferencesInternal(oldMgmt);
                   // The class has also be dereferenced.
                   delete oldRef->theClass.ptr;
                   free((void*)oldRef);
                   oldRef=0;
               }
         }         }
     };     };
  
Line 822 
Line 865 
  
     void _setCIMInstance(const CIMInstance& cimInstance);     void _setCIMInstance(const CIMInstance& cimInstance);
  
       // Internal but used by friend class SCMOXmlWriter.cpp
       // This function accounts for user-defined and class-defined properties
     void _getPropertyAt(     void _getPropertyAt(
         Uint32 pos,         Uint32 pos,
         SCMBValue** value,         SCMBValue** value,
Line 865 
Line 910 
     static SCMOClass _getSCMOClass(     static SCMOClass _getSCMOClass(
         const CIMObjectPath& theCIMObj,         const CIMObjectPath& theCIMObj,
         const char* altNS,         const char* altNS,
         Uint64 altNSlength);          Uint32 altNSlength);
  
     CIMProperty _getCIMPropertyAtNodeIndex(Uint32 nodeIdx) const;     CIMProperty _getCIMPropertyAtNodeIndex(Uint32 nodeIdx) const;
  
Line 890 
Line 935 
         SCMBMgmt_Header** pmem,         SCMBMgmt_Header** pmem,
         CIMType type,         CIMType type,
         Uint64 startNS,         Uint64 startNS,
         Uint64 lenNS,          Uint32 lenNS,
         Union& u);         Union& u);
  
     static void _setUnionArrayValue(     static void _setUnionArrayValue(
Line 899 
Line 944 
         CIMType type,         CIMType type,
         Uint32& n,         Uint32& n,
         Uint64 startNS,         Uint64 startNS,
         Uint64 lenNS,          Uint32 lenNS,
         Union& u);         Union& u);
  
     static void _setExtRefIndex(SCMBUnion* pInst, SCMBMgmt_Header** pmem);     static void _setExtRefIndex(SCMBUnion* pInst, SCMBMgmt_Header** pmem);
Line 913 
Line 958 
  
     void _copyKeyBindings(SCMOInstance& targetInst) const;     void _copyKeyBindings(SCMOInstance& targetInst) const;
  
     Uint32 _initPropFilterWithKeys();  
   
     void _setPropertyInPropertyFilter(Uint32 i);  
   
     Boolean _isPropertyInFilter(Uint32 i) const;  
   
     void _clearPropertyFilter();  
   
     void _setKeyBindingFromSCMBUnion(     void _setKeyBindingFromSCMBUnion(
         CIMType type,         CIMType type,
         const SCMBUnion& u,         const SCMBUnion& u,
Line 942 
Line 979 
         char* elementBase);         char* elementBase);
     /**     /**
      * Set a SCMO user defined key binding using the class CIM type tolerating      * Set a SCMO user defined key binding using the class CIM type tolerating
      * CIM key binding types converted to CIM types by fuction       * CIM key binding types converted to CIM types by function
      *  _CIMTypeFromKeyBindingType().      *  _CIMTypeFromKeyBindingType().
      *      *
      * @parm classType The type of the key binding in the class definition      * @parm classType The type of the key binding in the class definition
Line 971 
Line 1008 
         SCMBKeyBindingValue& scmoKBV         SCMBKeyBindingValue& scmoKBV
         );         );
  
       // Functions to support the use of user defined properties
       /*
           Get the node for a user defined property.
           @return node of the property and SCMO_OK or an error
           SCMO_NOT_FOUND indicating that the property cannot be
           found as a user-defined property.
       */
       SCMO_RC _getUserPropertyNodeIndex(Uint32& node, const char* name) const;
   
       /*
           get the Instance SCMBUserPropertyElement for the defined node index.
       */
       SCMBUserPropertyElement*
            _getUserDefinedPropertyElementAt(Uint32 index) const;
   
       void _setPropertyInUserDefinedElement(
           SCMBUserPropertyElement* ptrNewElement,
           CIMType theType,
           const SCMBUnion* pinVal,
           Boolean isArray,
           Uint32 size);
       /**
           Creates a new user-defined property element, chains it to
           the existing user-defined property chain, and populate it
           with name, type, isArray. isSet = false.
           @return pointer to new SCMBUserPropertyElement
       */
       SCMBUserPropertyElement* _createNewUserDefinedProperty(
           const char * name,
           Uint32 nameLen,
           CIMType theType);
   
       /*
           Returns true if the Property is in the set of
           properties defined in an including class
       */
       Boolean _isClassDefinedProperty(Uint32 node) const;
  
       SCMBValue& _getSCMBValueForNode(Uint32 node) const;
   
       /* Definition of inst. Pointer to:
               SCMBInstance_Manin
               SCMBMgmt_Header
               or generic base pointer.
       */
     union{     union{
         // To access the instance main structure         // To access the instance main structure
         SCMBInstance_Main *hdr;         SCMBInstance_Main *hdr;
Line 987 
Line 1068 
     friend class SCMOStreamer;     friend class SCMOStreamer;
 }; };
  
   
   inline SCMBValue& SCMOInstance::_getSCMBValueForNode(Uint32 node) const
   {
       if (_isClassDefinedProperty(node))
       {
           SCMBValue *theInstPropNodeArray =
               (SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]);
   
           return theInstPropNodeArray[node];
       }
   
       SCMBUserPropertyElement* pElement =
          _getUserDefinedPropertyElementAt(node);
   
       return pElement->value;
   }
   
   
   // KS_TODO clarify this test since our rule is more explicit
   // We cannot have both user-defined and class-defined properties so this
   // could be a more concrete tests.
   inline Boolean SCMOInstance::_isClassDefinedProperty(Uint32 node) const
   {
       return (node < inst.hdr->numberProperties);
   }
   
   // This internal function used by SCMOXmlWriter.cpp
   // It is inline because it is called only once in the CIMServer.
 inline void SCMOInstance::_getPropertyAt( inline void SCMOInstance::_getPropertyAt(
     Uint32 pos,     Uint32 pos,
     SCMBValue** value,     SCMBValue** value,
     const char ** valueBase,     const char ** valueBase,
     SCMBClassProperty ** propDef) const      SCMBClassProperty ** propertyDef) const
 { {
     Uint32 node;      if (_isClassDefinedProperty(pos))
     // is filtering on ?  
     if (inst.hdr->flags.isFiltered)  
     {  
         // Get absolut pointer to property filter index map of the instance  
         Uint32* propertyFilterIndexMap =  
         (Uint32*)&(inst.base[inst.hdr->propertyFilterIndexMap.start]);  
         // get the real node index of the property.  
         node = propertyFilterIndexMap[pos];  
     }  
     else  
     {     {
         // the index is used as node index.  
         node = pos;  
     }  
   
     SCMBValue* theInstPropNodeArray =     SCMBValue* theInstPropNodeArray =
         (SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]);         (SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]);
  
     // create a pointer to property node array of the class.     // create a pointer to property node array of the class.
     Uint64 idx = inst.hdr->theClass->cls.hdr->propertySet.nodeArray.start;          Uint64 idx =
               inst.hdr->theClass.ptr->cls.hdr->propertySet.nodeArray.start;
     SCMBClassPropertyNode* theClassPropNodeArray =     SCMBClassPropertyNode* theClassPropNodeArray =
         (SCMBClassPropertyNode*)&(inst.hdr->theClass->cls.base)[idx];              (SCMBClassPropertyNode*)&(inst.hdr->theClass.ptr->cls.base)[idx];
  
     // return the absolute pointer to the property definition     // return the absolute pointer to the property definition
     *propDef= &(theClassPropNodeArray[node].theProperty);          *propertyDef = &(theClassPropNodeArray[pos].theProperty);
  
     // need check if property set or not, if not set use the default value     // need check if property set or not, if not set use the default value
     if (theInstPropNodeArray[node].flags.isSet)          if (theInstPropNodeArray[pos].flags.isSet)
     {     {
         // return the absolute pointer to the property value in the instance         // return the absolute pointer to the property value in the instance
         *value = &(theInstPropNodeArray[node]);              *value = &(theInstPropNodeArray[pos]);
         *valueBase = inst.base;         *valueBase = inst.base;
     }     }
     else     else
     {     {
         // return the absolute pointer to         // return the absolute pointer to
         *value = &(theClassPropNodeArray[node].theProperty.defaultValue);              *value = &(theClassPropNodeArray[pos].theProperty.defaultValue);
         *valueBase = inst.hdr->theClass->cls.base;              *valueBase = inst.hdr->theClass.ptr->cls.base;
           }
     }     }
       else           // User-defined property
       {
           // KS_TODO mostly same code as _getPropertyAtNodeIndex
           SCMBUserPropertyElement* pElement =
               _getUserDefinedPropertyElementAt(pos);
   
           PEGASUS_ASSERT(pElement != 0);
   
           *value = &(pElement->value);
           // KS_TODO do we have to deal with isSet == false here. Probably
           // no but confirm with Assert.
           *valueBase = inst.base;
 } }
   }
   
   inline Uint32 SCMOInstance::getPropertyCount() const
   {
       return(inst.hdr->numberProperties + inst.hdr->numberUserProperties);
   }
   
   // KS_FUTURE Remove this completely from code since apparently not used.
   ////// Apparently never used.
   ////inline void SCMOInstance::getSCMBValuePropertyAt(
   ////    Uint32 pos,
   ////    SCMBValue** value,
   ////    const char ** valueBase,
   ////    SCMBClassProperty ** propDef,
   ////    const char ** propDefBase) const
   ////{
   ////    _getPropertyAt(pos,value,valueBase,propDef);
   ////
   ////    *propDefBase = inst.hdr->theClass.ptr->cls.base;
   ////}
   
   inline SCMO_RC SCMOInstance::getKeyBindingAtUnresolved(
           Uint32 node,
           const char** pname,
           Uint32 & pnameLen,
           CIMType& type,
           const SCMBUnion** pdata,
           const char** valueBase) const
   {
       SCMO_RC rc = _getKeyBindingDataAtNodeIndex(node,pname,pnameLen,type,pdata);
       // Adjust size to string length
       if (pnameLen)
       {
           pnameLen--;
       }
       *valueBase = inst.base;
       return rc;
   }
   
   inline Boolean SCMOInstance::isEmpty( ) const
   {
       if (noClassForInstance())
       {
           // KS_TODO need another test for empty. Number properties
           // != 0 might work but that would disallow an empty embedded
           // instance.
           return false;
       }
       else
       {
           return (inst.hdr->theClass.ptr->isEmpty());
       }
   }
   
   
  
 #define PEGASUS_ARRAY_T SCMOInstance #define PEGASUS_ARRAY_T SCMOInstance
 # include <Pegasus/Common/ArrayInter.h> # include <Pegasus/Common/ArrayInter.h>


Legend:
Removed from v.1.1.2.38  
changed lines
  Added in v.1.10

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2