CIMInstance Class Reference

#include <CIMInstance.h>

Public Member Functions

 CIMInstance ()
 
 CIMInstance (const CIMInstance &x)
 
 CIMInstance (const CIMObject &x)
 
 CIMInstance (const CIMName &className)
 
CIMInstanceoperator= (const CIMInstance &x)
 
 ~CIMInstance ()
 
const CIMNamegetClassName () const
 
const CIMObjectPathgetPath () const
 
void setPath (const CIMObjectPath &path)
 
CIMInstanceaddQualifier (const CIMQualifier &qualifier)
 
Uint32 findQualifier (const CIMName &name) const
 
CIMQualifier getQualifier (Uint32 index)
 
CIMConstQualifier getQualifier (Uint32 index) const
 
void removeQualifier (Uint32 index)
 
Uint32 getQualifierCount () const
 
CIMInstanceaddProperty (const CIMProperty &x)
 
Uint32 findProperty (const CIMName &name) const
 
CIMProperty getProperty (Uint32 index)
 
CIMConstProperty getProperty (Uint32 index) const
 
void removeProperty (Uint32 index)
 
Uint32 getPropertyCount () const
 
CIMObjectPath buildPath (const CIMConstClass &cimClass) const
 
CIMInstance clone () const
 
Boolean identical (const CIMConstInstance &x) const
 
Boolean isUninitialized () const
 
void instanceFilter (Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList &propertyList)
 

Detailed Description

The CIMInstance class represents the DMTF standard CIM instance definition.

The CIMInstance class uses a shared representation model, such that multiple CIMInstance objects may refer to the same data copy. Assignment and copy operators create new references to the same data, not distinct copies. An update to a CIMInstance object affects all the CIMInstance objects that refer to the same data copy. The data remains valid until all the CIMInstance objects that refer to it are destructed. A separate copy of the data may be created using the clone method.

Constructor & Destructor Documentation

◆ CIMInstance() [1/4]

CIMInstance::CIMInstance ( )

Constructs an uninitialized CIMInstance object. A method invocation on an uninitialized object will result in the throwing of an UninitializedObjectException. An uninitialized object may be converted into an initialized object only by using the assignment operator with an initialized object.

◆ CIMInstance() [2/4]

CIMInstance::CIMInstance ( const CIMInstance x)

Constructs a CIMInstance object from the value of a specified CIMInstance object, so that both objects refer to the same data copy.

Parameters
xThe CIMInstance object from which to construct a new CIMInstance object.

◆ CIMInstance() [3/4]

CIMInstance::CIMInstance ( const CIMObject x)
explicit

Constructs a CIMInstance object from the value of a specified CIMObject object, so that both objects refer to the same data copy.

Parameters
xThe CIMObject object from which to construct the CIMInstance object.
Exceptions
DynamicCastFailedExceptionIf a CIMInstance can not be created from the given CIMObject.

◆ CIMInstance() [4/4]

CIMInstance::CIMInstance ( const CIMName className)

Constructs a CIMInstance object with the specified class name.

Parameters
classNameA CIMName specifying the class name of the instance.

◆ ~CIMInstance()

CIMInstance::~CIMInstance ( )

Destructs the CIMInstance object.

Member Function Documentation

◆ addProperty()

CIMInstance& CIMInstance::addProperty ( const CIMProperty x)

Adds a property to the instance.

Parameters
xThe CIMProperty to be added.
Returns
A reference to this CIMInstance object.
Exceptions
AlreadyExistsExceptionIf a property with the same name already exists in the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ addQualifier()

CIMInstance& CIMInstance::addQualifier ( const CIMQualifier qualifier)

Adds a qualifier to the instance.

Parameters
qualifierThe CIMQualifier to be added.
Returns
A reference to this CIMInstance object.
Exceptions
AlreadyExistsExceptionIf a qualifier with the same name already exists in the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ buildPath()

CIMObjectPath CIMInstance::buildPath ( const CIMConstClass cimClass) const

Builds the object path for this instance, based on the class name and property values in the instance and the Key qualifiers on the properties in the class definition. The returned object path does not include hostname and namespace attributes. Note that this method does not update the path attribute of the CIMInstance.

Returns
A CIMObjectPath containing the object path for the instance.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ clone()

CIMInstance CIMInstance::clone ( ) const

Makes a deep copy of the instance. This creates a new copy of all the instance attributes including qualifiers and properties.

Returns
A new copy of the CIMInstance object.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ findProperty()

Uint32 CIMInstance::findProperty ( const CIMName name) const

Finds a property by name.

Parameters
nameA CIMName specifying the name of the property to be found.
Returns
Index of the property if found or PEG_NOT_FOUND if not found.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ findQualifier()

Uint32 CIMInstance::findQualifier ( const CIMName name) const

Finds a qualifier by name.

Parameters
nameA CIMName specifying the name of the qualifier to be found.
Returns
Index of the qualifier if found or PEG_NOT_FOUND if not found.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ getClassName()

const CIMName& CIMInstance::getClassName ( ) const

Gets the class name of the instance.

Returns
A CIMName containing the class name.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ getPath()

const CIMObjectPath& CIMInstance::getPath ( ) const

Gets the object path for the instance.

Returns
A CIMObjectPath containing the object path.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ getProperty() [1/2]

CIMProperty CIMInstance::getProperty ( Uint32  index)

Gets the property at the specified index.

Parameters
indexThe index of the property to be retrieved.
Returns
The CIMProperty at the specified index.
Exceptions
IndexOutOfBoundsExceptionIf the index is outside the range of properties available for the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ getProperty() [2/2]

CIMConstProperty CIMInstance::getProperty ( Uint32  index) const

Gets the property at the specified index.

Parameters
indexThe index of the property to be retrieved.
Returns
The CIMConstProperty at the specified index.
Exceptions
IndexOutOfBoundsExceptionIf the index is outside the range of properties available for the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ getPropertyCount()

Uint32 CIMInstance::getPropertyCount ( ) const

Gets the number of properties in the instance.

Returns
An integer count of the properties in the CIMInstance.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ getQualifier() [1/2]

CIMQualifier CIMInstance::getQualifier ( Uint32  index)

Gets the qualifier at the specified index.

Parameters
indexThe index of the qualifier to be retrieved.
Returns
The CIMQualifier at the specified index.
Exceptions
IndexOutOfBoundsExceptionIf the index is outside the range of qualifiers available for the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ getQualifier() [2/2]

CIMConstQualifier CIMInstance::getQualifier ( Uint32  index) const

Gets the qualifier at the specified index.

Parameters
indexThe index of the qualifier to be retrieved.
Returns
The CIMConstQualifier at the specified index.
Exceptions
IndexOutOfBoundsExceptionIf the index is outside the range of qualifiers available for the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ getQualifierCount()

Uint32 CIMInstance::getQualifierCount ( ) const

Gets the number of qualifiers in the instance.

Returns
An integer count of the qualifiers in the CIMInstance.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ identical()

Boolean CIMInstance::identical ( const CIMConstInstance x) const

Compares the CIMInstance with a specified CIMConstInstance.

Parameters
xThe CIMConstInstance to be compared.
Returns
True if this instance is identical to the one specified, false otherwise.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

◆ instanceFilter()

void CIMInstance::instanceFilter ( Boolean  includeQualifiers,
Boolean  includeClassOrigin,
const CIMPropertyList propertyList 
)

This is a replacement function for filter(), it has added for backward compatability and it is not optimized for performance. We recommend that it not be used because: a) the response enviroment of OpenPegasus efficiently filters out properties that are not in the PropertyList b) If a provider wants to return just the properties in the propertyList it should NOT put them into the returned instances. Putting them into the instance and then removing them in the provider is a waste of energy.

NOTE: As of CIM 2.14, added a new function to CIMPropertyList (contains) that allows efficient determination if a property is in the propertyList so that the provider can determine if a property is required easily before putting it into a response instance.

Parameters
includeQualifiersBoolean that determines if qualifiers are filtered out of the CIMInstance and any properties
includClassOriginBoolean that determines if the ClassOrigin attribute is filtered out of the CIMInstance
propertyListCIMPropertyList that determines which properties are filtered out of the CIMInstance. Any property not in the propertyList is filtered out of the CIMInstance

◆ isUninitialized()

Boolean CIMInstance::isUninitialized ( ) const

Determines whether the object has been initialized.

Returns
True if the object has not been initialized, false otherwise.

◆ operator=()

CIMInstance& CIMInstance::operator= ( const CIMInstance x)

Assigns the value of the specified CIMInstance object to this object, so that both objects refer to the same data copy.

Parameters
xThe CIMInstance object from which to assign this CIMInstance object.
Returns
A reference to this CIMInstance object.

◆ removeProperty()

void CIMInstance::removeProperty ( Uint32  index)

Removes a property from the instance.

Parameters
indexThe index of the property to remove.
Exceptions
IndexOutOfBoundsExceptionIf the index is outside the range of properties available for the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ removeQualifier()

void CIMInstance::removeQualifier ( Uint32  index)

Removes a qualifier from the instance.

Parameters
indexThe index of the qualifier to remove.
Exceptions
IndexOutOfBoundsExceptionIf the index is outside the range of qualifiers available for the CIMInstance.
UninitializedObjectExceptionIf the object is not initialized.

◆ setPath()

void CIMInstance::setPath ( const CIMObjectPath path)

Sets the object path for the instance.

Parameters
pathA CIMObjectPath containing the object path.
Exceptions
UninitializedObjectExceptionIf the object is not initialized.

The documentation for this class was generated from the following file:
  • /home/loongson/rpmbuild/BUILD/pegasus/src/Pegasus/Common/CIMInstance.h