version 1.3, 2009/12/21 13:06:36
|
version 1.3.4.4, 2013/06/03 22:35:13
|
|
|
// | // |
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// |
// | // |
|
// 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_ |
|
|
* 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; |
|
|
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 |
|
|
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. |
|
|
| |
/** | /** |
* 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. |
|
|
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, Uint32 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. |
*/ | */ |
|
|
const char* getNameSpace_l(Uint32 & 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 |
* set by the used SCMOClass. | * set by the used SCMOClass. |
* The class name and/or name space may differ with the associated class. | * The class name and/or name space may differ with the associated class. |
|
|
| |
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, |
|
|
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]); |
| |
|
|
(SCMBClassPropertyNode*)&(inst.hdr->theClass.ptr->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.ptr->cls.base; | *valueBase = inst.hdr->theClass.ptr->cls.base; |
} | } |
} | } |