Contents
|
In file ../../src/Pegasus/Common/CIMMethod.h:
The CIMMethod class represents the DMTF standard CIM method definition.
Documentation
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.
Inheritance:
Public Methods
| CIMMethod ()
Constructs an uninitialized CIMMethod object.
|
| CIMMethod (const CIMMethod& x)
Constructs a CIMMethod object from the value of a specified CIMMethod object, so that both objects refer to the same data copy.
|
| CIMMethod ( const CIMName& name, CIMType type, const CIMName& classOrigin = CIMName(), Boolean propagated = false)
Constructs a CIMMethod object with the specified attributes.
|
| ~CIMMethod ()
Destructs the CIMMethod object
|
CIMMethod& | operator= (const CIMMethod& x)
Assigns the value of the specified CIMMethod object to this object, so that both objects refer to the same data copy.
|
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 is locally 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 a qualifier to the method.
|
Uint32 | findQualifier (const CIMName& name) const
Finds a qualifier by name.
|
CIMQualifier | getQualifier (Uint32 index)
Gets the qualifier at the specified index.
|
CIMConstQualifier | getQualifier (Uint32 index) const
Gets the qualifier at the specified index.
|
void | removeQualifier (Uint32 index)
Removes a qualifier from the method.
|
Uint32 | getQualifierCount () const
Gets the number of qualifiers in the method.
|
CIMMethod& | addParameter (const CIMParameter& x)
Adds a parameter to the method.
|
Uint32 | findParameter (const CIMName& name) const
Finds a parameter by name.
|
CIMParameter | getParameter (Uint32 index)
Gets the parameter at the specified index.
|
CIMConstParameter | getParameter (Uint32 index) const
Gets the parameter at the specified index.
|
void | removeParameter (Uint32 index)
Removes a parameter from the method.
|
Uint32 | getParameterCount () const
Gets the number of parameters in the method.
|
Boolean | isUninitialized () const
Determines whether the object has been initialized.
|
Boolean | identical (const CIMConstMethod& x) const
Compares the method with another method.
|
CIMMethod | clone () const
Makes a deep copy of the method.
|
- CIMMethod()
-
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.
- CIMMethod(const CIMMethod& x)
-
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:
- x - The CIMMethod object from which to construct a new
CIMMethod object.
- 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);
- Throws:
- UninitializedObjectException If the method name is null.
- 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.
- ~CIMMethod()
-
Destructs the CIMMethod object
- CIMMethod& operator=(const CIMMethod& x)
-
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:
- x - The CIMMethod object from which to assign this CIMMethod
object.
- Returns:
- A reference to this CIMMethod object.
- const CIMName& getName() const
-
Gets the name of the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
assert(m1.getName() == CIMName ("getHostName"));
- Throws:
- UninitializedObjectException If the object is not
initialized.
- Returns:
- A CIMName containing the name of the method.
- void setName(const CIMName& name)
-
Sets the method name.
Example:
CIMMethod m2(CIMName ("test"), CIMTYPE_STRING);
m2.setName(CIMName ("getVersion"));
- Throws:
- UninitializedObjectException If the object is not
initialized.
Exception If the object is already contained by CIMClass
- Returns:
- A CIMName containing the new name of the method.
- CIMType getType() const
-
Gets the method return type.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
assert(m1.getType() == CIMTYPE_STRING);
- Throws:
- UninitializedObjectException If the object is not
initialized.
- 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.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.setName(CIMName ("getVersion"));
assert(m1.getName() == CIMName ("getVersion"));
- Throws:
- UninitializedObjectException If the object is not
initialized.
- Parameters:
- type - CIMType to be set into the CIMMethod object.
- const CIMName& 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.
- Throws:
- UninitializedObjectException If the object is not
initialized.
- 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 If the object is not
initialized.
- Parameters:
- classOrigin - A CIMName specifying the name of the class of
origin for the method.
- 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.
- Throws:
- UninitializedObjectException If the object is not
initialized.
- 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 If the object is not
initialized.
- Parameters:
- propagated - A Boolean indicating whether the method is
propagated from a superclass.
- CIMMethod& addQualifier(const CIMQualifier& x)
-
Adds a qualifier to the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
- Throws:
- AlreadyExistsException If a qualifier with the
same name already exists in the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- x - The CIMQualifier to be added.
- Returns:
- A reference to this CIMMethod object.
- Uint32 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);
- Throws:
- UninitializedObjectException If the object is not
initialized.
- 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.
- CIMQualifier getQualifier(Uint32 index)
-
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);
}
- Throws:
- IndexOutOfBoundsException If the index is
outside the range of qualifiers available for the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- index - The index of the qualifier to be retrieved.
- Returns:
- The CIMQualifier object at the specified index.
- CIMConstQualifier getQualifier(Uint32 index) const
-
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);
}
- Throws:
- IndexOutOfBoundsException If the index is
outside the range of qualifiers available for the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- index - The index of the qualifier to be retrieved.
- Returns:
- The CIMConstQualifier object at the specified index.
- void 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);
- Throws:
- IndexOutOfBoundsException If the index is
outside the range of qualifiers available for the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- index - The index of the qualifier to remove.
- Uint32 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);
- Throws:
- UninitializedObjectException If the object is not
initialized.
- Returns:
- An integer count of the qualifiers in the CIMMethod.
- CIMMethod& addParameter(const CIMParameter& x)
-
Adds a parameter to the method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
m1.addParameter(CIMParameter(CIMName("ipaddress"), CIMTYPE_STRING));
- Throws:
- AlreadyExistsException If a parameter with the
same name already exists in the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- x - The CIMParameter to be added.
- Returns:
- A reference to this CIMMethod object.
- Uint32 findParameter(const CIMName& name) const
-
Finds a parameter by name.
Example:
Uint32 posParameter;
posParameter = m1.findParameter(CIMName ("ipaddress"));
if (posParameter != PEG_NOT_FOUND)
...
- Throws:
- UninitializedObjectException If the object is not
initialized.
- 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.
- CIMParameter getParameter(Uint32 index)
-
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);
}
- Throws:
- IndexOutOfBoundsException If the index is outside
the range of parameters available for the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- index - The index of the parameter to be retrieved.
- Returns:
- The CIMParameter at the specified index.
- CIMConstParameter getParameter(Uint32 index) const
-
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);
}
- Throws:
- IndexOutOfBoundsException If the index is outside
the range of parameters available for the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- index - The index of the parameter to be retrieved.
- Returns:
- The CIMConstParameter at the specified index.
- void removeParameter(Uint32 index)
-
Removes a parameter from the method.
- Throws:
- IndexOutOfBoundsException If the index is outside the
range of parameters available from the CIMMethod.
UninitializedObjectException If the object is not
initialized.
- Parameters:
- index - Index of the parameter to be removed.
- Uint32 getParameterCount() const
-
Gets the number of parameters in the method.
- Throws:
- UninitializedObjectException If the object is not
initialized.
- Returns:
- An integer count of the CIMParameters in the CIMMethod.
- Boolean 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.
- Boolean identical(const CIMConstMethod& x) const
-
Compares the method with another method.
Example:
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
assert(!m1.identical(m2));
- Throws:
- UninitializedObjectException If either of the objects
is not initialized.
- Parameters:
- x - The CIMConstMethod to be compared.
- Returns:
- True if this method is identical to the one specified,
false otherwise.
- CIMMethod clone() const
-
Makes a deep copy of the method. This creates a new copy
of all the method attributes including parameters and qualifiers.
- Throws:
- UninitializedObjectException If the object is not
initialized.
- Returns:
- A new copy of the CIMMethod object.
- This class has no child classes.
- Friends:
- class CIMConstMethod
class Resolver class XmlWriter class MofWriter class BinaryStreamer
Alphabetic index HTML hierarchy of classes or Java
|