|
In file ../../src/Pegasus/Common/CIMMethod.h:
The CIMMethod class is used to represent CIM methods in Pegasus.
Documentation
The CIMMethod class is used to represent CIM methods in Pegasus.
A CIMMethod consists of the following entities:
- Name of the method, a CIMName.
- CIM type of the method return value, a CIMType.
- Optional qualifiers (see CIMQualifier) for the method.
A method can contain zero or more CIMQualifier objects.
- Optional parameters (see CIMParameter) for the method.
A CIMMethod may contain zero or more CIMParameter objects.
In addition, a CIMMethod contains the following 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 local 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. Together the
propagated and ClassOrigin attributes can be used to determine if
methods originated with the current object or were inherited from
higher levels in the hiearchy.
A CIMMethod is generally defined in the context of a CIMClass.
CIMMethod uses shared representations, meaning that multiple
CIMMethod objects may refer to the same copy of data. Assignment and copy
operators create new references to the same data, not distinct copies.
A distinct copy may be created using the clone method.
Classes
Inheritance:
Public Methods
| CIMMethod ()
Creates a new uninitialized CIMMethod object.
|
| CIMMethod (const CIMMethod& x)
Creates a new CIMMethod object from another CIMMethod object.
|
| CIMMethod ( const CIMName& name, CIMType type, const CIMName& classOrigin = CIMName(), Boolean propagated = false)
Creates a CIMMethod object with the specified attributes.
|
| ~CIMMethod ()
Destructor for the CIMMethod.
|
CIMMethod& | operator= (const CIMMethod& x)
The assignment operator assigns one CIMMethod to another.
|
const CIMName& | getName () const
Gets the name of the method.
|
void | setName (const CIMName& name)
Sets the method name.
|
CIMType | getType () const
Gets the method return type.
|
void | setType (CIMType type)
Sets the method return type to the specified CIMType.
|
const CIMName& | getClassOrigin () const
Gets the class in which this method was defined.
|
void | setClassOrigin (const CIMName& classOrigin)
Sets the classOrigin attribute with the specified class name.
|
Boolean | getPropagated () const
Tests the propagated attribute of the object.
|
void | setPropagated (Boolean propagated)
Sets the propagated attribute.
|
CIMMethod& | addQualifier (const CIMQualifier& x)
Adds the specified qualifier to the CIMMethod object.
|
Uint32 | findQualifier (const CIMName& name) const
Searches for a qualifier with the specified input name.
|
CIMQualifier | getQualifier (Uint32 index)
Gets the CIMQualifier defined by the input parameter.
|
CIMConstQualifier | getQualifier (Uint32 index) const
Gets the CIMQualifier defined by the input parameter.
|
void | removeQualifier (Uint32 index)
Removes the specified qualifier from this method.
|
Uint32 | getQualifierCount () const
Returns the number of Qualifiers attached to this CIMMethod object.
|
CIMMethod& | addParameter (const CIMParameter& x)
Adds the parameter defined by the input to the CIMMethod.
|
Uint32 | findParameter (const CIMName& name) const
Finds the parameter with the specified name.
|
CIMParameter | getParameter (Uint32 index)
Gets the parameter defined by the specified index.
|
CIMConstParameter | getParameter (Uint32 index) const
Gets the parameter defined by the specified index.
|
void | removeParameter (Uint32 index)
Removes the parameter defined by the specified index.
|
Uint32 | getParameterCount () const
Gets the count of Parameters defined in the CIMMethod.
|
Boolean | isUninitialized () const
Determines if the object has not been initialized.
|
Boolean | identical (const CIMConstMethod& x) const
Compares with a CIMConstMethod.
|
CIMMethod | clone () const
Makes a clone (deep copy) of this method.
|
- CIMMethod()
- Creates a new uninitialized CIMMethod object.
The only thing that can be done with this object is to copy another
object into it. Other methods, such as setName, will fail with an
UninitializedObjectException. The object has an uninitialized state,
which can be tested with the isUninitialized method.
- See Also:
- isUninitialized()
UninitializedObjectException
- CIMMethod(const CIMMethod& x)
- Creates a new CIMMethod object from another CIMMethod object.
The new CIMMethod object references the same copy of data as the
specified object; no copy is made.
- Parameters:
- x - CIMMethod object from which to create the new CIMMethod object.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
const CIMMethod cm1(m1);
Classes
- CIMMethod( const CIMName& name, CIMType type, const CIMName& classOrigin = CIMName(), Boolean propagated = false)
- Creates a CIMMethod object with the specified attributes.
- Parameters:
- name - CIMName defining the name for the method.
type - CIMType defining the method return type.
classOrigin - (optional) CIMName representing the class origin.
Note that this should normally not be used. If not provided set to
CIMName() (Null name).
propagated - Optional flag indicating whether the definition of
the CIM Method is local to the CIM Class (respectively, Instance)
in which it appears, or was propagated without modification from
a superclass. Default is false. Note that this attribute is
normally not set by CIM Clients but is used internally within the
CIM Server.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
- ~CIMMethod()
- Destructor for the CIMMethod. The shared data copy remains valid until
all referring objects are destructed.
Classes
- CIMMethod& operator=(const CIMMethod& x)
- The assignment operator assigns one CIMMethod to another.
After the assignment, both CIMMethod objects refer to the same
data copy; a distinct copy is not created.
- Parameters:
- x - CIMMethod object from which to assign this CIMMethod object.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
CIMMethod m2;
m2 = m1;
- const CIMName& getName() const
- Gets the name of the method.
- Returns:
- CIMName with the name of the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
assert(m1.getName() == CIMName ("getHostName"));
- void setName(const CIMName& name)
- Sets the method name.
- Parameters:
- name - CIMName for the method name. Replaces any
previously defined name for this method object.
Example:
CIMMethod m2(CIMName ("test"), CIMTYPE_STRING);
m2.setName(CIMName ("getVersion"));
- CIMType getType() const
- Gets the method return type.
- Throws:
- UninitializedObjectException Thrown if the object is not
initialized.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
assert(m1.getType() == CIMTYPE_STRING);
- Returns:
- A CIMType containing the method return type.
- void 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.
- Throws:
- UninitializedObjectException Thrown if the object is not
initialized.
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.
- const CIMName& getClassOrigin() const
- Gets the class in which this method was defined. This information
is normally available with methods that are part of a schema
returned from a CIM Server.
- Returns:
- CIMName containing the classOrigin attribute.
- void 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.
- Throws:
- UninitializedObjectException Thrown if the object is not
initialized.
- Parameters:
- classOrigin - CIMName parameter defining the name
of the origin class.
- Boolean 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.
- void 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.
- Throws:
- UninitializedObjectException Thrown if the object is not
initialized.
- Parameters:
- propagated - Flag indicating whether the method is propagated
from a superclass.
- CIMMethod& addQualifier(const CIMQualifier& x)
- Adds the specified qualifier to the CIMMethod object.
- Throws:
- AlreadyExistsException Thrown if the qualifier already
exists in this CIMMethod.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
- Parameters:
- x - CIMQualifier object representing the qualifier
to be added.
- Returns:
- The CIMMethod object after adding the specified qualifier.
- Uint32 findQualifier(const CIMName& name) const
- Searches for a qualifier with the specified input name.
- Throws:
- UninitializedObjectException Thrown if the object is not
initialized.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
assert(m1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
- Parameters:
- name - CIMName of the qualifier to be found.
- Returns:
- Zero origin index of the qualifier found or PEG_NOT_FOUND
if not found.
- CIMQualifier getQualifier(Uint32 index)
- Gets the CIMQualifier defined by the input parameter.
- Throws:
- IndexOutOfBoundsException Thrown if the index is
outside the range of parameters available from the CIMMethod.
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 - Zero origin index of the qualifier requested.
- Returns:
- CIMQualifier object representing the qualifier found.
- CIMConstQualifier getQualifier(Uint32 index) const
- Gets the CIMQualifier defined by the input parameter.
- Throws:
- IndexOutOfBoundsException Thrown if the index is
outside the range of parameters available from the CIMMethod.
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 - Zero origin index of the qualifier requested.
- Returns:
- CIMQualifier object representing the qualifier found.
- void removeQualifier(Uint32 index)
- Removes the specified qualifier from this method.
- Throws:
- IndexOutOfBoundsException Thrown if the index is
outside the range of parameters available from the CIMMethod.
Example:
remove all qualifiers from a class
Uint32 count = 0;
while((count = cimClass.getQualifierCount()) > 0)
cimClass.removeQualifier(count - 1);
- Parameters:
- index - Index of the qualifier to remove.
- Uint32 getQualifierCount() const
- Returns the number of Qualifiers attached to this CIMMethod object.
- Returns:
- The number of qualifiers attached to the CIM Method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
assert(m1.getQualifierCount() == 2);
- CIMMethod& addParameter(const CIMParameter& x)
- Adds the parameter defined by the input to the CIMMethod.
- Throws:
- UninitializedObjectException Thrown if the object is not
initialized.
AlreadyExistsException Thrown if the parameter already
exists in this CIMMethod.
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addParameter(CIMParameter(CIMName ("ipaddress"), CIMTYPE_STRING));
- Parameters:
- x - CIMParameter to be added to the CIM Method.
- Returns:
- CIMMethod object after the specified parameter is added.
Example:
- Uint32 findParameter(const CIMName& name) const
- Finds the parameter with the specified name.
- Parameters:
- name - CIMName of parameter to be found.
- Returns:
- Index of the parameter object found or PEG_NOT_FOUND
if the property is not found.
Example:
Uint32 posParameter;
posParameter = m1.findParameter(CIMName ("ipaddress"));
if (posParameter != PEG_NOT_FOUND)
...
- CIMParameter getParameter(Uint32 index)
- Gets the parameter defined by the specified index.
- Throws:
- IndexOutOfBoundsException Thrown if the index is outside
the range of available parameters.
Example:
CIMParameter cp;
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
if (parameterIndex != PEG_NOT_FOUND)
{
cp = m1.getParameter(parameterIndex);
}
- Parameters:
- index - Index for the parameter to be returned.
- Returns:
- CIMParameter object requested.
- CIMConstParameter getParameter(Uint32 index) const
- Gets the parameter defined by the specified index.
- Throws:
- IndexOutOfBoundsException Thrown if the index is outside
the range of available parameters.
Example:
CIMConstParameter cp;
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
if (parameterIndex != PEG_NOT_FOUND)
{
cp = m1.getParameter(parameterIndex);
}
- Parameters:
- index - Index for the parameter to be returned.
- Returns:
- CIMParameter object requested.
- void removeParameter(Uint32 index)
- Removes the parameter defined by the specified index.
- Throws:
- IndexOutOfBoundsException Thrown if the index is outside the
range of parameters available from the CIMMethod.
- Parameters:
- index - Index of the parameter to be removed.
- Uint32 getParameterCount() const
- Gets the count of Parameters defined in the CIMMethod.
- Returns:
- Count of the number of parameters attached to the CIMMethod.
- Boolean isUninitialized() const
- Determines if the object has not been initialized.
- Returns:
- True if the object has not been initialized;
otherwise, false.
Example:
CIMMethod m1;
assert(m1.isUninitialized());
- Boolean identical(const CIMConstMethod& x) const
- Compares with a CIMConstMethod.
- Parameters:
- x - CIMConstMethod object for the method to be compared.
- Returns:
- True if this method is identical to the one specified;
otherwise, false.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
assert(!m1.identical(m2));
- CIMMethod clone() const
- Makes a clone (deep copy) of this method. This creates
a new copy of all of the components of the method including
parameters and qualifiers.
- Returns:
- Independent copy of the CIMMethod object.
- This class has no child classes.
- Friends:
- class CIMConstMethod
class Resolver class XmlWriter class MofWriter class BinaryStreamer
- See Also:
- CIMConstMethod
CIMParameter
CIMQualifier
CIMType
CIMClass
Alphabetic index HTML hierarchy of classes or Java
|