CIMMethod Class Reference

#include <CIMMethod.h>

List of all members.

Public Member Functions

 CIMMethod ()
 CIMMethod (const CIMMethod &x)
 CIMMethod (const CIMName &name, CIMType type, const CIMName &classOrigin=CIMName(), Boolean propagated=false)
 ~CIMMethod ()
CIMMethodoperator= (const CIMMethod &x)
const CIMNamegetName () const
void setName (const CIMName &name)
CIMType getType () const
void setType (CIMType type)
const CIMNamegetClassOrigin () const
void setClassOrigin (const CIMName &classOrigin)
Boolean getPropagated () const
void setPropagated (Boolean propagated)
CIMMethodaddQualifier (const CIMQualifier &x)
Uint32 findQualifier (const CIMName &name) const
CIMQualifier getQualifier (Uint32 index)
CIMConstQualifier getQualifier (Uint32 index) const
void removeQualifier (Uint32 index)
Uint32 getQualifierCount () const
CIMMethodaddParameter (const CIMParameter &x)
Uint32 findParameter (const CIMName &name) const
CIMParameter getParameter (Uint32 index)
CIMConstParameter getParameter (Uint32 index) const
void removeParameter (Uint32 index)
Uint32 getParameterCount () const
Boolean isUninitialized () const
Boolean identical (const CIMConstMethod &x) const
CIMMethod clone () const

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:
xThe CIMMethod object from which to construct a new CIMMethod object.
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:
nameA CIMName specifying the name of the method.
typeA CIMType defining the method return type.
classOriginA CIMName indicating the class in which the method is locally defined (optional).
propagatedA Boolean indicating whether the method definition is local to the CIMClass in which it appears or was propagated (without modification) from a superclass.
Exceptions:
UninitializedObjectExceptionIf the method name is null.

Destructs the CIMMethod object.


Member Function Documentation

Adds a parameter to the method.

Example:

            CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
            m1.addParameter(CIMParameter(CIMName("ipaddress"), CIMTYPE_STRING));
        
Parameters:
xThe CIMParameter to be added.
Returns:
A reference to this CIMMethod object.
Exceptions:
AlreadyExistsExceptionIf a parameter with the same name already exists in the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.

Adds a qualifier to the method.

Example:

            CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
            m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
        
Parameters:
xThe CIMQualifier to be added.
Returns:
A reference to this CIMMethod object.
Exceptions:
AlreadyExistsExceptionIf a qualifier with the same name already exists in the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.

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:
UninitializedObjectExceptionIf the object is not initialized.
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:
nameA 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:
UninitializedObjectExceptionIf the object is not initialized.
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:
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.

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:
UninitializedObjectExceptionIf the object is not initialized.
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:
UninitializedObjectExceptionIf the object is not initialized.

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:
indexThe index of the parameter to be retrieved.
Returns:
The CIMParameter at the specified index.
Exceptions:
IndexOutOfBoundsExceptionIf the index is outside the range of parameters available for the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.
CIMConstParameter CIMMethod::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);
            }
        
Parameters:
indexThe index of the parameter to be retrieved.
Returns:
The CIMConstParameter at the specified index.
Exceptions:
IndexOutOfBoundsExceptionIf the index is outside the range of parameters available for the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.
Uint32 CIMMethod::getParameterCount ( ) const

Gets the number of parameters in the method.

Returns:
An integer count of the CIMParameters in the CIMMethod.
Exceptions:
UninitializedObjectExceptionIf the object is not initialized.
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:
UninitializedObjectExceptionIf the object is not initialized.

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:
indexThe index of the qualifier to be retrieved.
Returns:
The CIMQualifier object at the specified index.
Exceptions:
IndexOutOfBoundsExceptionIf the index is outside the range of qualifiers available for the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.
CIMConstQualifier CIMMethod::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);
            }
        
Parameters:
indexThe index of the qualifier to be retrieved.
Returns:
The CIMConstQualifier object at the specified index.
Exceptions:
IndexOutOfBoundsExceptionIf the index is outside the range of qualifiers available for the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.
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:
UninitializedObjectExceptionIf the object is not initialized.
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:
UninitializedObjectExceptionIf the object is not initialized.
Boolean CIMMethod::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));
        
Parameters:
xThe CIMConstMethod to be compared.
Returns:
True if this method is identical to the one specified, false otherwise.
Exceptions:
UninitializedObjectExceptionIf either of the objects is not initialized.
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.
CIMMethod& 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:
xThe CIMMethod object from which to assign this CIMMethod object.
Returns:
A reference to this CIMMethod object.
void CIMMethod::removeParameter ( Uint32  index)

Removes a parameter from the method.

Parameters:
indexIndex of the parameter to be removed.
Exceptions:
IndexOutOfBoundsExceptionIf the index is outside the range of parameters available from the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.
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:
indexThe index of the qualifier to remove.
Exceptions:
IndexOutOfBoundsExceptionIf the index is outside the range of qualifiers available for the CIMMethod.
UninitializedObjectExceptionIf the object is not initialized.
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:
classOriginA CIMName specifying the name of the class of origin for the method.
Exceptions:
UninitializedObjectExceptionIf the object is not initialized.
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:
UninitializedObjectExceptionIf the object is not initialized.
ExceptionIf the object is already contained by CIMClass
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:
propagatedA Boolean indicating whether the method is propagated from a superclass.
Exceptions:
UninitializedObjectExceptionIf the object is not initialized.
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:
typeCIMType to be set into the CIMMethod object.
Exceptions:
UninitializedObjectExceptionIf the object is not initialized.

The documentation for this class was generated from the following file:
  • /srv/build/STABLE_8/pkgs/tog-pegasus/BUILD/pegasus/src/Pegasus/Common/CIMMethod.h