version 1.22, 2001/06/17 04:20:32
|
version 1.34, 2002/04/30 18:03:11
|
|
|
#define Pegasus_CIMClass_h | #define Pegasus_CIMClass_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
#include <Pegasus/Common/CIMObject.h> |
#include <Pegasus/Common/CIMClassRep.h> | #include <Pegasus/Common/CIMClassRep.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
class CIMConstClass; | class CIMConstClass; |
|
class CIMObject; |
|
class CIMConstObject; |
|
|
|
// REVIEW: redocument. |
| |
/** The CIMClass class is used to represent CIM classes in Pegasus. In CIM, | /** The CIMClass class is used to represent CIM classes in Pegasus. In CIM, |
a class object may be a class or an associator. A CIM class must contain a | a class object may be a class or an associator. A CIM class must contain a |
|
|
instances, all of which support a common type (for example, a set of | instances, all of which support a common type (for example, a set of |
properties, methods, and associations). | properties, methods, and associations). |
*/ | */ |
|
|
class PEGASUS_COMMON_LINKAGE CIMClass | class PEGASUS_COMMON_LINKAGE CIMClass |
{ | { |
public: | public: |
|
|
*/ | */ |
CIMClass() : _rep(0) | CIMClass() : _rep(0) |
{ | { |
|
|
} | } |
| |
/** Constructor - Creates a class from a previous class | /** Constructor - Creates a class from a previous class |
|
|
Inc(_rep = x._rep); | Inc(_rep = x._rep); |
} | } |
| |
/// Operator = Assigns the CIM Class constructor. |
PEGASUS_EXPLICIT CIMClass(const CIMObject& x); |
|
|
|
PEGASUS_EXPLICIT CIMClass(const CIMObject& x, NoThrow&); |
|
|
|
/** Assignment operator. |
|
*/ |
CIMClass& operator=(const CIMClass& x) | CIMClass& operator=(const CIMClass& x) |
{ | { |
if (x._rep != _rep) | if (x._rep != _rep) |
{ | { |
|
if (_rep) |
|
{ |
Dec(_rep); | Dec(_rep); |
|
} |
Inc(_rep = x._rep); | Inc(_rep = x._rep); |
} | } |
return *this; | return *this; |
|
|
| |
/** Constructor - Creates a Class from inputs of a classname and | /** Constructor - Creates a Class from inputs of a classname and |
SuperClassName | SuperClassName |
@param className String representing name of the class being created |
@param className CIMReference representing name of the class being created |
@param superClassName String representing name of the SuperClass | @param superClassName String representing name of the SuperClass |
ATTN: Define what makes up legal name. | ATTN: Define what makes up legal name. |
@return Throws IllegalName if className argument illegal CIM identifier. | @return Throws IllegalName if className argument illegal CIM identifier. |
|
|
| |
*/ | */ |
CIMClass( | CIMClass( |
const String& className, |
const CIMReference& reference, |
const String& superClassName = String()) | const String& superClassName = String()) |
{ | { |
_rep = new CIMClassRep(className, superClassName); |
_rep = new CIMClassRep(reference, superClassName); |
} | } |
| |
/// Destructor | /// Destructor |
~CIMClass() | ~CIMClass() |
{ | { |
|
if (_rep) |
|
{ |
Dec(_rep); | Dec(_rep); |
} | } |
|
} |
| |
/** isAssociation - Identifies whether or not this CIM class | /** isAssociation - Identifies whether or not this CIM class |
is an association. An association is a relationship between two | is an association. An association is a relationship between two |
|
|
return _rep->isAssociation(); | return _rep->isAssociation(); |
} | } |
| |
/// CIMMethod isAbstract |
/** isAbstract Test if the CIMClass is abstract. |
|
@return - True if the CIMClass Object is abstract |
|
SeeAlso: Abstract |
|
*/ |
Boolean isAbstract() const | Boolean isAbstract() const |
{ | { |
_checkRep(); | _checkRep(); |
|
|
return _rep->getClassName(); | return _rep->getClassName(); |
} | } |
| |
/** CIMMethod getSuperClassName - Gets the name of the Parent |
/** equalClassName compares Name of the class with a String. This test performs |
|
a comparison of the classname component of the object |
|
with a String. Note that this function was included specifically |
|
because the equality compare is not just a straight comparison |
|
because classnames are case independent. |
|
@param classname String containing the name for comparison |
|
@return True if it is the same class name (equalNoCase compare passes) |
|
or false if not. |
|
*/ |
|
const Boolean equalClassName(const String& classname) const |
|
{ |
|
_checkRep(); |
|
return _rep->equalClassName(classname); |
|
|
|
} |
|
|
|
const CIMReference& getPath() const |
|
{ |
|
_checkRep(); |
|
return _rep->getPath(); |
|
} |
|
|
|
/** getSuperClassName - Gets the name of the Parent |
@return String with parent class name. | @return String with parent class name. |
*/ | */ |
const String& getSuperClassName() const | const String& getSuperClassName() const |
|
|
return _rep->getSuperClassName(); | return _rep->getSuperClassName(); |
} | } |
| |
/** CIMMethod setSuperClassName - Sets the name of the parent class from |
/** setSuperClassName - Sets the name of the parent class from |
the input parameter. \REF{CLASSNAME}. ATTN: Define legal classnames | the input parameter. \REF{CLASSNAME}. ATTN: Define legal classnames |
@param String defining parent name. | @param String defining parent name. |
@return Throws IllegalName if superClassName argument not legal CIM | @return Throws IllegalName if superClassName argument not legal CIM |
|
|
return _rep->existsQualifier(name); | return _rep->existsQualifier(name); |
} | } |
| |
|
/** isTrueQualifier - Determines if the qualifier defined by |
|
the input parameter exists for the class, is Boolean, and |
|
has a value of true. |
|
This function is useful to quickly determine the state of a |
|
qualifier. |
|
@param String containing the qualifier name. |
|
@return Boolean True if the qualifier exists, |
|
*/ |
|
Boolean isTrueQualifier(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->isTrueQualifier(name); |
|
} |
|
|
/** getQualifier - Gets the CIMQualifier object defined | /** getQualifier - Gets the CIMQualifier object defined |
by the input parameter | by the input parameter |
@param pos defines the position of the qualifier in the class from the | @param pos defines the position of the qualifier in the class from the |
findQualifier method | findQualifier method |
@return CIMQualifier object representing the qualifier found. |
@return CIMQualifier object representing the qualifier found. On error, |
ATTN: what is error return here? |
CIMQualifier handle will be null. |
*/ | */ |
CIMQualifier getQualifier(Uint32 pos) | CIMQualifier getQualifier(Uint32 pos) |
{ | { |
|
|
return _rep->getQualifier(pos); | return _rep->getQualifier(pos); |
} | } |
| |
/// getQualifier - ATTN: |
/** getQualifier - Gets the qualifier defined by the input parameter |
|
from the qualifier list for this CIMClass. |
|
*/ |
CIMConstQualifier getQualifier(Uint32 pos) const | CIMConstQualifier getQualifier(Uint32 pos) const |
{ | { |
_checkRep(); | _checkRep(); |
|
|
return *this; | return *this; |
} | } |
| |
|
/** findProperty - Finds the property object with the |
|
|
/** CIMMethod findProperty - Finds the property object with the |
|
name defined by the input parameter in the class. | name defined by the input parameter in the class. |
@param String parameter with the property name. | @param String parameter with the property name. |
@return position representing the property object found or | @return position representing the property object found or |
|
|
_checkRep(); | _checkRep(); |
return _rep->existsProperty(name); | return _rep->existsProperty(name); |
} | } |
|
|
Boolean existsProperty(const String& name) const | Boolean existsProperty(const String& name) const |
{ | { |
_checkRep(); | _checkRep(); |
|
|
return _rep->existsMethod(name); | return _rep->existsMethod(name); |
} | } |
| |
|
|
/** getMethod - Gets the method object defined by the | /** getMethod - Gets the method object defined by the |
input parameter. | input parameter. |
@param pos Index to the CIMMethod object to get |
@param pos Index to the method object to get |
@return Returns handle of the CIMMethod requested |
@return Returns handle of the method requested |
@exception Throws OutofBounds if the index represented by pos is greater | @exception Throws OutofBounds if the index represented by pos is greater |
than the number of methods defined in the class object | than the number of methods defined in the class object |
*/ | */ |
|
|
_rep->removeMethod(pos); | _rep->removeMethod(pos); |
} | } |
| |
/** CIMMethod getMethodCount - Count of the number of methods in the class |
/** getMethodCount - Count of the number of methods in the class |
@return integer representing the number of methods in the class object. | @return integer representing the number of methods in the class object. |
*/ | */ |
Uint32 getMethodCount() const | Uint32 getMethodCount() const |
|
|
/// operator - ATTN: | /// operator - ATTN: |
operator int() const { return _rep != 0; } | operator int() const { return _rep != 0; } |
| |
/// CIMMethod toXML |
/** toXML - prepares an XML representation of the CIMClass object |
|
in the provided Sint8 variable. |
|
@param out Sint8 array for the XML representation |
|
*/ |
void toXml(Array<Sint8>& out) const | void toXml(Array<Sint8>& out) const |
{ | { |
_checkRep(); | _checkRep(); |
_rep->toXml(out); | _rep->toXml(out); |
} | } |
| |
/// CIMMethod print |
/** print - Prints the toXML output to cout |
|
*/ |
void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const | void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
{ | { |
_checkRep(); | _checkRep(); |
_rep->print(o); | _rep->print(o); |
} | } |
| |
/** CIMMethod identical - Compares with another class |
/** toMof - prepares a MOF representation of the CIMClass object |
|
in the provided Sint8 variable. |
|
@param out Sint8 array for the XML representation |
|
*/ |
|
void toMof(Array<Sint8>& out) const |
|
{ |
|
_checkRep(); |
|
_rep->toMof(out); |
|
} |
|
/** printMof - Prints the toMof output to cout |
|
*/ |
|
void printMof(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
|
{ |
|
_checkRep(); |
|
_rep->printMof(o); |
|
} |
|
|
|
/** identical - Compares with another class |
ATTN: Clarify exactly what identical means | ATTN: Clarify exactly what identical means |
@param Class object for the class to be compared | @param Class object for the class to be compared |
@return True if the classes are identical | @return True if the classes are identical |
|
|
/** Makes a deep copy (clone) of the given object. */ | /** Makes a deep copy (clone) of the given object. */ |
CIMClass clone() const | CIMClass clone() const |
{ | { |
return CIMClass(_rep->clone()); |
return CIMClass((CIMClassRep*)(_rep->clone())); |
} | } |
| |
/** Get names of all keys of this class. */ | /** Get names of all keys of this class. */ |
|
|
| |
CIMClassRep* _rep; | CIMClassRep* _rep; |
friend class CIMConstClass; | friend class CIMConstClass; |
|
friend class CIMObject; |
|
friend class CIMConstObject; |
}; | }; |
| |
#define PEGASUS_ARRAY_T CIMClass | #define PEGASUS_ARRAY_T CIMClass |
|
|
| |
CIMConstClass() : _rep(0) | CIMConstClass() : _rep(0) |
{ | { |
|
|
} | } |
| |
CIMConstClass(const CIMConstClass& x) | CIMConstClass(const CIMConstClass& x) |
|
|
Inc(_rep = x._rep); | Inc(_rep = x._rep); |
} | } |
| |
|
PEGASUS_EXPLICIT CIMConstClass(const CIMObject& x); |
|
|
|
PEGASUS_EXPLICIT CIMConstClass(const CIMConstObject& x); |
|
|
|
PEGASUS_EXPLICIT CIMConstClass(const CIMObject& x, NoThrow&); |
|
|
|
PEGASUS_EXPLICIT CIMConstClass(const CIMConstObject& x, NoThrow&); |
|
|
CIMConstClass& operator=(const CIMConstClass& x) | CIMConstClass& operator=(const CIMConstClass& x) |
{ | { |
if (x._rep != _rep) | if (x._rep != _rep) |
{ | { |
|
if (_rep) |
|
{ |
Dec(_rep); | Dec(_rep); |
|
} |
Inc(_rep = x._rep); | Inc(_rep = x._rep); |
} | } |
return *this; | return *this; |
|
|
{ | { |
if (x._rep != _rep) | if (x._rep != _rep) |
{ | { |
|
if (_rep) |
|
{ |
Dec(_rep); | Dec(_rep); |
|
} |
Inc(_rep = x._rep); | Inc(_rep = x._rep); |
} | } |
return *this; | return *this; |
|
|
// Throws IllegalName if className argument not legal CIM identifier. | // Throws IllegalName if className argument not legal CIM identifier. |
| |
CIMConstClass( | CIMConstClass( |
const String& className, |
const CIMReference& reference, |
const String& superClassName = String()) | const String& superClassName = String()) |
{ | { |
_rep = new CIMClassRep(className, superClassName); |
_rep = new CIMClassRep(reference, superClassName); |
} | } |
| |
~CIMConstClass() | ~CIMConstClass() |
{ | { |
|
if (_rep) |
|
{ |
Dec(_rep); | Dec(_rep); |
} | } |
|
} |
| |
Boolean isAssociation() const | Boolean isAssociation() const |
{ | { |
|
|
return _rep->getClassName(); | return _rep->getClassName(); |
} | } |
| |
|
const Boolean equalClassName(const String& classname) const |
|
{ |
|
_checkRep(); |
|
return _rep->equalClassName(classname); |
|
|
|
} |
|
|
|
const CIMReference& getPath() const |
|
{ |
|
_checkRep(); |
|
return _rep->getPath(); |
|
} |
|
|
const String& getSuperClassName() const | const String& getSuperClassName() const |
{ | { |
_checkRep(); | _checkRep(); |
|
|
return _rep->getQualifier(pos); | return _rep->getQualifier(pos); |
} | } |
| |
|
Boolean isTrueQualifier(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->isTrueQualifier(name); |
|
} |
|
|
Uint32 getQualifierCount() const | Uint32 getQualifierCount() const |
{ | { |
_checkRep(); | _checkRep(); |
|
|
| |
CIMClass clone() const | CIMClass clone() const |
{ | { |
return CIMClass(_rep->clone()); |
return CIMClass((CIMClassRep*)(_rep->clone())); |
} | } |
| |
void getKeyNames(Array<String>& keyNames) const | void getKeyNames(Array<String>& keyNames) const |
|
|
friend class CIMClassRep; | friend class CIMClassRep; |
friend class CIMClass; | friend class CIMClass; |
friend class CIMInstanceRep; | friend class CIMInstanceRep; |
|
friend class CIMObject; |
|
friend class CIMConstObject; |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |