version 1.1, 2001/02/18 18:39:06
|
version 1.51, 2006/02/16 22:49:24
|
|
|
//BEGIN_LICENSE |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 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. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
|
// |
|
// Permission is hereby granted, free of charge, to any person obtaining a copy |
|
// of this software and associated documentation files (the "Software"), to |
|
// deal in the Software without restriction, including without limitation the |
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
// sell copies of the Software, and to permit persons to whom the Software is |
|
// furnished to do so, subject to the following conditions: |
|
// |
|
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
|
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
|
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
|
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|
// 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. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
//============================================================================== |
// copy of this software and associated documentation files (the "Software"), |
|
// to deal in the Software without restriction, including without limitation |
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
// and/or sell copies of the Software, and to permit persons to whom the |
|
// Software is furnished to do so, subject to the following conditions: |
|
// | // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
//%///////////////////////////////////////////////////////////////////////////// |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
// LIABILITY, WHETHER IN AN 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. |
|
// |
|
//END_LICENSE |
|
//BEGIN_HISTORY |
|
// |
|
// Author: |
|
// |
|
// $Log$ |
|
// Revision 1.1 2001/02/18 18:39:06 mike |
|
// new |
|
// |
|
// Revision 1.2 2001/02/18 03:56:01 mike |
|
// Changed more class names (e.g., ConstClassDecl -> CIMConstClass) |
|
// |
|
// Revision 1.1 2001/02/16 02:07:06 mike |
|
// Renamed many classes and headers (using new CIM prefixes). |
|
// |
|
// Revision 1.5 2001/02/16 00:34:17 mike |
|
// added ATTN |
|
// |
|
// Revision 1.4 2001/02/06 17:04:03 karl |
|
// add documentation |
|
// |
|
// Revision 1.3 2001/01/28 19:07:07 karl |
|
// add DOC++ comments |
|
// |
|
// Revision 1.2 2001/01/15 04:31:44 mike |
|
// worked on resolve scheme |
|
// |
|
// Revision 1.1.1.1 2001/01/14 19:52:57 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
|
|
/* |
|
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 |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/CIMMethodRep.h> |
#include <Pegasus/Common/Linkage.h> |
|
#include <Pegasus/Common/String.h> |
|
#include <Pegasus/Common/CIMName.h> |
|
#include <Pegasus/Common/CIMParameter.h> |
|
#include <Pegasus/Common/CIMQualifier.h> |
|
#include <Pegasus/Common/CIMType.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
class Resolver; |
class CIMConstMethod; | class CIMConstMethod; |
|
class CIMMethodRep; |
| |
/** Class CIMMethod - This class defines the operations associated with |
/** |
manipulation of the Pegasus implementation of the CIM CIMMethod. Within this |
The CIMMethod class represents the DMTF standard CIM method definition. |
class, methods are provides for creation, deletion, and manipulation of method |
A CIMMethod is generally defined in the context of a CIMClass. |
declarations. |
A CIMMethod consists of: |
|
<ul> |
|
<li>A CIMName containing the name of the method |
|
<li>A CIMType defining the method return type |
|
<li>Zero or more CIMQualifier objects |
|
<li>Zero or more CIMParameter objects defining the method parameters |
|
</ul> |
|
In addition, a CIMMethod has these 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 method 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. 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. |
|
</ul> |
|
|
|
<p>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. |
*/ | */ |
|
|
class PEGASUS_COMMON_LINKAGE CIMMethod | class PEGASUS_COMMON_LINKAGE CIMMethod |
{ | { |
public: | public: |
/// Creates and instantiates a CIM method. |
|
CIMMethod() : _rep(0) |
|
{ |
|
| |
} |
/** |
/** Creates and instantiates a CIM method from another method instance |
Constructs an uninitialized CIMMethod object. A method |
@return pointer to the new method instance |
invocation on an uninitialized object will result in the throwing |
*/ |
of an UninitializedObjectException. An uninitialized object may |
CIMMethod(const CIMMethod& x) |
be converted into an initialized object only by using the assignment |
{ |
operator with an initialized object. |
Inc(_rep = x._rep); |
*/ |
} |
CIMMethod(); |
/// |
|
CIMMethod& operator=(const CIMMethod& x) |
/** |
{ |
Constructs a CIMMethod object from the value of a specified |
if (x._rep != _rep) |
CIMMethod object, so that both objects refer to the same data copy. |
{ |
|
Dec(_rep); |
<p><b>Example:</b> |
Inc(_rep = x._rep); |
<pre> |
} |
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
return *this; |
const CIMMethod cm1(m1); |
} |
</pre> |
|
|
// ATTN: remove the classOrigin and propagated parameters. |
@param x The CIMMethod object from which to construct a new |
|
CIMMethod object. |
/** Creates a CIM method with the specified name, type, and classOrigin |
*/ |
@param name for the method |
CIMMethod(const CIMMethod& x); |
@param type ATTN |
|
@param classOrigin |
/** |
@param propagated |
Constructs a CIMMethod object with the specified attributes. |
@return Throws IllegalName if name argument not legal CIM identifier. |
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
</pre> |
|
|
|
@param name A CIMName specifying the name of the method. |
|
@param type A CIMType defining the method return type. |
|
@param classOrigin A CIMName indicating the class in which the |
|
method is locally defined (optional). |
|
@param 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. |
|
@exception UninitializedObjectException If the method name is null. |
*/ | */ |
CIMMethod( | CIMMethod( |
const String& name, |
const CIMName& name, |
CIMType type, | CIMType type, |
const String& classOrigin = String(), |
const CIMName& classOrigin = CIMName(), |
Boolean propagated = false) |
Boolean propagated = false); |
{ |
|
_rep = new CIMMethodRep(name, type, classOrigin, propagated); |
|
} |
|
| |
/// CIMMethod desctructor |
/** |
~CIMMethod() |
Destructs the CIMMethod object. |
{ |
|
Dec(_rep); |
|
} |
|
/** CIMMethod getName - Gets the name of the method |
|
@return String with the name of the method |
|
*/ | */ |
const String& getName() const |
~CIMMethod(); |
{ |
|
_checkRep(); |
|
return _rep->getName(); |
|
} |
|
| |
/** CIMMethod setName - Set the method name |
/** |
@parm name ATTN (make reference to name defintion here) |
Assigns the value of the specified CIMMethod object to this object, |
@return Throws IllegalName if name argument not legal CIM identifier. |
so that both objects refer to the same data copy. |
*/ |
|
void setName(const String& name) |
<p><b>Example:</b> |
{ |
<pre> |
_checkRep(); |
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
_rep->setName(name); |
CIMMethod m2; |
} |
m2 = m1; |
/** CIMMethod getType - gets the method type |
</pre> |
@return The CIM method type for this method. |
|
*/ |
@param x The CIMMethod object from which to assign this CIMMethod |
|
object. |
CIMType getType() const |
@return A reference to this CIMMethod object. |
{ |
*/ |
_checkRep(); |
CIMMethod& operator=(const CIMMethod& x); |
return _rep->getType(); |
|
} |
/** |
/** CIMMethod setType - Sets the method type to the specified CIM method |
Gets the name of the method. |
type as defined in CIMType /Ref{TYPE} |
<p><b>Example:</b> |
*/ |
<pre> |
void setType(CIMType type) |
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
{ |
assert(m1.getName() == CIMName ("getHostName")); |
_checkRep(); |
</pre> |
_rep->setType(type); |
@return A CIMName containing the name of the method. |
} |
@exception UninitializedObjectException If the object is not |
/** CIMMethod getClassOrigin - Returns the class in which this method |
initialized. |
was defined. |
*/ |
@return ATTN: |
const CIMName& getName() const; |
*/ |
|
const String& getClassOrigin() const |
/** |
{ |
Sets the method name. |
_checkRep(); |
<p><b>Example:</b> |
return _rep->getClassOrigin(); |
<pre> |
} |
CIMMethod m2(CIMName ("test"), CIMTYPE_STRING); |
/** CIMMethod setClassOrigin - ATTN: |
m2.setName(CIMName ("getVersion")); |
|
</pre> |
|
@return A CIMName containing the new name of the method. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
void setName(const CIMName& name); |
|
|
|
/** |
|
Gets the method return type. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
assert(m1.getType() == CIMTYPE_STRING); |
|
</pre> |
|
@return A CIMType containing the method return type. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMType getType() const; |
|
|
|
/** |
|
Sets the method return type to the specified CIMType. |
|
This is the type of the CIMValue |
|
that is returned on a CIM method invocation. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.setName(CIMName ("getVersion")); |
|
assert(m1.getName() == CIMName ("getVersion")); |
|
</pre> |
|
@param type CIMType to be set into the CIMMethod object. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
void setType(CIMType type); |
|
|
|
/** |
|
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. |
|
@return CIMName containing the classOrigin attribute. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
const CIMName& getClassOrigin() const; |
|
|
|
/** |
|
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. |
|
@param classOrigin A CIMName specifying the name of the class of |
|
origin for the method. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
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. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Boolean getPropagated() const; |
|
|
|
/** |
|
Sets the propagated attribute. Normally this is used by a CIM Server |
|
when defining a method in the context of a schema. |
|
@param propagated A Boolean indicating whether the method is |
|
propagated from a superclass. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
void setPropagated(Boolean propagated); |
|
|
|
/** |
|
Adds a qualifier to the method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
</pre> |
|
@param x The CIMQualifier to be added. |
|
@return A reference to this CIMMethod object. |
|
@exception AlreadyExistsException If a qualifier with the |
|
same name already exists in the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMMethod& addQualifier(const CIMQualifier& x); |
|
|
|
/** |
|
Finds a qualifier by name. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addQualifier(CIMQualifier(CIMName ("stuff"), true)); |
|
assert(m1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND); |
|
</pre> |
|
@param name A CIMName specifying the name of the qualifier to be found. |
|
@return Index of the qualifier if found or PEG_NOT_FOUND if not found. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 findQualifier(const CIMName& name) const; |
|
|
|
/** |
|
Gets the qualifier at the specified index. |
|
<p><b>Example:</b> |
|
<pre> |
|
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); |
|
} |
|
</pre> |
|
@param index The index of the qualifier to be retrieved. |
|
@return The CIMQualifier object at the specified index. |
|
@exception IndexOutOfBoundsException If the index is |
|
outside the range of qualifiers available for the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMQualifier getQualifier(Uint32 index); |
|
|
|
/** |
|
Gets the qualifier at the specified index. |
|
<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> |
|
@param index The index of the qualifier to be retrieved. |
|
@return The CIMConstQualifier object at the specified index. |
|
@exception IndexOutOfBoundsException If the index is |
|
outside the range of qualifiers available for the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMConstQualifier getQualifier(Uint32 index) const; |
|
|
|
/** |
|
Removes a qualifier from the method. |
|
<p><b>Example:</b> |
|
<pre> |
|
// remove all qualifiers from a class |
|
Uint32 count = 0; |
|
while((count = cimClass.getQualifierCount()) > 0) |
|
cimClass.removeQualifier(count - 1); |
|
</pre> |
|
@param index The index of the qualifier to remove. |
|
@exception IndexOutOfBoundsException If the index is |
|
outside the range of qualifiers available for the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
void removeQualifier(Uint32 index); |
|
|
|
/** |
|
Gets the number of qualifiers in the 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> |
|
@return An integer count of the qualifiers in the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 getQualifierCount() const; |
|
|
|
/** |
|
Adds a parameter to the method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
m1.addParameter(CIMParameter(CIMName("ipaddress"), CIMTYPE_STRING)); |
|
</pre> |
|
@param x The CIMParameter to be added. |
|
@return A reference to this CIMMethod object. |
|
@exception AlreadyExistsException If a parameter with the |
|
same name already exists in the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMMethod& addParameter(const CIMParameter& x); |
|
|
|
/** |
|
Finds a parameter by name. |
|
<p><b>Example:</b> |
|
<pre> |
|
Uint32 posParameter; |
|
posParameter = m1.findParameter(CIMName ("ipaddress")); |
|
if (posParameter != PEG_NOT_FOUND) |
|
... |
|
</pre> |
|
@param name A CIMName specifying the name of the parameter to be found. |
|
@return Index of the parameter if found or PEG_NOT_FOUND if not found. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 findParameter(const CIMName& name) const; |
|
|
|
/** |
|
Gets the parameter at the specified index. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMParameter cp; |
|
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress")); |
|
if (parameterIndex != PEG_NOT_FOUND) |
|
{ |
|
cp = m1.getParameter(parameterIndex); |
|
} |
|
</pre> |
|
@param index The index of the parameter to be retrieved. |
|
@return The CIMParameter at the specified index. |
|
@exception IndexOutOfBoundsException If the index is outside |
|
the range of parameters available for the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMParameter getParameter(Uint32 index); |
|
|
|
/** |
|
Gets the parameter at the specified index. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstParameter cp; |
|
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress")); |
|
if (parameterIndex != PEG_NOT_FOUND) |
|
{ |
|
cp = m1.getParameter(parameterIndex); |
|
} |
|
</pre> |
|
@param index The index of the parameter to be retrieved. |
|
@return The CIMConstParameter at the specified index. |
|
@exception IndexOutOfBoundsException If the index is outside |
|
the range of parameters available for the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMConstParameter getParameter(Uint32 index) const; |
|
|
|
/** |
|
Removes a parameter from the method. |
|
@param index Index of the parameter to be removed. |
|
@exception IndexOutOfBoundsException If the index is outside the |
|
range of parameters available from the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
void removeParameter (Uint32 index); |
|
|
|
/** |
|
Gets the number of parameters in the method. |
|
@return An integer count of the CIMParameters in the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 getParameterCount() const; |
|
|
|
/** |
|
Determines whether the object has been initialized. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1; |
|
assert(m1.isUninitialized()); |
|
</pre> |
|
@return True if the object has not been initialized, false otherwise. |
|
*/ |
|
Boolean isUninitialized() const; |
|
|
|
/** |
|
Compares the method with another method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING); |
|
assert(!m1.identical(m2)); |
|
</pre> |
|
@param x The CIMConstMethod to be compared. |
|
@return True if this method is identical to the one specified, |
|
false otherwise. |
|
@exception UninitializedObjectException If either of the objects |
|
is not initialized. |
*/ | */ |
void setClassOrigin(const String& classOrigin) |
Boolean identical(const CIMConstMethod& x) const; |
{ |
|
_checkRep(); |
|
_rep->setClassOrigin(classOrigin); |
|
} |
|
/// method getPropagated - ATTN: |
|
Boolean getPropagated() const |
|
{ |
|
_checkRep(); |
|
return _rep->getPropagated(); |
|
} |
|
/// method setPropagated - ATTN: |
|
void setPropagated(Boolean propagated) |
|
{ |
|
_checkRep(); |
|
_rep->setPropagated(propagated); |
|
} |
|
/** CIMMethod addQualifier - |
|
@parm CIMQualifier to add |
|
@param CIMQualifier to be added |
|
@return Throws AlreadyExists excetpion if the qualifier already exists in |
|
the method |
|
@exception AlreadyExists exception of CIMQualifier already exists. |
|
*/ |
|
CIMMethod& addQualifier(const CIMQualifier& x) |
|
{ |
|
_checkRep(); |
|
_rep->addQualifier(x); |
|
return *this; |
|
} |
|
/** CIMMethod findQualifier - Finds the CIMQualifier named by the input string. |
|
@param String defining the name of the parameter to be found |
|
@return Index to the parameter found or -1 if not found |
|
The -1 must be converted to a Unit32 as follows: |
|
<PRE> |
|
Uint32 pos = myClass.findProperty("name"); |
|
if (pos == Uint32(-1)) |
|
{ |
|
// Not found! |
|
} |
|
</PRE> |
|
*/ |
|
Uint32 findQualifier(const String& name) |
|
{ |
|
_checkRep(); |
|
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 |
|
{ |
|
_checkRep(); |
|
return _rep->findQualifier(name); |
|
} |
|
/** CIMMethod getQualifier - Gets the CIMQualifier defined by the index input |
|
as a parameter. |
|
@param Index 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. |
|
*/ |
|
CIMQualifier getQualifier(Uint32 pos) |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifier(pos); |
|
} |
|
|
|
CIMConstQualifier getQualifier(Uint32 pos) const |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifier(pos); |
|
} |
|
/** CIMMethod getQualifierCount - Returns count of the number of Qualifiers |
|
attached to the CIMMethod |
|
@return integer representing number of Qualifiers. |
|
*/ |
|
Uint32 getQualifierCount() const |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifierCount(); |
|
} |
|
/** CIMMethod addParameter - Adds the parameter defined by the input to the |
|
CIMMethod |
|
Param - ATTN: |
|
*/ |
|
CIMMethod& addParameter(const CIMParameter& x) |
|
{ |
|
_checkRep(); |
|
_rep->addParameter(x); |
|
return *this; |
|
} |
|
/// CIMMethod findParameter - ATTN: |
|
Uint32 findParameter(const String& name) |
|
{ |
|
_checkRep(); |
|
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 |
|
{ |
|
_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 |
/** |
input as a parameter. |
Makes a deep copy of the method. This creates a new copy |
@param index for the parameter to be returned. |
of all the method attributes including parameters and qualifiers. |
@return CIMParameter requested. |
@return A new copy of the CIMMethod object. |
@Exception OutOfBounds exception is thrown if the index is outside the |
@exception UninitializedObjectException If the object is not |
range of available parameters |
initialized. |
*/ | */ |
CIMConstParameter getParameter(Uint32 pos) const |
CIMMethod clone() const; |
{ |
|
_checkRep(); |
|
return _rep->getParameter(pos); |
|
} |
|
|
|
/** CIMMethod getParameterCount - Gets the count of the numbeer of Parameters |
|
attached to the CIMMethod. |
|
@retrun - count of the number of parameters attached to the CIMMethod. |
|
*/ |
|
Uint32 getParameterCount() const |
|
{ |
|
_checkRep(); |
|
return _rep->getParameterCount(); |
|
} |
|
/// method resolve - ATTN: |
|
void resolve( |
|
DeclContext* declContext, |
|
const String& nameSpace, |
|
const CIMConstMethod& method) |
|
{ |
|
_checkRep(); |
|
_rep->resolve(declContext, nameSpace, method); |
|
} |
|
/// CIMMethod resolve |
|
void resolve( |
|
DeclContext* declContext, |
|
const String& nameSpace) |
|
{ |
|
_checkRep(); |
|
_rep->resolve(declContext, nameSpace); |
|
} |
|
/// operator |
|
operator int() const { return _rep != 0; } |
|
/// method toXML - ATTN: |
|
void toXml(Array<Sint8>& out) const |
|
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
/// method print - ATTN: |
|
void print() const |
|
{ |
|
_checkRep(); |
|
_rep->print(); |
|
} |
|
/// CIMMethod identical - ATTN |
|
Boolean identical(const CIMConstMethod& x) const; |
|
/// CIMMethod clone - ATTN |
|
CIMMethod clone() const |
|
{ |
|
return CIMMethod(_rep->clone()); |
|
} |
|
| |
private: | private: |
| |
CIMMethod(CIMMethodRep* rep) : _rep(rep) |
CIMMethod(CIMMethodRep* rep); |
{ |
|
} |
|
| |
explicit CIMMethod(const CIMConstMethod& x); |
/** |
|
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); |
| |
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 Resolver; |
|
friend class XmlWriter; |
|
friend class MofWriter; |
|
friend class BinaryStreamer; |
}; | }; |
| |
//////////////////////////////////////////////////////////////////////////////// |
/** |
// |
The CIMConstMethod class provides a const interface to a CIMMethod |
// CIMConstMethod |
object. This class is needed because the shared representation model |
// |
used by CIMMethod does not prevent modification to a const CIMMethod |
//////////////////////////////////////////////////////////////////////////////// |
object. Note that the value of a CIMConstMethod object could still be |
|
modified by a CIMMethod object that refers to the same data copy. |
|
*/ |
class PEGASUS_COMMON_LINKAGE CIMConstMethod | class PEGASUS_COMMON_LINKAGE CIMConstMethod |
{ | { |
public: | public: |
| |
CIMConstMethod() : _rep(0) |
/** |
{ |
Constructs an uninitialized CIMConstMethod 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 |
CIMConstMethod(const CIMConstMethod& x) |
operator with an initialized object. |
{ |
*/ |
Inc(_rep = x._rep); |
CIMConstMethod(); |
} |
|
|
/** |
CIMConstMethod(const CIMMethod& x) |
Constructs a CIMConstMethod object from the value of a specified |
{ |
CIMConstMethod object, so that both objects refer to the same data |
Inc(_rep = x._rep); |
copy. |
} |
|
|
<p><b>Example:</b> |
CIMConstMethod& operator=(const CIMConstMethod& x) |
<pre> |
{ |
CIMConstMethod cm1(CIMName ("getHostName"), CIMTYPE_STRING); |
if (x._rep != _rep) |
CIMConstMethod cm2(m1); |
{ |
</pre> |
Dec(_rep); |
|
Inc(_rep = x._rep); |
@param x The CIMConstMethod object from which to construct a new |
} |
CIMConstMethod object. |
return *this; |
*/ |
} |
CIMConstMethod(const CIMConstMethod& x); |
|
|
CIMConstMethod& operator=(const CIMMethod& x) |
/** |
{ |
Constructs a CIMConstMethod object from the value of a specified |
if (x._rep != _rep) |
CIMMethod object, so that both objects refer to the same data |
{ |
copy. |
Dec(_rep); |
|
Inc(_rep = x._rep); |
<p><b>Example:</b> |
} |
<pre> |
return *this; |
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
} |
CIMConstMethod cm1(m1); |
|
</pre> |
// Throws IllegalName if name argument not legal CIM identifier. |
|
|
@param x The CIMMethod object from which to construct a new |
|
CIMConstMethod object. |
|
*/ |
|
CIMConstMethod(const CIMMethod& x); |
|
|
|
/** |
|
Constructs a CIMConstMethod object with the specified attributes. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
</pre> |
|
|
|
@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. |
|
@exception UninitializedObjectException If the method name is null. |
|
*/ |
CIMConstMethod( | CIMConstMethod( |
const String& name, |
const CIMName& name, |
CIMType type, | CIMType type, |
const String& classOrigin = String(), |
const CIMName& classOrigin = CIMName(), |
Boolean propagated = false) |
Boolean propagated = false); |
{ |
|
_rep = new CIMMethodRep(name, type, classOrigin, propagated); |
|
} |
|
|
|
~CIMConstMethod() |
|
{ |
|
Dec(_rep); |
|
} |
|
|
|
const String& getName() const |
|
{ |
|
_checkRep(); |
|
return _rep->getName(); |
|
} |
|
|
|
CIMType getType() const |
|
{ |
|
_checkRep(); |
|
return _rep->getType(); |
|
} |
|
|
|
const String& getClassOrigin() const |
|
{ |
|
_checkRep(); |
|
return _rep->getClassOrigin(); |
|
} |
|
|
|
Boolean getPropagated() const |
|
{ |
|
_checkRep(); |
|
return _rep->getPropagated(); |
|
} |
|
|
|
Uint32 findQualifier(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->findQualifier(name); |
|
} |
|
|
|
Uint32 getQualifier(Uint32 pos) const |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifier(pos); |
|
} |
|
|
|
Uint32 getQualifierCount() const |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifierCount(); |
|
} |
|
|
|
Uint32 findParameter(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->findParameter(name); |
|
} |
|
| |
CIMConstParameter getParameter(Uint32 pos) const |
/** |
{ |
Destructs the CIMConstMethod object. |
_checkRep(); |
*/ |
return _rep->getParameter(pos); |
~CIMConstMethod(); |
} |
|
|
|
Uint32 getParameterCount() const |
|
{ |
|
_checkRep(); |
|
return _rep->getParameterCount(); |
|
} |
|
|
|
operator int() const { return _rep != 0; } |
|
|
|
void toXml(Array<Sint8>& out) const |
|
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
|
|
void print() const |
|
{ |
|
_checkRep(); |
|
_rep->print(); |
|
} |
|
| |
Boolean identical(const CIMConstMethod& x) const |
/** |
{ |
Assigns the value of the specified CIMConstMethod object to this |
x._checkRep(); |
object, so that both objects refer to the same data copy. |
_checkRep(); |
|
return _rep->identical(x._rep); |
<p><b>Example:</b> |
} |
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2; |
|
m2 = m1; |
|
</pre> |
|
|
|
@param x The CIMConstMethod object from which to assign this |
|
CIMConstMethod object. |
|
@return A reference to this CIMConstMethod object. |
|
*/ |
|
CIMConstMethod& operator=(const CIMConstMethod& x); |
|
|
|
/** |
|
Assigns the value of the specified CIMMethod object to this |
|
object, so that both objects refer to the same data copy. |
|
|
|
<p><b>Example:</b> |
|
<pre> |
|
CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2; |
|
m2 = m1; |
|
</pre> |
|
|
|
@param x The CIMMethod object from which to assign this |
|
CIMConstMethod object. |
|
@return A reference to this CIMConstMethod object. |
|
*/ |
|
CIMConstMethod& operator=(const CIMMethod& x); |
|
|
|
/** |
|
Gets the name of the method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
assert(m1.getName() == CIMName ("getHostName")); |
|
</pre> |
|
@return CIMName with the name of the method. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
const CIMName& getName() const; |
|
|
|
/** |
|
Gets the method return type. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
assert(m1.getType() == CIMTYPE_STRING); |
|
</pre> |
|
@return A CIMType containing the method return type. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMType getType() 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. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
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. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Boolean getPropagated() const; |
|
|
|
/** |
|
Finds a qualifier by name. |
|
<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> |
|
@param name A CIMName specifying the name of the qualifier to be found. |
|
@return Index of the qualifier if found or PEG_NOT_FOUND if not found. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 findQualifier(const CIMName& name) const; |
|
|
|
/** |
|
Gets the qualifier at the specified index. |
|
<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> |
|
@param index The index of the qualifier to be retrieved. |
|
@return The CIMConstQualifier at the specified index. |
|
@exception IndexOutOfBoundsException If the index is |
|
outside the range of qualifiers available for the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMConstQualifier getQualifier(Uint32 index) const; |
|
|
|
/** |
|
Gets the number of qualifiers in the 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> |
|
@return An integer count of the CIMQualifiers in the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 getQualifierCount() const; |
|
|
|
/** |
|
Finds a parameter by name. |
|
<p><b>Example:</b> |
|
<pre> |
|
Uint32 posParameter; |
|
posParameter = m1.findParameter(CIMName ("ipaddress")); |
|
if (posParameter != PEG_NOT_FOUND) |
|
... |
|
</pre> |
|
@param name A CIMName specifying the name of the parameter to be found. |
|
@return Index of the parameter if found or PEG_NOT_FOUND if not found. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 findParameter(const CIMName& name) const; |
|
|
|
/** |
|
Gets the parameter at the specified index. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstParameter cp; |
|
Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress")); |
|
if (parameterIndex != PEG_NOT_FOUND) |
|
{ |
|
cp = m1.getParameter(parameterIndex); |
|
} |
|
</pre> |
|
@param index The index of the parameter to be retrieved. |
|
@return The CIMConstParameter at the specified index. |
|
@exception IndexOutOfBoundsException If the index is |
|
outside the range of parameters available for the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMConstParameter getParameter(Uint32 index) const; |
|
|
|
/** |
|
Gets the number of parameters in the method. |
|
@return An integer count of the CIMParameters in the CIMMethod. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 getParameterCount() const; |
|
|
|
/** |
|
Determines whether the object has been initialized. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1; |
|
assert(m1.isUninitialized()); |
|
</pre> |
|
@return True if the object has not been initialized, false otherwise. |
|
*/ |
|
Boolean isUninitialized() const; |
|
|
|
/** |
|
Compares the method with another method. |
|
<p><b>Example:</b> |
|
<pre> |
|
CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING); |
|
CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING); |
|
assert(!m1.identical(m2)); |
|
</pre> |
|
@param x The CIMConstMethod to be compared. |
|
@return True if this method is identical to the one specified, |
|
false otherwise. |
|
@exception UninitializedObjectException If either of the objects |
|
is not initialized. |
|
*/ |
|
Boolean identical(const CIMConstMethod& x) const; |
| |
CIMMethod clone() const |
/** |
{ |
Makes a deep copy of the method. This creates a new copy |
return CIMMethod(_rep->clone()); |
of all the method attributes including parameters and qualifiers. |
} |
@return A CIMMethod object with a separate copy of the |
|
CIMConstMethod object. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMMethod clone() const; |
| |
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 */ |