version 1.5, 2001/04/25 22:20:53
|
version 1.11, 2001/05/21 17:15:44
|
|
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
/* |
|
CIMMethod.h - This header file defines the method class. |
|
*/ |
|
|
|
#ifndef Pegasus_Method_h | #ifndef Pegasus_Method_h |
#define Pegasus_Method_h | #define Pegasus_Method_h |
| |
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
class CIMConstMethod; | class CIMConstMethod; |
| |
/** Class CIMMethod - This class defines the operations associated with | /** Class CIMMethod - This class defines the operations associated with |
manipulation of the Pegasus implementation of the CIM CIMMethod. Within this |
manipulation of the Pegasus implementation of the CIM CIMMethod. Within |
class, methods are provides for creation, deletion, and manipulation of method |
this class, methods are provides for creation, deletion, and manipulation |
declarations. |
of method declarations. |
| |
|
// ATTN: remove the classOrigin and propagated parameters. |
*/ | */ |
|
|
class PEGASUS_COMMON_LINKAGE CIMMethod | class PEGASUS_COMMON_LINKAGE CIMMethod |
{ | { |
public: | public: |
/// Creates and instantiates a CIM method. |
|
|
/** Creates and instantiates a CIM method. */ |
CIMMethod() : _rep(0) | CIMMethod() : _rep(0) |
{ | { |
| |
} | } |
|
|
/** Creates and instantiates a CIM method from another method instance | /** Creates and instantiates a CIM method from another method instance |
@return pointer to the new method instance | @return pointer to the new method instance |
*/ | */ |
|
|
{ | { |
Inc(_rep = x._rep); | Inc(_rep = x._rep); |
} | } |
/// |
|
|
/** Assignment operator */ |
CIMMethod& operator=(const CIMMethod& x) | CIMMethod& operator=(const CIMMethod& x) |
{ | { |
if (x._rep != _rep) | if (x._rep != _rep) |
|
|
return *this; | return *this; |
} | } |
| |
// ATTN: remove the classOrigin and propagated parameters. |
|
|
|
/** Creates a CIM method with the specified name, type, and classOrigin | /** Creates a CIM method with the specified name, type, and classOrigin |
@param name for the method | @param name for the method |
@param type ATTN | @param type ATTN |
|
|
_rep = new CIMMethodRep(name, type, classOrigin, propagated); | _rep = new CIMMethodRep(name, type, classOrigin, propagated); |
} | } |
| |
/// CIMMethod desctructor |
/** Desctructor. */ |
~CIMMethod() | ~CIMMethod() |
{ | { |
Dec(_rep); | Dec(_rep); |
} | } |
|
|
/** CIMMethod getName - Gets the name of the method | /** CIMMethod getName - Gets the name of the method |
@return String with the name of the method | @return String with the name of the method |
*/ | */ |
|
|
} | } |
| |
/** CIMMethod setName - Set the method name | /** CIMMethod setName - Set the method name |
@parm name ATTN (make reference to name defintion here) |
@param name |
@return Throws IllegalName if name argument not legal CIM identifier. |
@exception IllegalName if name argument not legal CIM identifier. |
*/ | */ |
void setName(const String& name) | void setName(const String& name) |
{ | { |
_checkRep(); | _checkRep(); |
_rep->setName(name); | _rep->setName(name); |
} | } |
|
|
/** CIMMethod getType - gets the method type | /** CIMMethod getType - gets the method type |
@return The CIM method type for this method. | @return The CIM method type for this method. |
*/ | */ |
|
|
CIMType getType() const | CIMType getType() const |
{ | { |
_checkRep(); | _checkRep(); |
return _rep->getType(); | return _rep->getType(); |
} | } |
|
|
/** CIMMethod setType - Sets the method type to the specified CIM method | /** CIMMethod setType - Sets the method type to the specified CIM method |
type as defined in CIMType /Ref{TYPE} | type as defined in CIMType /Ref{TYPE} |
*/ | */ |
|
|
_checkRep(); | _checkRep(); |
_rep->setType(type); | _rep->setType(type); |
} | } |
|
|
/** CIMMethod getClassOrigin - Returns the class in which this method | /** CIMMethod getClassOrigin - Returns the class in which this method |
was defined. | was defined. |
@return ATTN: | @return ATTN: |
|
|
_checkRep(); | _checkRep(); |
return _rep->getClassOrigin(); | return _rep->getClassOrigin(); |
} | } |
/** CIMMethod setClassOrigin - ATTN: |
|
*/ |
/** CIMMethod setClassOrigin - ATTN: */ |
void setClassOrigin(const String& classOrigin) | void setClassOrigin(const String& classOrigin) |
{ | { |
_checkRep(); | _checkRep(); |
_rep->setClassOrigin(classOrigin); | _rep->setClassOrigin(classOrigin); |
} | } |
/// method getPropagated - ATTN: |
|
|
/** method getPropagated - ATTN: */ |
Boolean getPropagated() const | Boolean getPropagated() const |
{ | { |
_checkRep(); | _checkRep(); |
return _rep->getPropagated(); | return _rep->getPropagated(); |
} | } |
/// method setPropagated - ATTN: |
|
|
/** method setPropagated - ATTN: */ |
void setPropagated(Boolean propagated) | void setPropagated(Boolean propagated) |
{ | { |
_checkRep(); | _checkRep(); |
_rep->setPropagated(propagated); | _rep->setPropagated(propagated); |
} | } |
/** CIMMethod addQualifier - |
|
@parm CIMQualifier to add |
/** CIMMethod addQualifier - Adds a Qualifier to the method object. |
@param CIMQualifier to be added | @param CIMQualifier to be added |
@return Throws AlreadyExists excetpion if the qualifier already exists in |
@return Throws AlreadyExists excetpion if the qualifier already exists |
the method |
in the method |
@exception AlreadyExists exception of CIMQualifier already exists. |
@exception AlreadyExists exception |
*/ | */ |
CIMMethod& addQualifier(const CIMQualifier& x) | CIMMethod& addQualifier(const CIMQualifier& x) |
{ | { |
|
|
_rep->addQualifier(x); | _rep->addQualifier(x); |
return *this; | return *this; |
} | } |
/** CIMMethod findQualifier - Finds the CIMQualifier named by the input string. |
|
@param String defining the name of the parameter to be found |
/** CIMMethod findQualifier - returns the position of the qualifier with |
@return Index to the parameter found or -1 if not found |
the given name. |
The -1 must be converted to a Unit32 as follows: |
@param name Name of qualifier to be found. |
<PRE> |
@return index of the parameter if found; otherwise Uint32(-1). |
Uint32 pos = myClass.findProperty("name"); |
|
if (pos == Uint32(-1)) |
|
{ |
|
// Not found! |
|
} |
|
</PRE> |
|
*/ | */ |
Uint32 findQualifier(const String& name) | Uint32 findQualifier(const String& name) |
{ | { |
_checkRep(); | _checkRep(); |
return _rep->findQualifier(name); | return _rep->findQualifier(name); |
} | } |
/** CIMMethod findQualifier - Find the qualifier with the name defined on |
|
input |
|
@param String with the name of the parameter to be found. |
|
@return - index to the qualifier found or -1 if no qualifier found. |
|
*/ |
|
Uint32 findQualifier(const String& name) const | Uint32 findQualifier(const String& name) const |
{ | { |
_checkRep(); | _checkRep(); |
return _rep->findQualifier(name); | return _rep->findQualifier(name); |
} | } |
/** CIMMethod getQualifier - Gets the CIMQualifier defined by the index input |
|
as a parameter. |
/** existsQualifier - returns the position of the qualifier with |
|
the given name. |
|
@param name Name of qualifier to be found. |
|
@return index of the parameter if found; otherwise Uint32(-1). |
|
*/ |
|
Boolean existsQualifier(const String& name) |
|
{ |
|
_checkRep(); |
|
return _rep->existsQualifier(name); |
|
} |
|
|
|
Boolean existsQualifier(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->existsQualifier(name); |
|
} |
|
|
|
|
|
/** CIMMethod getQualifier - Gets the CIMQualifier defined by the index |
|
input as a parameter. |
@param Index of the qualifier requested. | @param Index of the qualifier requested. |
@return CIMQualifier object or exception | @return CIMQualifier object or exception |
@exception OutOfBounds exception if the index is outside the range of | @exception OutOfBounds exception if the index is outside the range of |
|
|
_checkRep(); | _checkRep(); |
return _rep->getQualifier(pos); | return _rep->getQualifier(pos); |
} | } |
/** CIMMethod getQualifierCount - Returns count of the number of Qualifiers |
|
attached to the CIMMethod |
/** removeQualifier - Removes the CIMQualifier defined by the |
|
position input as a parameter. |
|
@param Position of the qualifier requested. |
|
@return CIMQualifier object or exception |
|
@exception OutOfBounds exception if the index is outside the range of |
|
parameters available from the CIMMethod. |
|
*/ |
|
void removeQualifier(Uint32 pos) |
|
{ |
|
_checkRep(); |
|
_rep->removeQualifier(pos); |
|
} |
|
|
|
|
|
/** CIMMethod getQualifierCount - Returns the number of Qualifiers attached |
|
to this method. |
@return integer representing number of Qualifiers. | @return integer representing number of Qualifiers. |
*/ | */ |
Uint32 getQualifierCount() const | Uint32 getQualifierCount() const |
|
|
_checkRep(); | _checkRep(); |
return _rep->getQualifierCount(); | return _rep->getQualifierCount(); |
} | } |
/** CIMMethod addParameter - Adds the parameter defined by the input to the |
|
CIMMethod |
/** CIMMethod addParameter - Adds the parameter defined by the input |
Param - ATTN: |
to the CIMMethod |
*/ | */ |
CIMMethod& addParameter(const CIMParameter& x) | CIMMethod& addParameter(const CIMParameter& x) |
{ | { |
|
|
_rep->addParameter(x); | _rep->addParameter(x); |
return *this; | return *this; |
} | } |
/// CIMMethod findParameter - ATTN: |
|
|
/** CIMMethod findParameter - Finds the parameter whose name is given |
|
by the name parameter. |
|
@param name Name of parameter to be found. |
|
@return index of the parameter if found; otherwise Uint32(-1). |
|
*/ |
Uint32 findParameter(const String& name) | Uint32 findParameter(const String& name) |
{ | { |
_checkRep(); | _checkRep(); |
return _rep->findParameter(name); | return _rep->findParameter(name); |
} | } |
| |
/** CIMMethod findParameter - Finds the parameter defined by the name input |
|
and returns an index to the CIMParameter |
|
@param String defining the parameter to be found |
|
@return index to the parameter if found. Returns -1 if parameter not |
|
found |
|
*/ |
|
Uint32 findParameter(const String& name) const | Uint32 findParameter(const String& name) const |
{ | { |
_checkRep(); | _checkRep(); |
return _rep->findParameter(name); | return _rep->findParameter(name); |
} | } |
/// CIMMethod getParameter - ATTN: |
|
|
/** CIMMethod getParameter - ATTN: */ |
CIMParameter getParameter(Uint32 pos) | CIMParameter getParameter(Uint32 pos) |
{ | { |
_checkRep(); | _checkRep(); |
|
|
return _rep->getParameter(pos); | return _rep->getParameter(pos); |
} | } |
| |
/** CIMMethod getParameterCount - Gets the count of the numbeer of Parameters |
/** CIMMethod getParameterCount - Gets the count of the numbeer of |
attached to the CIMMethod. |
Parameters attached to the CIMMethod. |
@retrun - count of the number of parameters attached to the CIMMethod. | @retrun - count of the number of parameters attached to the CIMMethod. |
*/ | */ |
Uint32 getParameterCount() const | Uint32 getParameterCount() const |
|
|
_checkRep(); | _checkRep(); |
return _rep->getParameterCount(); | return _rep->getParameterCount(); |
} | } |
/// method resolve - ATTN: |
|
|
/** method resolve - ATTN: */ |
void resolve( | void resolve( |
DeclContext* declContext, | DeclContext* declContext, |
const String& nameSpace, | const String& nameSpace, |
|
|
_checkRep(); | _checkRep(); |
_rep->resolve(declContext, nameSpace, method); | _rep->resolve(declContext, nameSpace, method); |
} | } |
/// CIMMethod resolve |
|
|
/** CIMMethod resolve */ |
void resolve( | void resolve( |
DeclContext* declContext, | DeclContext* declContext, |
const String& nameSpace) | const String& nameSpace) |
|
|
_checkRep(); | _checkRep(); |
_rep->resolve(declContext, nameSpace); | _rep->resolve(declContext, nameSpace); |
} | } |
/// operator |
|
operator int() const { return _rep != 0; } |
/** Returns zero if CIMMethod refers to a null pointer */ |
/// method toXML - ATTN: |
operator int() const |
|
{ |
|
return _rep != 0; |
|
} |
|
|
|
/** method toXML - placing XML encoding of this object into out arguemnt. */ |
void toXml(Array<Sint8>& out) const | void toXml(Array<Sint8>& out) const |
{ | { |
_checkRep(); | _checkRep(); |
_rep->toXml(out); | _rep->toXml(out); |
} | } |
/// method print - ATTN: |
|
void print(std::ostream &o=std::cout) const |
/** method print - prints this method (in CIM encoded form). */ |
|
void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
{ | { |
_checkRep(); | _checkRep(); |
_rep->print(o); | _rep->print(o); |
} | } |
/// CIMMethod identical - ATTN |
|
|
/** CIMMethod identical - Returns true if this method is identical to the |
|
one given by the argument x. |
|
*/ |
Boolean identical(const CIMConstMethod& x) const; | Boolean identical(const CIMConstMethod& x) const; |
/// CIMMethod clone - ATTN |
|
|
/** CIMMethod clone - makes a distinct replica of this method */ |
CIMMethod clone() const | CIMMethod clone() const |
{ | { |
return CIMMethod(_rep->clone()); | return CIMMethod(_rep->clone()); |
|
|
{ | { |
} | } |
| |
explicit CIMMethod(const CIMConstMethod& x); |
PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x); |
| |
void _checkRep() const | void _checkRep() const |
{ | { |
if (!_rep) | if (!_rep) |
throw UnitializedHandle(); |
ThrowUnitializedHandle(); |
} | } |
| |
CIMMethodRep* _rep; | CIMMethodRep* _rep; |
|
|
friend class CIMClassRep; | friend class CIMClassRep; |
}; | }; |
| |
//////////////////////////////////////////////////////////////////////////////// |
|
// |
|
// CIMConstMethod |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
|
class PEGASUS_COMMON_LINKAGE CIMConstMethod | class PEGASUS_COMMON_LINKAGE CIMConstMethod |
{ | { |
public: | public: |
|
|
_rep->toXml(out); | _rep->toXml(out); |
} | } |
| |
void print(std::ostream &o=std::cout) const |
void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
{ | { |
_checkRep(); | _checkRep(); |
_rep->print(o); | _rep->print(o); |
|
|
void _checkRep() const | void _checkRep() const |
{ | { |
if (!_rep) | if (!_rep) |
throw UnitializedHandle(); |
ThrowUnitializedHandle(); |
} | } |
| |
CIMMethodRep* _rep; | CIMMethodRep* _rep; |