version 1.7, 2001/05/06 13:16:16
|
version 1.26, 2002/06/03 22:42:05
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// copy of this software and associated documentation files (the "Software"), |
// of this software and associated documentation files (the "Software"), to |
// to deal in the Software without restriction, including without limitation |
// deal in the Software without restriction, including without limitation the |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// and/or sell copies of the Software, and to permit persons to whom the |
// sell copies of the Software, and to permit persons to whom the Software is |
// Software is furnished to do so, subject to the following conditions: |
// furnished to do so, subject to the following conditions: |
// | // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// DEALINGS IN THE SOFTWARE. |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: |
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#define Pegasus_Method_h | #define Pegasus_Method_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/CIMMethodRep.h> |
#include <Pegasus/Common/String.h> |
|
#include <Pegasus/Common/CIMParameter.h> |
|
#include <Pegasus/Common/CIMQualifier.h> |
|
#include <Pegasus/Common/CIMType.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
class DeclContext; |
class CIMConstMethod; | class CIMConstMethod; |
|
class CIMMethodRep; |
| |
|
// ATTN: remove the classOrigin and propagated parameters. |
/** 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 | manipulation of the Pegasus implementation of the CIM CIMMethod. Within |
this class, methods are provides for creation, deletion, and manipulation | this class, methods are provides for creation, deletion, and manipulation |
of method 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(); |
{ |
|
|
|
} |
|
| |
/** 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 |
*/ | */ |
CIMMethod(const CIMMethod& x) |
CIMMethod(const CIMMethod& x); |
{ |
|
Inc(_rep = x._rep); |
|
} |
|
|
|
/** Assignment operator */ |
|
CIMMethod& operator=(const CIMMethod& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
|
| |
/** 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 CIM data type of method to create |
@param classOrigin | @param classOrigin |
@param propagated | @param propagated |
@return Throws IllegalName if name argument not legal CIM identifier. | @return Throws IllegalName if name argument not legal CIM identifier. |
|
|
CIMMethod( | CIMMethod( |
const String& name, | const String& name, |
CIMType type, | CIMType type, |
const String& classOrigin = String(), |
const String& classOrigin = String::EMPTY, |
Boolean propagated = false) |
Boolean propagated = false); |
{ |
|
_rep = new CIMMethodRep(name, type, classOrigin, propagated); |
|
} |
|
| |
/** Desctructor. */ | /** Desctructor. */ |
~CIMMethod() |
~CIMMethod(); |
{ |
|
Dec(_rep); |
/** Assignment operator */ |
} |
CIMMethod& operator=(const CIMMethod& x); |
| |
/** CIMMethod getName - Gets the name of the method |
/** getName - Gets the name of the method |
@return String with the name of the method | @return String with the name of the method |
*/ | */ |
const String& getName() const |
const String& getName() const; |
{ |
|
_checkRep(); |
|
return _rep->getName(); |
|
} |
|
| |
/** CIMMethod setName - Set the method name |
/** setName - Set the method name |
@param name | @param name |
@exception 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(); |
|
_rep->setName(name); |
|
} |
|
| |
/** CIMMethod getType - gets the method type |
/** 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(); |
|
return _rep->getType(); |
|
} |
|
| |
/** CIMMethod setType - Sets the method type to the specified CIM method |
/** setType - Sets the method type to the specified CIM method |
type as defined in CIMType /Ref{TYPE} | type as defined in CIMType /Ref{TYPE} |
*/ | */ |
void setType(CIMType type) |
void setType(CIMType type); |
{ |
|
_checkRep(); |
|
_rep->setType(type); |
|
} |
|
| |
/** CIMMethod getClassOrigin - Returns the class in which this method |
/** getClassOrigin - Returns the class in which this method |
was defined. | was defined. |
@return ATTN: |
@return String containing the classOrigin field. |
*/ | */ |
const String& getClassOrigin() const |
const String& getClassOrigin() const; |
{ |
|
_checkRep(); |
|
return _rep->getClassOrigin(); |
|
} |
|
| |
/** CIMMethod setClassOrigin - ATTN: */ |
/** setClassOrigin - Set the ClassOrigin attribute with |
void setClassOrigin(const String& classOrigin) |
the classname defined on input |
{ |
@param classOrigin - String parameter defining the name |
_checkRep(); |
of the class origin |
_rep->setClassOrigin(classOrigin); |
*/ |
} |
void setClassOrigin(const String& classOrigin); |
| |
/** method getPropagated - ATTN: */ |
/** getPropagated - Tests the propogated qualifier |
Boolean getPropagated() const |
@return - returns True if method is propogated |
{ |
*/ |
_checkRep(); |
Boolean getPropagated() const; |
return _rep->getPropagated(); |
|
} |
|
| |
/** method setPropagated - ATTN: */ |
/** setPropagated - Sets the Propagaged Qualifier */ |
void setPropagated(Boolean propagated) |
void setPropagated(Boolean propagated); |
{ |
|
_checkRep(); |
|
_rep->setPropagated(propagated); |
|
} |
|
| |
/** CIMMethod addQualifier - Adds a Qualifier to the method object. |
/** 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 | @return Throws AlreadyExists excetpion if the qualifier already exists |
in the method | in the method |
@exception AlreadyExists exception | @exception AlreadyExists exception |
*/ | */ |
CIMMethod& addQualifier(const CIMQualifier& x) |
CIMMethod& addQualifier(const CIMQualifier& x); |
{ |
|
_checkRep(); |
|
_rep->addQualifier(x); |
|
return *this; |
|
} |
|
| |
/** CIMMethod findQualifier - returns the position of the qualifier with |
/** findQualifier - returns the position of the qualifier with |
the given name. | the given name. |
@param name Name of qualifier to be found. | @param name Name of qualifier to be found. |
@return index of the parameter if found; otherwise Uint32(-1). |
@return index of the parameter if found; otherwise PEG_NOT_FOUND. |
*/ | */ |
Uint32 findQualifier(const String& name) |
Uint32 findQualifier(const String& name) const; |
{ |
|
_checkRep(); |
|
return _rep->findQualifier(name); |
|
} |
|
| |
Uint32 findQualifier(const String& name) const |
/** existsQualifier - returns the position of the qualifier with |
{ |
the given name. |
_checkRep(); |
@param name Name of qualifier to be found. |
return _rep->findQualifier(name); |
@return index of the parameter if found; otherwise PEG_NOT_FOUND. |
} |
*/ |
|
Boolean existsQualifier(const String& name) const; |
| |
/** CIMMethod getQualifier - Gets the CIMQualifier defined by the index |
/** getQualifier - Gets the CIMQualifier defined by the index |
input as a parameter. | 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 |
parameters available from the CIMMethod. | parameters available from the CIMMethod. |
*/ | */ |
CIMQualifier getQualifier(Uint32 pos) |
CIMQualifier getQualifier(Uint32 pos); |
{ |
|
_checkRep(); |
|
return _rep->getQualifier(pos); |
|
} |
|
| |
CIMConstQualifier getQualifier(Uint32 pos) const |
CIMConstQualifier getQualifier(Uint32 pos) const; |
{ |
|
_checkRep(); |
/** removeQualifier - Removes the CIMQualifier defined by the |
return _rep->getQualifier(pos); |
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); |
| |
/** CIMMethod getQualifierCount - Returns the number of Qualifiers attached |
/** getQualifierCount - Returns the number of Qualifiers attached |
to this method. |
to this CIMMethod object. |
@return integer representing number of Qualifiers. | @return integer representing number of Qualifiers. |
*/ | */ |
Uint32 getQualifierCount() const |
Uint32 getQualifierCount() const; |
{ |
|
_checkRep(); |
|
return _rep->getQualifierCount(); |
|
} |
|
| |
/** CIMMethod addParameter - Adds the parameter defined by the input |
/** addParameter - Adds the parameter defined by the input |
to the CIMMethod | to the CIMMethod |
*/ | */ |
CIMMethod& addParameter(const CIMParameter& x) |
CIMMethod& addParameter(const CIMParameter& x); |
{ |
|
_checkRep(); |
|
_rep->addParameter(x); |
|
return *this; |
|
} |
|
| |
/** CIMMethod findParameter - Finds the parameter whose name is given |
/** findParameter - Finds the parameter whose name is given |
by the name parameter. | by the name parameter. |
@param name Name of parameter to be found. | @param name Name of parameter to be found. |
@return index of the parameter if found; otherwise Uint32(-1). |
@return index of the parameter if found; otherwise PEG_NOT_FOUND. |
*/ | */ |
Uint32 findParameter(const String& name) |
Uint32 findParameter(const String& name) const; |
{ |
|
_checkRep(); |
|
return _rep->findParameter(name); |
|
} |
|
|
|
Uint32 findParameter(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->findParameter(name); |
|
} |
|
|
|
/** CIMMethod getParameter - ATTN: */ |
|
CIMParameter getParameter(Uint32 pos) |
|
{ |
|
_checkRep(); |
|
return _rep->getParameter(pos); |
|
} |
|
| |
/** CIMMethod getParameter - Gets the parameter defined by the index |
/** getParameter - Gets the parameter defined by the index |
input as a parameter. | input as a parameter. |
@param index for the parameter to be returned. | @param index for the parameter to be returned. |
@return CIMParameter requested. | @return CIMParameter requested. |
@Exception OutOfBounds exception is thrown if the index is outside the | @Exception OutOfBounds exception is thrown if the index is outside the |
range of available parameters | range of available parameters |
*/ | */ |
CIMConstParameter getParameter(Uint32 pos) const |
CIMParameter getParameter(Uint32 pos); |
{ |
|
_checkRep(); |
/** getParameter - const form */ |
return _rep->getParameter(pos); |
CIMConstParameter getParameter(Uint32 pos) const; |
} |
|
| |
/** CIMMethod getParameterCount - Gets the count of the numbeer of |
/** getParameterCount - Gets the count of the numbeer of |
Parameters 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(); |
|
return _rep->getParameterCount(); |
|
} |
|
| |
/** method resolve - ATTN: */ |
#ifdef PEGASUS_INTERNALONLY |
|
/** resolve - resolves and completes the CIMMethod */ |
void resolve( | void resolve( |
DeclContext* declContext, | DeclContext* declContext, |
const String& nameSpace, | const String& nameSpace, |
const CIMConstMethod& method) |
const CIMConstMethod& method); |
{ |
|
_checkRep(); |
|
_rep->resolve(declContext, nameSpace, method); |
|
} |
|
| |
/** CIMMethod resolve */ |
/** resolve - Resolves and completes the CIMMethod */ |
void resolve( | void resolve( |
DeclContext* declContext, | DeclContext* declContext, |
const String& nameSpace) |
const String& nameSpace); |
{ |
|
_checkRep(); |
|
_rep->resolve(declContext, nameSpace); |
|
} |
|
| |
/** Returns zero if CIMMethod refers to a null pointer */ |
/** Returns true if CIMMethod refers to a null pointer */ |
operator int() const |
Boolean isNull() const; |
{ |
#endif |
return _rep != 0; |
|
} |
|
| |
/** method toXML - placing XML encoding of this object into out arguemnt. */ |
/** identical - Returns true if this method is identical to the |
void toXml(Array<Sint8>& out) const |
|
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
|
|
/** method print - prints this method (in CIM encoded form). */ |
|
void print(std::ostream &o=std::cout) const |
|
{ |
|
_checkRep(); |
|
_rep->print(o); |
|
} |
|
|
|
/** CIMMethod identical - Returns true if this method is identical to the |
|
one given by the argument x. | one given by the argument x. |
*/ | */ |
Boolean identical(const CIMConstMethod& x) const; | Boolean identical(const CIMConstMethod& x) const; |
| |
/** CIMMethod clone - makes a distinct replica of this method */ | /** CIMMethod clone - makes a distinct replica of this method */ |
CIMMethod clone() const |
CIMMethod clone() const; |
{ |
|
return CIMMethod(_rep->clone()); |
|
} |
|
| |
private: | private: |
| |
CIMMethod(CIMMethodRep* rep) : _rep(rep) |
CIMMethod(CIMMethodRep* rep); |
{ |
|
} |
|
| |
explicit CIMMethod(const CIMConstMethod& x); |
PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x); |
| |
void _checkRep() const |
void _checkRep() const; |
{ |
|
if (!_rep) |
|
throw UnitializedHandle(); |
|
} |
|
| |
CIMMethodRep* _rep; | CIMMethodRep* _rep; |
friend class CIMConstMethod; | friend class CIMConstMethod; |
friend class CIMClassRep; |
friend class XmlWriter; |
|
friend class MofWriter; |
}; | }; |
| |
class PEGASUS_COMMON_LINKAGE CIMConstMethod | class PEGASUS_COMMON_LINKAGE CIMConstMethod |
{ | { |
public: | public: |
| |
CIMConstMethod() : _rep(0) |
CIMConstMethod(); |
{ |
|
|
|
} |
|
| |
CIMConstMethod(const CIMConstMethod& x) |
CIMConstMethod(const CIMConstMethod& x); |
{ |
|
Inc(_rep = x._rep); |
|
} |
|
| |
CIMConstMethod(const CIMMethod& x) |
CIMConstMethod(const CIMMethod& x); |
{ |
|
Inc(_rep = x._rep); |
|
} |
|
|
|
CIMConstMethod& operator=(const CIMConstMethod& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
|
|
|
CIMConstMethod& operator=(const CIMMethod& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
|
| |
// Throws IllegalName if name argument not legal CIM identifier. | // Throws IllegalName if name argument not legal CIM identifier. |
|
|
CIMConstMethod( | CIMConstMethod( |
const String& name, | const String& name, |
CIMType type, | CIMType type, |
const String& classOrigin = String(), |
const String& classOrigin = String::EMPTY, |
Boolean propagated = false) |
Boolean propagated = false); |
{ |
|
_rep = new CIMMethodRep(name, type, classOrigin, propagated); |
|
} |
|
| |
~CIMConstMethod() |
~CIMConstMethod(); |
{ |
|
Dec(_rep); |
|
} |
|
| |
const String& getName() const |
CIMConstMethod& operator=(const CIMConstMethod& x); |
{ |
|
_checkRep(); |
|
return _rep->getName(); |
|
} |
|
| |
CIMType getType() const |
CIMConstMethod& operator=(const CIMMethod& x); |
{ |
|
_checkRep(); |
|
return _rep->getType(); |
|
} |
|
| |
const String& getClassOrigin() const |
const String& getName() const; |
{ |
|
_checkRep(); |
|
return _rep->getClassOrigin(); |
|
} |
|
| |
Boolean getPropagated() const |
CIMType getType() const; |
{ |
|
_checkRep(); |
|
return _rep->getPropagated(); |
|
} |
|
| |
Uint32 findQualifier(const String& name) const |
const String& getClassOrigin() const; |
{ |
|
_checkRep(); |
|
return _rep->findQualifier(name); |
|
} |
|
| |
Uint32 getQualifier(Uint32 pos) const |
Boolean getPropagated() const; |
{ |
|
_checkRep(); |
|
return _rep->getQualifier(pos); |
|
} |
|
| |
Uint32 getQualifierCount() const |
Uint32 findQualifier(const String& name) const; |
{ |
|
_checkRep(); |
|
return _rep->getQualifierCount(); |
|
} |
|
| |
Uint32 findParameter(const String& name) const |
CIMConstQualifier getQualifier(Uint32 pos) const; |
{ |
|
_checkRep(); |
|
return _rep->findParameter(name); |
|
} |
|
| |
CIMConstParameter getParameter(Uint32 pos) const |
Uint32 getQualifierCount() const; |
{ |
|
_checkRep(); |
|
return _rep->getParameter(pos); |
|
} |
|
| |
Uint32 getParameterCount() const |
Uint32 findParameter(const String& name) const; |
{ |
|
_checkRep(); |
|
return _rep->getParameterCount(); |
|
} |
|
| |
operator int() const { return _rep != 0; } |
CIMConstParameter getParameter(Uint32 pos) const; |
| |
void toXml(Array<Sint8>& out) const |
Uint32 getParameterCount() const; |
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
| |
void print(std::ostream &o=std::cout) const |
#ifdef PEGASUS_INTERNALONLY |
{ |
Boolean isNull() const; |
_checkRep(); |
#endif |
_rep->print(o); |
|
} |
|
| |
Boolean identical(const CIMConstMethod& x) const |
Boolean identical(const CIMConstMethod& x) const; |
{ |
|
x._checkRep(); |
|
_checkRep(); |
|
return _rep->identical(x._rep); |
|
} |
|
| |
CIMMethod clone() const |
CIMMethod clone() const; |
{ |
|
return CIMMethod(_rep->clone()); |
|
} |
|
| |
private: | private: |
| |
void _checkRep() const |
void _checkRep() const; |
{ |
|
if (!_rep) |
|
throw UnitializedHandle(); |
|
} |
|
| |
CIMMethodRep* _rep; | CIMMethodRep* _rep; |
| |
friend class CIMMethod; | friend class CIMMethod; |
friend class CIMMethodRep; | friend class CIMMethodRep; |
|
friend class XmlWriter; |
|
friend class MofWriter; |
}; | }; |
| |
|
#define PEGASUS_ARRAY_T CIMMethod |
|
# include <Pegasus/Common/ArrayInter.h> |
|
#undef PEGASUS_ARRAY_T |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
#endif /* Pegasus_Method_h */ | #endif /* Pegasus_Method_h */ |