(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.43 and 1.8

version 1.1.2.43, 2009/12/04 10:44:45 version 1.8, 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
   //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #ifndef _SCMOINSTANCE_H_ #ifndef _SCMOINSTANCE_H_
Line 125 
Line 130 
      * 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 139 
     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 177 
     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 194 
     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 212 
     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 390 
Line 390 
     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 414 
Line 401 
  
     /**     /**
      * 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 595 
Line 580 
      * 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 SCMOInstacne is empty, false otherwise.
      */      */
     Boolean isEmpty( ) const {return (inst.hdr->theClass->isEmpty()); };      Boolean isEmpty( ) const {return (inst.hdr->theClass.ptr->isEmpty()); };
  
     /**     /**
      * Determines whether the instance is used as a class container.      * Determines whether the instance is used as a class container.
Line 627 
Line 612 
     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 644 
Line 622 
      * @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 659 
Line 637 
      * @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 672 
Line 650 
      * @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 689 
Line 667 
      * @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 702 
Line 680 
      * @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 799 
Line 791 
             // All external references has 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;
         }         }
Line 812 
Line 804 
         if ( 1 < inst.hdr->refCount.get() )         if ( 1 < inst.hdr->refCount.get() )
         {         {
             SCMBInstance_Main * oldRef = inst.hdr;             SCMBInstance_Main * oldRef = inst.hdr;
               SCMBMgmt_Header* oldMgmt = inst.mem;
   
             _clone();             _clone();
             if (oldRef->refCount.decAndTestIfZero())             if (oldRef->refCount.decAndTestIfZero())
             {             {
                 // All external references has to be destroyed.                 // All external references has to be destroyed.
                 _destroyExternalReferencesInternal((SCMBMgmt_Header*)oldRef);                  _destroyExternalReferencesInternal(oldMgmt);
                 // The class has also be dereferenced.                 // The class has also be dereferenced.
                 delete oldRef->theClass;                  delete oldRef->theClass.ptr;
                 free((void*)oldRef);                 free((void*)oldRef);
                 oldRef=0;                 oldRef=0;
             }             }
Line 882 
Line 876 
     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 907 
Line 901 
         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 916 
Line 910 
         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 930 
Line 924 
  
     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 1010 
Line 996 
     const char ** valueBase,     const char ** valueBase,
     SCMBClassProperty ** propDef) const     SCMBClassProperty ** propDef) const
 { {
     Uint32 node;  
     // 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);      *propDef= &(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;
     }     }
 } }
  
Line 1061 
Line 1031 
 { {
     _getPropertyAt(pos,value,valueBase,propDef);     _getPropertyAt(pos,value,valueBase,propDef);
  
     *propDefBase = inst.hdr->theClass->cls.base;      *propDefBase = inst.hdr->theClass.ptr->cls.base;
 } }
  
 inline SCMO_RC SCMOInstance::getKeyBindingAtUnresolved( inline SCMO_RC SCMOInstance::getKeyBindingAtUnresolved(
Line 1073 
Line 1043 
         const char** valueBase) const         const char** valueBase) const
 { {
     SCMO_RC rc = _getKeyBindingDataAtNodeIndex(node,pname,pnameLen,type,pdata);     SCMO_RC rc = _getKeyBindingDataAtNodeIndex(node,pname,pnameLen,type,pdata);
       // Adjust size to string length
       if (pnameLen)
       {
           pnameLen--;
       }
     *valueBase = inst.base;     *valueBase = inst.base;
     return rc;     return rc;
 } }


Legend:
Removed from v.1.1.2.43  
changed lines
  Added in v.1.8

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2