version 1.22, 2002/05/15 10:34:28
|
version 1.44, 2004/06/03 08:45:20
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2003//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
|
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) | // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#define Pegasus_Method_h | #define Pegasus_Method_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
#include <Pegasus/Common/Linkage.h> |
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
|
#include <Pegasus/Common/CIMName.h> |
#include <Pegasus/Common/CIMParameter.h> | #include <Pegasus/Common/CIMParameter.h> |
#include <Pegasus/Common/CIMQualifier.h> | #include <Pegasus/Common/CIMQualifier.h> |
#include <Pegasus/Common/CIMType.h> | #include <Pegasus/Common/CIMType.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
class DeclContext; |
class Resolver; |
class CIMConstMethod; | class CIMConstMethod; |
class CIMMethodRep; | class CIMMethodRep; |
| |
/** Class CIMMethod - This class defines the operations associated with |
/** The CIMMethod class is used to represent CIM methods in Pegasus. |
manipulation of the Pegasus implementation of the CIM CIMMethod. Within |
A CIMMethod consists of the following entities: |
this class, methods are provides for creation, deletion, and manipulation |
<ul> |
of method declarations. |
<li>Name of the method, a CIMName. |
|
|
// ATTN: remove the classOrigin and propagated parameters. |
<li>CIM type of the method return value, a CIMType. |
|
|
|
<li>Optional qualifiers (see CIMQualifier) for the method. |
|
A method can contain zero or more CIMQualifier objects. |
|
|
|
<li>Optional parameters (see CIMParameter) for the method. |
|
A CIMMethod may contain zero or more CIMParameter objects. |
|
</ul> |
|
In addition, a CIMMethod contains the following internal attributes: |
|
<ul> |
|
<li><b>propagated</b> - 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. |
|
<li><b>classOrigin</b> - 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. |
|
</ul> |
|
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. |
|
{@link Shared Classes} |
|
@see CIMConstMethod |
|
@see CIMParameter |
|
@see CIMQualifier |
|
@see CIMType |
|
@see CIMClass |
*/ | */ |
class PEGASUS_COMMON_LINKAGE CIMMethod | class PEGASUS_COMMON_LINKAGE CIMMethod |
{ | { |
public: | public: |
| |
/** Creates and instantiates a CIM method. */ |
/** 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 isUninitialized() |
|
@see UninitializedObjectException |
|
*/ |
CIMMethod(); | CIMMethod(); |
| |
/** Creates and instantiates a CIM method from another method instance |
/** Creates a new CIMMethod object from another CIMMethod object. |
@return pointer to the new method instance |
The new CIMMethod object references the same copy of data as the |
|
specified object; no copy is made. |
|
@param x CIMMethod object from which to create the new CIMMethod object. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
const CIMMethod cm1(m1); |
|
</pre> |
|
{@link Shared Classes} |
*/ | */ |
CIMMethod(const CIMMethod& x); | CIMMethod(const CIMMethod& x); |
| |
/** Creates a CIM method with the specified name, type, and classOrigin |
/** Creates a CIMMethod object with the specified attributes. |
@param name for the method |
@param name CIMName defining the name for the method. |
@param type ATTN |
|
@param classOrigin |
@param type CIMType defining the method return type. |
@param propagated |
|
@return Throws IllegalName if name argument not legal CIM identifier. |
@param classOrigin (optional) CIMName representing the class origin. |
|
Note that this should normally not be used. If not provided set to |
|
CIMName() (Null name). |
|
@param 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. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
</pre> |
*/ | */ |
CIMMethod( | CIMMethod( |
const String& name, |
const CIMName& name, |
CIMType type, | CIMType type, |
const String& classOrigin = String::EMPTY, |
const CIMName& classOrigin = CIMName(), |
Boolean propagated = false); | Boolean propagated = false); |
| |
/** Desctructor. */ |
/** Destructor for the CIMMethod. The shared data copy remains valid until |
~CIMMethod(); |
all referring objects are destructed. |
|
{@link Shared Classes} |
/** Assignment operator */ |
|
CIMMethod& operator=(const CIMMethod& x); |
|
|
|
/** getName - Gets the name of the method |
|
@return String with the name of the method |
|
*/ | */ |
const String& getName() const; |
~CIMMethod(); |
| |
/** setName - Set the method name |
/** The assignment operator assigns one CIMMethod to another. |
@param name |
After the assignment, both CIMMethod objects refer to the same |
@exception IllegalName if name argument not legal CIM identifier. |
data copy; a distinct copy is not created. |
|
@param x CIMMethod object from which to assign this CIMMethod object. |
|
|
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMMethod m2; |
|
m2 = m1; |
|
</pre> |
*/ | */ |
void setName(const String& name); |
CIMMethod& operator=(const CIMMethod& x); |
| |
/** getType - gets the method type |
/** Gets the name of the method. |
@return The CIM method type for this method. |
@return CIMName with the name of the method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
assert(m1.getName() == CIMName ("getHostName")); |
|
</pre> |
|
*/ |
|
const CIMName& getName() const; |
|
|
|
/** Sets the method name. |
|
@param name CIMName for the method name. Replaces any |
|
previously defined name for this method object. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m2(CIMName ("test"), CIMTYPE_STRING); |
|
m2.setName(CIMName ("getVersion")); |
|
</pre> |
|
*/ |
|
void setName(const CIMName& name); |
|
|
|
/** Gets the method return type. |
|
@return A CIMType containing the method return type. |
|
@exception UninitializedObjectException Thrown if the object is not |
|
initialized. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
assert(m1.getType() == CIMTYPE_STRING); |
|
</pre> |
*/ | */ |
CIMType getType() const; | CIMType getType() const; |
| |
/** setType - Sets the method type to the specified CIM method |
/** Sets the method return type to the specified CIMType. |
type as defined in CIMType /Ref{TYPE} |
This is the type of the CIMValue |
|
that is returned on a CIM method invocation. |
|
@param type CIMType to be set into the CIMMethod object. |
|
@exception UninitializedObjectException Thrown if the object is not |
|
initialized. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.setName(CIMName ("getVersion")); |
|
assert(m1.getName() == CIMName ("getVersion")); |
|
</pre> |
*/ | */ |
void setType(CIMType type); | void setType(CIMType type); |
| |
/** getClassOrigin - Returns the class in which this method |
/** Gets the class in which this method was defined. This information |
was defined. |
is normally available with methods that are part of a schema |
@return String containing the classOrigin field. |
returned from a CIM Server. |
*/ |
@return CIMName containing the classOrigin attribute. |
const String& getClassOrigin() const; |
*/ |
|
const CIMName& getClassOrigin() const; |
/** setClassOrigin - Set the ClassOrigin attribute with |
|
the classname defined on input |
/** Sets the classOrigin attribute with the specified class name. |
@param classOrigin - String parameter defining the name |
Normally this method is used internally by a CIM Server when |
of the class origin |
defining methods in the context of a schema. |
*/ |
@param classOrigin CIMName parameter defining the name |
void setClassOrigin(const String& classOrigin); |
of the origin class. |
|
@exception UninitializedObjectException Thrown if the object is not |
/** getPropagated - Tests the propogated qualifier |
initialized. |
@return - returns True if method is propogated |
*/ |
|
void setClassOrigin(const CIMName& classOrigin); |
|
|
|
/** 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. |
|
@return True if method is propagated; otherwise, false. |
*/ | */ |
Boolean getPropagated() const; | Boolean getPropagated() const; |
| |
/** setPropagated - Sets the Propagaged Qualifier */ |
/** Sets the propagated attribute. Normally this is used by a CIM Server |
|
when defining a method in the context of a schema. |
|
@param propagated Flag indicating whether the method is propagated |
|
from a superclass. |
|
@exception UninitializedObjectException Thrown if the object is not |
|
initialized. |
|
*/ |
void setPropagated(Boolean propagated); | void setPropagated(Boolean propagated); |
| |
/** addQualifier - Adds a Qualifier to the method object. |
/** Adds the specified qualifier to the CIMMethod object. |
@param CIMQualifier to be added |
@param x CIMQualifier object representing the qualifier |
@return Throws AlreadyExists excetpion if the qualifier already exists |
to be added. |
in the method |
@return The CIMMethod object after adding the specified qualifier. |
@exception AlreadyExists exception |
@exception AlreadyExistsException Thrown if the qualifier already |
|
exists in this CIMMethod. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
</pre> |
*/ | */ |
CIMMethod& addQualifier(const CIMQualifier& x); | CIMMethod& addQualifier(const CIMQualifier& x); |
| |
/** findQualifier - returns the position of the qualifier with |
/** Searches for a qualifier with the specified input name. |
the given name. |
@param name CIMName of the qualifier to be found. |
@param name Name of qualifier to be found. |
@return Zero origin index of the qualifier found or PEG_NOT_FOUND |
@return index of the parameter if found; otherwise PEG_NOT_FOUND. |
if not found. |
*/ |
@exception UninitializedObjectException Thrown if the object is not |
Uint32 findQualifier(const String& name) const; |
initialized. |
|
<p><b>Example:</b> |
/** existsQualifier - returns the position of the qualifier with |
<pre> |
the given name. |
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
@param name Name of qualifier to be found. |
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
@return index of the parameter if found; otherwise PEG_NOT_FOUND. |
assert(m1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND); |
*/ |
</pre> |
Boolean existsQualifier(const String& name) const; |
*/ |
|
Uint32 findQualifier(const CIMName& name) const; |
/** getQualifier - Gets the CIMQualifier defined by the index |
|
input as a parameter. |
/** Gets the CIMQualifier defined by the input parameter. |
@param Index of the qualifier requested. |
@param index Zero origin index of the qualifier requested. |
@return CIMQualifier object or exception |
@return CIMQualifier object representing the qualifier found. |
@exception OutOfBounds exception if the index is outside the range of |
@exception IndexOutOfBoundsException Thrown if the index is |
parameters available from the CIMMethod. |
outside the range of parameters available from the CIMMethod. |
*/ |
<p><b>Example:</b> |
CIMQualifier getQualifier(Uint32 pos); |
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
CIMConstQualifier getQualifier(Uint32 pos) const; |
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
Uint32 posQualifier = m1.findQualifier(CIMName ("stuff")); |
/** removeQualifier - Removes the CIMQualifier defined by the |
if (posQualifier != PEG_NOT_FOUND) |
position input as a parameter. |
{ |
@param Position of the qualifier requested. |
CIMQualifier q = m1.getQualifier(posQualifier); |
@return CIMQualifier object or exception |
} |
@exception OutOfBounds exception if the index is outside the range of |
</pre> |
parameters available from the CIMMethod. |
*/ |
*/ |
CIMQualifier getQualifier(Uint32 index); |
void removeQualifier(Uint32 pos); |
|
|
/** Gets the CIMQualifier defined by the input parameter. |
/** getQualifierCount - Returns the number of Qualifiers attached |
@param index Zero origin index of the qualifier requested. |
to this CIMMethod object. |
@return CIMQualifier object representing the qualifier found. |
@return integer representing number of Qualifiers. |
@exception IndexOutOfBoundsException Thrown if the index is |
|
outside the range of parameters available from the CIMMethod. |
|
<p><b>Example:</b> |
|
<pre> |
|
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); |
|
} |
|
</pre> |
|
*/ |
|
CIMConstQualifier getQualifier(Uint32 index) const; |
|
|
|
/** Removes the specified qualifier from this method. |
|
@param index Index of the qualifier to remove. |
|
@exception IndexOutOfBoundsException Thrown if the index is |
|
outside the range of parameters available from the CIMMethod. |
|
<p><b>Example:</b> |
|
<pre> |
|
// remove all qualifiers from a class |
|
Uint32 count = 0; |
|
while((count = cimClass.getQualifierCount()) > 0) |
|
cimClass.removeQualifier(count - 1); |
|
</pre> |
|
*/ |
|
void removeQualifier(Uint32 index); |
|
|
|
/** Returns the number of Qualifiers attached to this CIMMethod object. |
|
@return The number of qualifiers attached to the CIM Method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true)); |
|
assert(m1.getQualifierCount() == 2); |
|
</pre> |
*/ | */ |
Uint32 getQualifierCount() const; | Uint32 getQualifierCount() const; |
| |
/** addParameter - Adds the parameter defined by the input |
/** Adds the parameter defined by the input to the CIMMethod. |
to the CIMMethod |
@param x CIMParameter to be added to the CIM Method. |
|
@return CIMMethod object after the specified parameter is added. |
|
<p><b>Example:</b> |
|
@exception UninitializedObjectException Thrown if the object is not |
|
initialized. |
|
@exception AlreadyExistsException Thrown if the parameter already |
|
exists in this CIMMethod. |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addParameter(CIMParameter(CIMName ("ipaddress"), CIMTYPE_STRING)); |
|
</pre> |
*/ | */ |
CIMMethod& addParameter(const CIMParameter& x); | CIMMethod& addParameter(const CIMParameter& x); |
| |
/** findParameter - Finds the parameter whose name is given |
/** Finds the parameter with the specified name. |
by the name parameter. |
@param name CIMName of parameter to be found. |
@param name Name of parameter to be found. |
@return Index of the parameter object found or PEG_NOT_FOUND |
@return index of the parameter if found; otherwise PEG_NOT_FOUND. |
if the property is not found. |
*/ |
<p><b>Example:</b> |
Uint32 findParameter(const String& name) const; |
<pre> |
|
Uint32 posParameter; |
/** getParameter - ATTN: */ |
posParameter = m1.findParameter(CIMName ("ipaddress")); |
CIMParameter getParameter(Uint32 pos); |
if (posParameter != PEG_NOT_FOUND) |
|
... |
/** getParameter - Gets the parameter defined by the index |
</pre> |
input as a parameter. |
*/ |
@param index for the parameter to be returned. |
Uint32 findParameter(const CIMName& name) const; |
@return CIMParameter requested. |
|
@Exception OutOfBounds exception is thrown if the index is outside the |
/** Gets the parameter defined by the specified index. |
range of available parameters |
@param index Index for the parameter to be returned. |
*/ |
@return CIMParameter object requested. |
CIMConstParameter getParameter(Uint32 pos) const; |
@exception IndexOutOfBoundsException Thrown if the index is outside |
|
the range of available parameters. |
/** getParameterCount - Gets the count of the numbeer of |
<p><b>Example:</b> |
Parameters attached to the CIMMethod. |
<pre> |
@retrun - count of the number of parameters attached to the CIMMethod. |
CIMParameter cp; |
|
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress")); |
|
if (parameterIndex != PEG_NOT_FOUND) |
|
{ |
|
cp = m1.getParameter(parameterIndex); |
|
} |
|
</pre> |
|
*/ |
|
CIMParameter getParameter(Uint32 index); |
|
|
|
/** Gets the parameter defined by the specified index. |
|
@param index Index for the parameter to be returned. |
|
@return CIMParameter object requested. |
|
@exception IndexOutOfBoundsException Thrown if the index is outside |
|
the range of available parameters. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstParameter cp; |
|
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress")); |
|
if (parameterIndex != PEG_NOT_FOUND) |
|
{ |
|
cp = m1.getParameter(parameterIndex); |
|
} |
|
</pre> |
*/ | */ |
Uint32 getParameterCount() const; |
CIMConstParameter getParameter(Uint32 index) const; |
| |
#ifdef PEGASUS_INTERNALONLY |
/** Removes the parameter defined by the specified index. |
/** resolve - resolves and completes the CIMMethod */ |
@param index Index of the parameter to be removed. |
void resolve( |
@exception IndexOutOfBoundsException Thrown if the index is outside the |
DeclContext* declContext, |
range of parameters available from the CIMMethod. |
const String& nameSpace, |
*/ |
const CIMConstMethod& method); |
void removeParameter (Uint32 index); |
|
|
/** resolve - Resolves and completes the CIMMethod */ |
|
void resolve( |
|
DeclContext* declContext, |
|
const String& nameSpace); |
|
|
|
/** Returns true if CIMMethod refers to a null pointer */ |
|
Boolean isNull() const; |
|
#endif |
|
| |
/** toMof - puts MOF encoding of this object into out arguemnt. |
/** Gets the count of Parameters defined in the CIMMethod. |
|
@return Count of the number of parameters attached to the CIMMethod. |
*/ | */ |
void toMof(Array<Sint8>& out) const; |
Uint32 getParameterCount() const; |
| |
/** identical - Returns true if this method is identical to the |
/** Determines if the object has not been initialized. |
one given by the argument x. |
@return True if the object has not been initialized; |
|
otherwise, false. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1; |
|
assert(m1.isUninitialized()); |
|
</pre> |
|
*/ |
|
Boolean isUninitialized() const; |
|
|
|
/** Compares with a CIMConstMethod. |
|
@param x CIMConstMethod object for the method to be compared. |
|
@return True if this method is identical to the one specified; |
|
otherwise, false. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING); |
|
assert(!m1.identical(m2)); |
|
</pre> |
*/ | */ |
Boolean identical(const CIMConstMethod& x) const; | Boolean identical(const CIMConstMethod& x) const; |
| |
/** CIMMethod clone - makes a distinct replica of this method */ |
/** 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. |
|
@return Independent copy of the CIMMethod object. |
|
*/ |
CIMMethod clone() const; | CIMMethod clone() const; |
| |
private: | private: |
| |
CIMMethod(CIMMethodRep* rep); | CIMMethod(CIMMethodRep* rep); |
| |
|
/** This method is not implemented. It is defined to explicitly disallow |
|
construction of a CIMMethod from a CIMConstMethod. Because the |
|
CIMMethod class uses a shared representation model, allowing this |
|
construction would effectively allow modification of CIMConstMethod |
|
objects. |
|
*/ |
PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x); | PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x); |
| |
void _checkRep() const; | void _checkRep() const; |
| |
CIMMethodRep* _rep; | CIMMethodRep* _rep; |
friend class CIMConstMethod; | friend class CIMConstMethod; |
|
friend class Resolver; |
friend class XmlWriter; | friend class XmlWriter; |
|
friend class MofWriter; |
|
friend class BinaryStreamer; |
}; | }; |
| |
|
/** The CIMConstMethod class is used to represent CIM methods in the |
|
same manner as the CIMMethod class except that the const attribute |
|
is applied to the objects created. This class includes equivalents |
|
to the methods from CIMMethod that are available in a const object, |
|
including constructors, accessor methods, and the destructor. |
|
|
|
Because the CIMMethod class uses a shared representation model, allowing |
|
the construction of a 'CIMMethod' from a 'const CIMMethod' would |
|
effectively allow modification of a 'const CIMMethod'. The CIMConstMethod |
|
class is used to represent constant CIMMethod objects. Since a |
|
CIMConstMethod cannot be converted to a CIMMethod, its value remains |
|
constant. |
|
|
|
@see CIMMethod() |
|
*/ |
class PEGASUS_COMMON_LINKAGE CIMConstMethod | class PEGASUS_COMMON_LINKAGE CIMConstMethod |
{ | { |
public: | public: |
| |
|
/** Creates a new uninitialized CIMConstMethod object. |
|
The only thing that can be done with this object is to copy another |
|
object into it. Other methods, such as getName, will fail with an |
|
UninitializedObjectException. The object has an uninitialized state, |
|
which can be tested with the isUninitialized method. |
|
@see isUninitialized() |
|
@see UninitializedObjectException |
|
*/ |
CIMConstMethod(); | CIMConstMethod(); |
| |
|
/** Creates a new CIMConstMethod object from another CIMConstMethod object. |
|
The new CIMConstMethod object references the same copy of data as the |
|
specified object; no copy is made. |
|
@param x CIMConstMethod object from which to create the new |
|
CIMConstMethod object. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod cm1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod cm2(m1); |
|
</pre> |
|
{@link Shared Classes} |
|
*/ |
CIMConstMethod(const CIMConstMethod& x); | CIMConstMethod(const CIMConstMethod& x); |
| |
|
/** Creates a new CIMConstMethod object from a CIMMethod object. |
|
The new CIMConstMethod object references the same copy of data as the |
|
specified object; no copy is made. |
|
@param x CIMMethod object from which to create the new |
|
CIMConstMethod object. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod cm1(m1); |
|
</pre> |
|
{@link Shared Classes} |
|
*/ |
CIMConstMethod(const CIMMethod& x); | CIMConstMethod(const CIMMethod& x); |
| |
// Throws IllegalName if name argument not legal CIM identifier. |
/** Creates a CIMConstMethod object with the specified attributes. |
|
@param name CIMName defining the name for the method. |
|
|
|
@param type CIMType defining the method return type. |
|
|
|
@param classOrigin (optional) CIMName representing the class origin. |
|
Note that this should normally not be used. If not provided set to |
|
CIMName() (Null name). |
|
@param 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. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
</pre> |
|
*/ |
CIMConstMethod( | CIMConstMethod( |
const String& name, |
const CIMName& name, |
CIMType type, | CIMType type, |
const String& classOrigin = String::EMPTY, |
const CIMName& classOrigin = CIMName(), |
Boolean propagated = false); | Boolean propagated = false); |
| |
|
/** Destructor for the CIMConstMethod. The shared data copy remains valid |
|
until all referring objects are destructed. |
|
{@link Shared Classes} |
|
*/ |
~CIMConstMethod(); | ~CIMConstMethod(); |
| |
|
/** The assignment operator assigns one CIMConstMethod to another. |
|
After the assignment, both CIMConstMethod objects refer to the same |
|
data copy; a distinct copy is not created. |
|
@param x CIMConstMethod object from which to assign this |
|
CIMConstMethod object. |
|
|
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2; |
|
m2 = m1; |
|
</pre> |
|
*/ |
CIMConstMethod& operator=(const CIMConstMethod& x); | CIMConstMethod& operator=(const CIMConstMethod& x); |
| |
|
/** The assignment operator assigns a CIMMethod object to a |
|
CIMConstMethod. |
|
After the assignment, both objects refer to the same |
|
data copy; a distinct copy is not created. |
|
@param x CIMConstMethod object from which to assign this |
|
CIMConstMethod object. |
|
|
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2; |
|
m2 = m1; |
|
</pre> |
|
*/ |
CIMConstMethod& operator=(const CIMMethod& x); | CIMConstMethod& operator=(const CIMMethod& x); |
| |
const String& getName() const; |
/** Gets the name of the method. |
|
@return CIMName with the name of the method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
assert(m1.getName() == CIMName ("getHostName")); |
|
</pre> |
|
*/ |
|
const CIMName& getName() const; |
|
|
|
/** Gets the method return type. |
|
@return A CIMType containing the method return type. |
|
@exception UninitializedObjectException Thrown if the object is not |
|
initialized. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
assert(m1.getType() == CIMTYPE_STRING); |
|
</pre> |
|
*/ |
CIMType getType() const; | CIMType getType() const; |
| |
const String& 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. |
|
@return CIMName containing the classOrigin attribute. |
|
*/ |
|
const CIMName& getClassOrigin() 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. |
|
@return True if method is propagated; otherwise, false. |
|
*/ |
Boolean getPropagated() const; | Boolean getPropagated() const; |
| |
Uint32 findQualifier(const String& name) const; |
/** Searches for a qualifier with the specified input name. |
|
@param name CIMName of the qualifier to be found. |
CIMConstQualifier getQualifier(Uint32 pos) const; |
@return Zero origin index of the qualifier found or PEG_NOT_FOUND |
|
if not found. |
|
@exception UninitializedObjectException Thrown if the object is not |
|
initialized. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
CIMConstMethod m2(m1); |
|
assert(m2.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND); |
|
</pre> |
|
*/ |
|
Uint32 findQualifier(const CIMName& name) const; |
|
|
|
/** Gets the CIMQualifier defined by the input parameter. |
|
@param index Zero origin index of the qualifier requested. |
|
@return CIMQualifier object representing the qualifier found. |
|
@exception IndexOutOfBoundsException Thrown if the index is |
|
outside the range of parameters available from the CIMMethod. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
CIMConstMethod m2(m1); |
|
Uint32 posQualifier = m2.findQualifier(CIMName ("stuff")); |
|
if (posQualifier != PEG_NOT_FOUND) |
|
{ |
|
CIMQualifier q = m2.getQualifier(posQualifier); |
|
} |
|
</pre> |
|
*/ |
|
CIMConstQualifier getQualifier(Uint32 index) const; |
|
|
|
/** Returns the number of Qualifiers attached to this CIMConstMethod |
|
object. |
|
@return The number of qualifiers attached to the CIM method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true)); |
|
CIMConstMethod m2(m1); |
|
assert(m2.getQualifierCount() == 2); |
|
</pre> |
|
*/ |
Uint32 getQualifierCount() const; | Uint32 getQualifierCount() const; |
| |
Uint32 findParameter(const String& name) const; |
/** Finds the parameter with the specified name. |
|
@param name CIMName of parameter to be found. |
CIMConstParameter getParameter(Uint32 pos) const; |
@return Index of the parameter object found or PEG_NOT_FOUND |
|
if the property is not found. |
|
<p><b>Example:</b> |
|
<pre> |
|
Uint32 posParameter; |
|
posParameter = m1.findParameter(CIMName ("ipaddress")); |
|
if (posParameter != PEG_NOT_FOUND) |
|
... |
|
</pre> |
|
*/ |
|
Uint32 findParameter(const CIMName& name) const; |
|
|
|
/** Gets the parameter defined by the specified index. |
|
@param index Index for the parameter to be returned. |
|
@return CIMConstParameter object requested. |
|
@exception IndexOutOfBoundsException Thrown if the index is outside |
|
the range of available parameters. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstParameter cp; |
|
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress")); |
|
if (parameterIndex != PEG_NOT_FOUND) |
|
{ |
|
cp = m1.getParameter(parameterIndex); |
|
} |
|
</pre> |
|
*/ |
|
CIMConstParameter getParameter(Uint32 index) const; |
| |
|
/** Gets the count of Parameters defined in the CIMMethod. |
|
@return Count of the number of parameters attached to the CIMMethod. |
|
*/ |
Uint32 getParameterCount() const; | Uint32 getParameterCount() const; |
| |
#ifdef PEGASUS_INTERNALONLY |
/** Determines if the object has not been initialized. |
Boolean isNull() const; |
@return True if the object has not been initialized; |
#endif |
otherwise, false. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1; |
|
assert(m1.isUninitialized()); |
|
</pre> |
|
*/ |
|
Boolean isUninitialized() const; |
|
|
|
/** Compares with a CIMConstMethod. |
|
@param x CIMConstMethod object for the method to be compared. |
|
@return True if this method is identical to the one specified; |
|
otherwise, false. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING); |
|
assert(!m1.identical(m2)); |
|
</pre> |
|
*/ |
Boolean identical(const CIMConstMethod& x) const; | Boolean identical(const CIMConstMethod& x) const; |
| |
|
/** Makes a clone (deep copy) of this CIMConstMethod. This creates |
|
a new copy of all of the components of the method including |
|
parameters and qualifiers. |
|
@return Independent copy of the CIMConstMethod object. Note that |
|
the copy is a non-constant CIMMethod. |
|
*/ |
CIMMethod clone() const; | CIMMethod clone() const; |
| |
private: | private: |
|
|
friend class CIMMethod; | friend class CIMMethod; |
friend class CIMMethodRep; | friend class CIMMethodRep; |
friend class XmlWriter; | friend class XmlWriter; |
|
friend class MofWriter; |
}; | }; |
| |
#define PEGASUS_ARRAY_T CIMMethod | #define PEGASUS_ARRAY_T CIMMethod |
# include "ArrayInter.h" |
# include <Pegasus/Common/ArrayInter.h> |
#undef PEGASUS_ARRAY_T | #undef PEGASUS_ARRAY_T |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |