version 1.19, 2002/04/19 12:09:26
|
version 1.20, 2002/05/07 00:41:34
|
|
|
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: Karl Schopmeyer (k.schopmeyer@opengroup.org) | // Modified By: Karl Schopmeyer (k.schopmeyer@opengroup.org) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#define Pegasus_Qualifier_h | #define Pegasus_Qualifier_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/CIMQualifierRep.h> |
|
#include <Pegasus/Common/CIMFlavor.h> | #include <Pegasus/Common/CIMFlavor.h> |
|
#include <Pegasus/Common/CIMType.h> |
|
#include <Pegasus/Common/CIMValue.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
class CIMClassRep; | class CIMClassRep; |
| |
/** Class CIMQualifier - This class defines the Pegasus implementation of the | /** Class CIMQualifier - This class defines the Pegasus implementation of the |
CIM CIMQualifier \Ref{QUALIFIER}. |
CIM Qualifier \Ref{QUALIFIER}. It is almost identical to |
This class represents a CIM qualifiers. It is almost identical to |
|
CIMQualifierDecl except that it has no scope member. \Ref{CIMQualifierDecl} | CIMQualifierDecl except that it has no scope member. \Ref{CIMQualifierDecl} |
This includes functions to create qualifiers and manipulate/test | This includes functions to create qualifiers and manipulate/test |
the individual components of the CIMQualifier. | the individual components of the CIMQualifier. |
CIMQualifiers are accumulated into lists for use in CIMClasses and CIM Properties |
CIMQualifiers are accumulated into lists for use in CIMClasses and CIM |
using the CIMQualifierList Class and its functions. \Ref{CIMQualifierList} |
Properties using the CIMQualifierList Class and its |
|
functions. \Ref{CIMQualifierList} |
*/ | */ |
class PEGASUS_COMMON_LINKAGE CIMQualifier | class PEGASUS_COMMON_LINKAGE CIMQualifier |
{ | { |
|
|
fields.Constructor | fields.Constructor |
@return instantiated empty qualifier object | @return instantiated empty qualifier object |
*/ | */ |
CIMQualifier() : _rep(0) |
CIMQualifier(); |
{ |
|
|
|
} |
|
| |
/** Constructor - instantiates a CIM qualifier object from another | /** Constructor - instantiates a CIM qualifier object from another |
qualifier object. | qualifier object. |
@param CIM CIMQualifier object | @param CIM CIMQualifier object |
@return - Instantiated qualifier object | @return - Instantiated qualifier object |
*/ | */ |
CIMQualifier(const CIMQualifier& x) |
CIMQualifier(const CIMQualifier& x); |
{ |
|
Inc(_rep = x._rep); |
|
} |
|
/** Constructor - Instantiates a CIM qualifier object with the parameters | /** Constructor - Instantiates a CIM qualifier object with the parameters |
defined on input. | defined on input. |
@param String representing CIMName for the new qualifier | @param String representing CIMName for the new qualifier |
@param value | @param value |
@param flavor - Flavor defined for this qualifier definition. Default for this |
@param flavor - Flavor defined for this qualifier definition. Default |
parameter is CIMFlavor::NONE. |
for this parameter is CIMFlavor::NONE. |
@param propoagated - Boolean defining whether this is a propagated qualifier. |
@param propoagated - Boolean defining whether this is a propagated |
This is an optional parameter with default = false |
qualifier. This is an optional parameter with default = false |
@return -Returns the instantiated qualifier object or throws an exception |
@return -Returns the instantiated qualifier object or throws an |
if the name argument is illegal |
exception if the name argument is illegal |
| |
@exception Throws IllegalName if name argument not legal CIM | @exception Throws IllegalName if name argument not legal CIM |
identifier. | identifier. |
|
|
const String& name, | const String& name, |
const CIMValue& value, | const CIMValue& value, |
Uint32 flavor = CIMFlavor::NONE, | Uint32 flavor = CIMFlavor::NONE, |
Boolean propagated = false) |
Boolean propagated = false); |
{ |
|
_rep = new CIMQualifierRep(name, value, flavor, propagated); |
|
} |
|
/// destructor | /// destructor |
~CIMQualifier() |
~CIMQualifier(); |
{ |
|
Dec(_rep); |
|
} |
|
/// operator |
|
CIMQualifier& operator=(const CIMQualifier& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
| |
return *this; |
/// operator |
} |
CIMQualifier& operator=(const CIMQualifier& x); |
| |
/** getName - Returns the name field from the qualifier | /** getName - Returns the name field from the qualifier |
@return String containing the qualifier name. | @return String containing the qualifier name. |
|
|
*/ | */ |
const String& getName() const |
const String& getName() const; |
{ |
|
_checkRep(); |
|
return _rep->getName(); |
|
} |
|
| |
/** setName - Sets the qualifier name field in the qualifier object. | /** setName - Sets the qualifier name field in the qualifier object. |
@param name - String containing the name for the qualifier | @param name - String containing the name for the qualifier |
@exception Throws IllegalName if name argument not legal CIM identifier. | @exception Throws IllegalName if name argument not legal CIM identifier. |
*/ | */ |
void setName(const String& name) |
void setName(const String& name); |
{ |
|
_checkRep(); |
|
_rep->setName(name); |
|
} |
|
| |
/** getType - Gets the type field from the qualifier object. | /** getType - Gets the type field from the qualifier object. |
@return CIMType containing the type for this qualifier /Ref{CIMType}. | @return CIMType containing the type for this qualifier /Ref{CIMType}. |
|
|
*/ | */ |
CIMType getType() const |
CIMType getType() const; |
{ |
|
_checkRep(); |
|
return _rep->getType(); |
|
} |
|
| |
/** isArray - Returns true if the qualifier is an array | /** isArray - Returns true if the qualifier is an array |
@return Boolean true if array qualifier. | @return Boolean true if array qualifier. |
*/ | */ |
Boolean isArray() const |
Boolean isArray() const; |
{ |
|
_checkRep(); |
|
return _rep->isArray(); |
|
} |
|
| |
/** getValue - Gets the value component of the qualifier object | /** getValue - Gets the value component of the qualifier object |
@return CIMValue containing the value component | @return CIMValue containing the value component |
|
|
*/ | */ |
const CIMValue& getValue() const |
const CIMValue& getValue() const; |
{ |
|
_checkRep(); |
|
return _rep->getValue(); |
|
} |
|
| |
/** setValue - Puts a CIMValue object into a CIMQualifier object | /** setValue - Puts a CIMValue object into a CIMQualifier object |
@param value - The CIMValue object to install | @param value - The CIMValue object to install |
|
|
*/ | */ |
void setValue(const CIMValue& value) |
void setValue(const CIMValue& value); |
{ |
|
_checkRep(); |
|
_rep->setValue(value); |
|
} |
|
| |
/* setFlavor - Sets the bits defined on input into the Flavor variable |
/** setFlavor - Sets the bits defined on input into the Flavor variable |
for the Qualifier Object. | for the Qualifier Object. |
@param flavor - Uint32 defines the flavor bits to be set. | @param flavor - Uint32 defines the flavor bits to be set. |
*/ | */ |
void setFlavor(Uint32 flavor) |
void setFlavor(Uint32 flavor); |
{ |
|
_checkRep(); |
/** unsetFlavor - Resets the bits defined for the flavor |
_rep->setFlavor(flavor); |
|
} |
|
/* unsetFlavor - Resets the bits defined for the flavor |
|
for the Qualifier Object with the input. | for the Qualifier Object with the input. |
@param flavor - Uint32 defines the flavor bits to be set. | @param flavor - Uint32 defines the flavor bits to be set. |
*/ | */ |
void unsetFlavor(Uint32 flavor) |
void unsetFlavor(Uint32 flavor); |
{ |
|
_checkRep(); |
|
_rep->unsetFlavor(flavor); |
|
} |
|
| |
/** getFlavor - Gets the Flavor field from a Qualifier | /** getFlavor - Gets the Flavor field from a Qualifier |
@return - Uint32 with the Flavor flags that can be tested | @return - Uint32 with the Flavor flags that can be tested |
against the CIMFlavor constants. | against the CIMFlavor constants. |
*/ | */ |
Uint32 getFlavor() const |
Uint32 getFlavor() const; |
{ |
|
_checkRep(); |
|
return _rep->getFlavor(); |
|
} |
|
/** isFlavor - Boolean function that determines if particular flavor | /** isFlavor - Boolean function that determines if particular flavor |
flags are set in the flavor variable of a qualifier. | flags are set in the flavor variable of a qualifier. |
@param flavor - The flavor bits to test. | @param flavor - The flavor bits to test. |
|
|
if (q.isFlavor(CIMType::TOSUBCLASS) | if (q.isFlavor(CIMType::TOSUBCLASS) |
do something based on TOSUBCLASS being true | do something based on TOSUBCLASS being true |
</pre> | </pre> |
|
|
*/ | */ |
Boolean isFlavor(Uint32 flavor) const |
Boolean isFlavor(Uint32 flavor) const; |
{ |
|
return _rep->isFlavor(flavor); |
/** resolveFlavor - Function used only in object creation to |
} |
|
/* resolveFlavor - Function used only in object creation to |
|
resolve the combination of a qualifer flavor input and | resolve the combination of a qualifer flavor input and |
the corresponding inherited flavor from declaration or | the corresponding inherited flavor from declaration or |
superclass and set the current qualifier to that | superclass and set the current qualifier to that |
|
|
@param inherited - True if inherited from definition. False if this | @param inherited - True if inherited from definition. False if this |
is definition that inherits from the declaration | is definition that inherits from the declaration |
*/ | */ |
void resolveFlavor(Uint32 inheritedFlavor, Boolean inherited) |
void resolveFlavor(Uint32 inheritedFlavor, Boolean inherited); |
{ |
|
_checkRep(); |
|
_rep->resolveFlavor(inheritedFlavor, inherited); |
|
} |
|
/** getPropagated returns the propagated indicator | /** getPropagated returns the propagated indicator |
@return Uint32 - TBD | @return Uint32 - TBD |
|
|
*/ | */ |
const Uint32 getPropagated() const |
const Uint32 getPropagated() const; |
{ |
|
_checkRep(); |
|
return _rep->getPropagated(); |
|
} |
|
| |
/** setPropagated - Sets the Propagated flag for the object. | /** setPropagated - Sets the Propagated flag for the object. |
|
|
*/ | */ |
void setPropagated(Boolean propagated) |
void setPropagated(Boolean propagated); |
{ |
|
_checkRep(); |
|
_rep->setPropagated(propagated); |
|
} |
|
| |
|
#ifdef PEGASUS_INTERNALONLY |
/** CIMMethod | /** CIMMethod |
|
|
*/ | */ |
operator int() const { return _rep != 0; } |
operator int() const; |
|
#endif |
| |
/** toXml- Converts the CIMQualifier object to XML. | /** toXml- Converts the CIMQualifier object to XML. |
@param out The array where the XML output is to be stored. | @param out The array where the XML output is to be stored. |
|
|
*/ | */ |
void toXml(Array<Sint8>& out) const |
void toXml(Array<Sint8>& out) const; |
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
| |
/** print - Converts the CIMQualifier object to XML and | /** print - Converts the CIMQualifier object to XML and |
sends it to cout. | sends it to cout. |
@SeeAlso toXML | @SeeAlso toXML |
|
|
*/ | */ |
void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
void print(PEGASUS_STD(ostream)& o=PEGASUS_STD(cout)) const; |
{ |
|
_checkRep(); |
|
_rep->print(o); |
|
} |
|
| |
/** toMof- Converts the CIMQualifier object to MOF. | /** toMof- Converts the CIMQualifier object to MOF. |
@param out The Array where the MOF output is stored. | @param out The Array where the MOF output is stored. |
Note that the result does not have a zero terminator. | Note that the result does not have a zero terminator. |
*/ | */ |
void toMof(Array<Sint8>& out) const |
void toMof(Array<Sint8>& out) const; |
{ |
|
_checkRep(); |
|
_rep->toMof(out); |
|
} |
|
| |
/** printMOF - Converts the CIMQualifier object to XML and | /** printMOF - Converts the CIMQualifier object to XML and |
sends it the stream defined. | sends it the stream defined. |
@param o Output stream for the MOF. The default is cout. | @param o Output stream for the MOF. The default is cout. |
*/ | */ |
void printMof(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
void printMof(PEGASUS_STD(ostream)& o=PEGASUS_STD(cout)) const; |
{ |
|
_checkRep(); |
|
_rep->printMof(o); |
|
} |
|
|
|
| |
/** identical - compares two CIMQualifier objects. | /** identical - compares two CIMQualifier objects. |
@return - True if the objects are identical. | @return - True if the objects are identical. |
|
|
/** clone Creates an exact copy of the qualifier and returns the | /** clone Creates an exact copy of the qualifier and returns the |
new object. | new object. |
@return CIMQualifier New Qualifier object. | @return CIMQualifier New Qualifier object. |
|
|
*/ | */ |
CIMQualifier clone() const |
CIMQualifier clone() const; |
{ |
|
return CIMQualifier(_rep->clone()); |
|
} |
|
| |
private: | private: |
| |
CIMQualifier(CIMQualifierRep* rep) : _rep(rep) |
CIMQualifier(CIMQualifierRep* rep); |
{ |
|
} |
|
| |
void _checkRep() const |
void _checkRep() const; |
{ |
|
if (!_rep) |
|
ThrowUnitializedHandle(); |
|
} |
|
| |
CIMQualifierRep* _rep; | CIMQualifierRep* _rep; |
friend class CIMConstQualifier; | friend class CIMConstQualifier; |
|
|
{ | { |
public: | public: |
| |
CIMConstQualifier() : _rep(0) |
CIMConstQualifier(); |
{ |
|
| |
} |
CIMConstQualifier(const CIMConstQualifier& x); |
| |
CIMConstQualifier(const CIMConstQualifier& x) |
CIMConstQualifier(const CIMQualifier& x); |
{ |
|
Inc(_rep = x._rep); |
|
} |
|
|
|
CIMConstQualifier(const CIMQualifier& x) |
|
{ |
|
Inc(_rep = x._rep); |
|
} |
|
| |
// Throws IllegalName if name argument not legal CIM identifier. | // Throws IllegalName if name argument not legal CIM identifier. |
| |
CIMConstQualifier( | CIMConstQualifier( |
const String& name, | const String& name, |
const CIMValue& value, | const CIMValue& value, |
Uint32 flavor = CIMFlavor::DEFAULTS, |
Uint32 flavor = CIMFlavor::NONE, |
Boolean propagated = false) |
Boolean propagated = false); |
{ |
|
_rep = new CIMQualifierRep(name, value, flavor, propagated); |
|
} |
|
|
|
~CIMConstQualifier() |
|
{ |
|
Dec(_rep); |
|
} |
|
|
|
CIMConstQualifier& operator=(const CIMConstQualifier& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
| |
return *this; |
~CIMConstQualifier(); |
} |
|
| |
CIMConstQualifier& operator=(const CIMQualifier& x) |
CIMConstQualifier& operator=(const CIMConstQualifier& x); |
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
| |
return *this; |
CIMConstQualifier& operator=(const CIMQualifier& x); |
} |
|
| |
const String& getName() const |
const String& getName() const; |
{ |
|
_checkRep(); |
|
return _rep->getName(); |
|
} |
|
| |
CIMType getType() const |
CIMType getType() const; |
{ |
|
_checkRep(); |
|
return _rep->getType(); |
|
} |
|
| |
Boolean isArray() const |
Boolean isArray() const; |
{ |
|
_checkRep(); |
|
return _rep->isArray(); |
|
} |
|
| |
const CIMValue& getValue() const |
const CIMValue& getValue() const; |
{ |
|
_checkRep(); |
|
return _rep->getValue(); |
|
} |
|
| |
const Uint32 getFlavor() const |
const Uint32 getFlavor() const; |
{ |
|
_checkRep(); |
|
return _rep->getFlavor(); |
|
} |
|
| |
Boolean isFlavor(Uint32 flavor) const |
Boolean isFlavor(Uint32 flavor) const; |
{ |
|
return ((getFlavor() & flavor) !=0); |
|
} |
|
| |
Boolean isFlavorToSubclass() const |
Boolean isFlavorToSubclass() const; |
{ |
|
return ((getFlavor() & CIMFlavor::TOSUBCLASS) != 0); |
|
} |
|
| |
Boolean isFlavorToInstance() const |
Boolean isFlavorToInstance() const; |
{ |
|
return ((getFlavor() & CIMFlavor::TOINSTANCE) != 0); |
|
} |
|
| |
Boolean isFlavorOverridable() const |
Boolean isFlavorOverridable() const; |
{ |
|
return ((getFlavor() & CIMFlavor::OVERRIDABLE) != 0); |
|
} |
|
| |
const Uint32 getPropagated() const |
const Uint32 getPropagated() const; |
{ |
|
_checkRep(); |
|
return _rep->getPropagated(); |
|
} |
|
| |
operator int() const { return _rep != 0; } |
#ifdef PEGASUS_INTERNALONLY |
|
operator int() const; |
|
#endif |
| |
void toXml(Array<Sint8>& out) const |
void toXml(Array<Sint8>& out) const; |
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
| |
void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
void print(PEGASUS_STD(ostream)& o=PEGASUS_STD(cout)) const; |
{ |
|
_checkRep(); |
|
_rep->print(o); |
|
} |
|
| |
Boolean identical(const CIMConstQualifier& x) const |
Boolean identical(const CIMConstQualifier& x) const; |
{ |
|
x._checkRep(); |
|
_checkRep(); |
|
return _rep->identical(x._rep); |
|
} |
|
| |
CIMQualifier clone() const |
CIMQualifier clone() const; |
{ |
|
return CIMQualifier(_rep->clone()); |
|
} |
|
| |
private: | private: |
| |
void _checkRep() const |
void _checkRep() const; |
{ |
|
if (!_rep) |
|
ThrowUnitializedHandle(); |
|
} |
|
| |
CIMQualifierRep* _rep; | CIMQualifierRep* _rep; |
friend class CIMQualifier; | friend class CIMQualifier; |