CIMMethod Class Reference
#include <CIMMethod.h>
List of all members.
Detailed Description
The CIMMethod class represents the DMTF standard CIM method definition. A CIMMethod is generally defined in the context of a CIMClass. A CIMMethod consists of:
-
A CIMName containing the name of the method
-
A CIMType defining the method return type
-
Zero or more CIMQualifier objects
-
Zero or more CIMParameter objects defining the method parameters
In addition, a CIMMethod has these internal attributes:
-
propagated - An attribute defining whether this CIMMethod is propagated from a superclass. Note that this is normally set as part of completing the definition of objects (resolving) when they are created as part of a CIM schema and is NOT automatically set when creating a method object. It can only be logically set in context of the schema in which the CIMMethod is defined.
-
classOrigin - An attribute defining the class in which this CIMMethod was originally defined. This is normally set within the context of the schema in which the CIMMethod is defined. This attribute is available from objects retrieved from the CIM Server, for example, and provides information on the defintion of this method in the class hierarchy. The propagated and ClassOrigin attributes can be used together to determine if methods originated with this object or were inherited from higher levels of the hiearchy.
The CIMMethod class uses a shared representation model, such that multiple CIMMethod 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 CIMMethod object affects all the CIMMethod objects that refer to the same data copy. The data remains valid until all the CIMMethod objects that refer to it are destructed. A separate copy of the data may be created using the clone method.
Constructor & Destructor Documentation
Constructs an uninitialized CIMMethod 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.
Constructs a CIMMethod object from the value of a specified CIMMethod object, so that both objects refer to the same data copy.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
const CIMMethod cm1(m1);
- Parameters:
-
CIMMethod::CIMMethod |
( |
const CIMName & |
name, |
|
|
CIMType |
type, |
|
|
const CIMName & |
classOrigin = CIMName() , |
|
|
Boolean |
propagated = false | |
|
) |
| | |
Constructs a CIMMethod object with the specified attributes.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
- Parameters:
-
| name | A CIMName specifying the name of the method. |
| type | A CIMType defining the method return type. |
| classOrigin | A CIMName indicating the class in which the method is locally defined (optional). |
| propagated | A Boolean indicating whether the method definition is local to the CIMClass in which it appears or was propagated (without modification) from a superclass. |
- Exceptions:
-
CIMMethod::~CIMMethod |
( |
|
) |
|
Member Function Documentation
Adds a parameter to the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addParameter(CIMParameter(CIMName("ipaddress"), CIMTYPE_STRING));
- Parameters:
-
- Returns:
- A reference to this CIMMethod object.
- Exceptions:
-
Adds a qualifier to the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
- Parameters:
-
- Returns:
- A reference to this CIMMethod object.
- Exceptions:
-
Makes a deep copy of the method. This creates a new copy of all the method attributes including parameters and qualifiers.
- Returns:
- A new copy of the CIMMethod object.
- Exceptions:
-
Uint32 CIMMethod::findParameter |
( |
const CIMName & |
name |
) |
const |
Finds a parameter by name.
Example:
Uint32 posParameter;
posParameter = m1.findParameter(CIMName ("ipaddress"));
if (posParameter != PEG_NOT_FOUND)
...
- Parameters:
-
| name | A CIMName specifying the name of the parameter to be found. |
- Returns:
- Index of the parameter if found or PEG_NOT_FOUND if not found.
- Exceptions:
-
Uint32 CIMMethod::findQualifier |
( |
const CIMName & |
name |
) |
const |
Finds a qualifier by name.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
assert(m1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
- Parameters:
-
| name | A 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:
-
const CIMName& CIMMethod::getClassOrigin |
( |
|
) |
const |
Gets the class in which this method is locally defined. This information is normally available with methods that are part of schema returned from a CIM Server.
- Returns:
- CIMName containing the classOrigin attribute.
- Exceptions:
-
const CIMName& CIMMethod::getName |
( |
|
) |
const |
Gets the name of the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
assert(m1.getName() == CIMName ("getHostName"));
- Returns:
- A CIMName containing the name of the method.
- Exceptions:
-
Gets the parameter at the specified index.
Example:
CIMConstParameter cp;
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
if (parameterIndex != PEG_NOT_FOUND)
{
cp = m1.getParameter(parameterIndex);
}
- Parameters:
-
| index | The index of the parameter to be retrieved. |
- Returns:
- The CIMConstParameter at the specified index.
- Exceptions:
-
Gets the parameter at the specified index.
Example:
CIMParameter cp;
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
if (parameterIndex != PEG_NOT_FOUND)
{
cp = m1.getParameter(parameterIndex);
}
- Parameters:
-
| index | The index of the parameter to be retrieved. |
- Returns:
- The CIMParameter at the specified index.
- Exceptions:
-
Uint32 CIMMethod::getParameterCount |
( |
|
) |
const |
Gets the number of parameters in the method.
- Returns:
- An integer count of the CIMParameters in the CIMMethod.
- Exceptions:
-
Boolean CIMMethod::getPropagated |
( |
|
) |
const |
Tests the propagated attribute of the object. The propagated attribute indicates whether this method was propagated from a higher-level class. Normally this attribute is set as part of defining a method in the context of a schema. It is set in methods retrieved from a CIM Server.
- Returns:
- True if method is propagated; otherwise, false.
- Exceptions:
-
Gets the qualifier at the specified index.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
const CIMMethod m2 = m1;
Uint32 posQualifier = m2.findQualifier(CIMName ("stuff"));
if (posQualifier != PEG_NOT_FOUND)
{
CIMConstQualifier q = m2.getQualifier(posQualifier);
}
- Parameters:
-
| index | The index of the qualifier to be retrieved. |
- Returns:
- The CIMConstQualifier object at the specified index.
- Exceptions:
-
Gets the qualifier at the specified index.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
Uint32 posQualifier = m1.findQualifier(CIMName ("stuff"));
if (posQualifier != PEG_NOT_FOUND)
{
CIMQualifier q = m1.getQualifier(posQualifier);
}
- Parameters:
-
| index | The index of the qualifier to be retrieved. |
- Returns:
- The CIMQualifier object at the specified index.
- Exceptions:
-
Uint32 CIMMethod::getQualifierCount |
( |
|
) |
const |
Gets the number of qualifiers in the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
assert(m1.getQualifierCount() == 2);
- Returns:
- An integer count of the qualifiers in the CIMMethod.
- Exceptions:
-
CIMType CIMMethod::getType |
( |
|
) |
const |
Gets the method return type.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
assert(m1.getType() == CIMTYPE_STRING);
- Returns:
- A CIMType containing the method return type.
- Exceptions:
-
Compares the method with another method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
assert(!m1.identical(m2));
- Parameters:
-
- Returns:
- True if this method is identical to the one specified, false otherwise.
- Exceptions:
-
Boolean CIMMethod::isUninitialized |
( |
|
) |
const |
Determines whether the object has been initialized.
Example:
CIMMethod m1;
assert(m1.isUninitialized());
- Returns:
- True if the object has not been initialized, false otherwise.
Assigns the value of the specified CIMMethod object to this object, so that both objects refer to the same data copy.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
CIMMethod m2;
m2 = m1;
- Parameters:
-
- Returns:
- A reference to this CIMMethod object.
void CIMMethod::removeParameter |
( |
Uint32 |
index |
) |
|
Removes a parameter from the method.
- Parameters:
-
| index | Index of the parameter to be removed. |
- Exceptions:
-
void CIMMethod::removeQualifier |
( |
Uint32 |
index |
) |
|
Removes a qualifier from the method.
Example:
remove all qualifiers from a class
Uint32 count = 0;
while ((count = cimClass.getQualifierCount()) > 0)
cimClass.removeQualifier(count - 1);
- Parameters:
-
| index | The index of the qualifier to remove. |
- Exceptions:
-
void CIMMethod::setClassOrigin |
( |
const CIMName & |
classOrigin |
) |
|
Sets the classOrigin attribute with the specified class name. Normally this method is used internally by a CIM Server when defining methods in the context of a schema.
- Parameters:
-
| classOrigin | A CIMName specifying the name of the class of origin for the method. |
- Exceptions:
-
void CIMMethod::setName |
( |
const CIMName & |
name |
) |
|
Sets the method name.
Example:
CIMMethod m2(CIMName ("test"), CIMTYPE_STRING);
m2.setName(CIMName ("getVersion"));
- Returns:
- A CIMName containing the new name of the method.
- Exceptions:
-
void CIMMethod::setPropagated |
( |
Boolean |
propagated |
) |
|
Sets the propagated attribute. Normally this is used by a CIM Server when defining a method in the context of a schema.
- Parameters:
-
| propagated | A Boolean indicating whether the method is propagated from a superclass. |
- Exceptions:
-
void CIMMethod::setType |
( |
CIMType |
type |
) |
|
Sets the method return type to the specified CIMType. This is the type of the CIMValue that is returned on a CIM method invocation.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.setName(CIMName ("getVersion"));
assert(m1.getName() == CIMName ("getVersion"));
- Parameters:
-
| type | CIMType to be set into the CIMMethod object. |
- Exceptions:
-
The documentation for this class was generated from the following file:
- /root/rpmbuild/BUILD/pegasus/src/Pegasus/Common/CIMMethod.h