version 1.9, 2002/01/07 21:14:28
|
version 1.49.8.1, 2011/10/11 18:18:08
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%LICENSE//////////////////////////////////////////////////////////////// |
// |
|
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
|
// |
|
// 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 |
// Licensed to The Open Group (TOG) under one or more contributor license |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// this work for additional information regarding copyright ownership. |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// Each contributor licenses this file to you under the OpenPegasus Open |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// Source License; you may not use this file except in compliance with the |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// License. |
// 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 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. |
// | // |
//============================================================================== |
////////////////////////////////////////////////////////////////////////// |
// |
|
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: |
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#define Pegasus_Object_h | #define Pegasus_Object_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/CIMObjectRep.h> |
#include <Pegasus/Common/Linkage.h> |
|
#include <Pegasus/Common/String.h> |
|
#include <Pegasus/Common/CIMName.h> |
|
#include <Pegasus/Common/Array.h> |
|
#include <Pegasus/Common/CIMProperty.h> |
|
#include <Pegasus/Common/CIMQualifier.h> |
|
#include <Pegasus/Common/CIMPropertyList.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
class CIMConstObject; |
|
class CIMObjectRep; |
class CIMClass; | class CIMClass; |
class CIMConstClass; | class CIMConstClass; |
class CIMInstance; | class CIMInstance; |
class CIMConstInstance; | class CIMConstInstance; |
|
class CIMProperty; |
|
class CIMConstProperty; |
|
class CIMQualifier; |
|
class CIMConstQualifier; |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
|
|
// | // |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
class CIMConstObject; |
/** |
class CIMObject; |
The CIMObject class represents the DMTF standard CIM object definition, |
|
which may represent a CIMClass or a CIMInstance. |
/** This class either refers to a CIMInstance or a CIMClass. |
|
| |
The CIMObjectRep data member points to either a CIMInstanceRep or |
<p>The CIMObject class uses a shared representation model, such that |
CIMClassRep. |
multiple CIMObject 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 CIMObject object affects all the CIMObject |
|
objects that refer to the same data copy. The data remains valid until |
|
all the CIMObject objects that refer to it are destructed. A separate |
|
copy of the data may be created using the clone method. |
*/ | */ |
class PEGASUS_COMMON_LINKAGE CIMObject | class PEGASUS_COMMON_LINKAGE CIMObject |
{ | { |
public: | public: |
| |
/** Constructor. |
/** |
|
Constructs an uninitialized CIMObject 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 |
|
operator with an initialized object. |
*/ | */ |
CIMObject() : _rep(0) |
CIMObject(); |
{ |
|
| |
} |
/** |
|
Constructs a CIMObject object from the value of a specified |
/** Copy constructor. |
CIMObject object, so that both objects refer to the same data copy. |
|
@param x The CIMObject object from which to construct a new |
|
CIMObject object. |
*/ | */ |
CIMObject(const CIMObject& x) |
CIMObject(const CIMObject& x); |
{ |
|
Inc(_rep = x._rep); |
|
} |
|
| |
/** Construction from CIMClass. |
/** |
|
Constructs a CIMObject object from the value of a specified |
|
CIMClass object, so that both objects refer to the same data copy. |
|
@param x The CIMClass object from which to construct the |
|
CIMObject object. |
*/ | */ |
CIMObject(const CIMClass& x); | CIMObject(const CIMClass& x); |
| |
/** Construction from CIMInstance. |
/** |
|
Constructs a CIMObject object from the value of a specified |
|
CIMInstance object, so that both objects refer to the same data copy. |
|
@param x The CIMInstance object from which to construct the |
|
CIMObject object. |
*/ | */ |
CIMObject(const CIMInstance& x); | CIMObject(const CIMInstance& x); |
| |
/** Assignment operator. |
/** |
|
Assigns the value of the specified CIMObject object to this object, |
|
so that both objects refer to the same data copy. |
|
@param x The CIMObject object from which to assign this CIMObject |
|
object. |
|
@return A reference to this CIMObject object. |
*/ | */ |
CIMObject& operator=(const CIMObject& x) |
CIMObject& operator=(const CIMObject& x); |
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
|
| |
/** Assignment operator. |
/** |
|
Destructs the CIMObject object. |
*/ | */ |
CIMObject& operator=(const CIMClass& x); |
~CIMObject(); |
| |
/** Assignment operator. |
/** |
|
Gets the class name of the object. |
|
@return A CIMName containing the class name. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMObject& operator=(const CIMInstance& x); |
const CIMName& getClassName() const; |
| |
/** Destructor. |
/** |
|
Gets the object path for the object. |
|
@return A CIMObjectPath containing the object path. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
~CIMObject() |
const CIMObjectPath& getPath() const; |
{ |
|
Dec(_rep); |
|
} |
|
| |
/** Accessor. |
/** |
|
Sets the object path for the object. |
|
@param path A CIMObjectPath containing the object path. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
const CIMReference & getPath(void) const |
void setPath (const CIMObjectPath & path); |
{ |
|
_checkRep(); |
|
return _rep->getPath(); |
|
} |
|
| |
/** Accessor. |
/** |
*/ |
Adds a qualifier to the object. |
const String& getClassName() const |
@param qualifier The CIMQualifier to be added. |
{ |
@return A reference to this CIMObject object. |
_checkRep(); |
@exception AlreadyExistsException If a qualifier with the |
return _rep->getClassName(); |
same name already exists in the CIMObject. |
} |
@exception UninitializedObjectException If the object is not |
|
initialized. |
/** addQualifier - Adds the CIMQualifier object to the instance. |
|
Thows an exception of the CIMQualifier already exists in the instance |
|
@param CIMQualifier object to add to instance |
|
@return ATTN: |
|
@exception Throws AlreadyExists. |
|
*/ |
|
CIMObject& addQualifier(const CIMQualifier& qualifier) |
|
{ |
|
_checkRep(); |
|
_rep->addQualifier(qualifier); |
|
return *this; |
|
} |
|
|
|
/** findQualifier - Searches the instance for the qualifier object |
|
defined by the input parameter. |
|
@param String defining the qualifier object to be found. |
|
@return - Position of the qualifier to be used in subsequent |
|
operations or PEG_NOT_FOUND if the qualifier is not found. |
|
*/ | */ |
Uint32 findQualifier(const String& name) |
CIMObject& addQualifier(const CIMQualifier& qualifier); |
{ |
|
_checkRep(); |
|
return _rep->findQualifier(name); |
|
} |
|
| |
Uint32 findQualifier(const String& name) const |
/** |
{ |
Finds a qualifier by name. |
_checkRep(); |
@param name A CIMName specifying the name of the qualifier to be found. |
return _rep->findQualifier(name); |
@return Index of the qualifier if found or PEG_NOT_FOUND if not found. |
} |
@exception UninitializedObjectException If the object is not |
|
initialized. |
/** existsQualifier - Searches the instance for the qualifier object |
|
defined by the input parameter. |
|
@param String defining the qualifier object to be found. |
|
@return - Returns True if the qualifier object exists or false |
|
if the qualifier is not found. |
|
*/ | */ |
Boolean existsQualifier(const String& name) |
Uint32 findQualifier(const CIMName& name) const; |
{ |
|
_checkRep(); |
|
return _rep->existsQualifier(name); |
|
} |
|
| |
Boolean existsQualifier(const String& name) const |
/** |
{ |
Gets the qualifier at the specified index. |
_checkRep(); |
@param index The index of the qualifier to be retrieved. |
return _rep->existsQualifier(name); |
@return The CIMQualifier at the specified index. |
} |
@exception IndexOutOfBoundsException If the index is outside |
|
the range of qualifiers available for the CIMObject. |
/** getQualifier - Retrieves the qualifier object defined by the |
@exception UninitializedObjectException If the object is not |
index input parameter. @ index for the qualifier object. |
initialized. |
The index to qualifier objects is zero-origin and continuous |
|
so that incrementing loops can be used to get all qualifier |
|
objects in a CIMInstnace. |
|
@return: Returns qualifier object defined by index. |
|
@exception Throws the OutOfBounds exception if the index |
|
is out of bounds |
|
*/ |
|
CIMQualifier getQualifier(Uint32 pos) |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifier(pos); |
|
} |
|
|
|
/** getQualifier - Retrieves the qualifier object defined by the |
|
index input parameter. @ index for the qualifier object. |
|
The index to qualifier objects is zero-origin and continuous |
|
so that incrementing loops can be used to get all qualifier |
|
objects in a CIMInstnace. |
|
@return: Returns qualifier object defined by index. |
|
@exception Throws the OutOfBounds exception if the index |
|
is out of bounds |
|
ATTN: What is effect of out of range index??? |
|
ATTN: Is the above statement correct??? |
|
*/ | */ |
CIMConstQualifier getQualifier(Uint32 pos) const |
CIMQualifier getQualifier(Uint32 index); |
{ |
|
_checkRep(); |
/** |
return _rep->getQualifier(pos); |
Gets the qualifier at the specified index. |
} |
@param index The index of the qualifier to be retrieved. |
|
@return The CIMConstQualifier at the specified index. |
/** getQualifierCount - Gets the numbercount of CIMQualifierobjects |
@exception IndexOutOfBoundsException If the index is outside |
defined for this CIMObject. |
the range of qualifiers available for the CIMObject. |
@return Count of the number of CIMQalifier objects in the |
@exception UninitializedObjectException If the object is not |
CIMObject. |
initialized. |
@exception Throws the OutOfBounds exception if the index |
|
is out of bounds |
|
*/ | */ |
Uint32 getQualifierCount() const |
CIMConstQualifier getQualifier(Uint32 index) const; |
{ |
|
_checkRep(); |
/** |
return _rep->getQualifierCount(); |
Removes a qualifier from the object. |
} |
@param index The index of the qualifier to remove. |
|
@exception IndexOutOfBoundsException If the index is |
/** addProperty - Adds a property object defined by the input |
outside the range of qualifiers available for the CIMObject. |
parameter to the CIMObject |
@exception UninitializedObjectException If the object is not |
@param Property Object to be added. See the CIM Property |
initialized. |
class for definition of the property object |
|
@return ATTN: |
|
@exception Throws the exception AlreadyExists if the property |
|
already exists. |
|
*/ | */ |
CIMObject& addProperty(const CIMProperty& x) |
void removeQualifier(Uint32 index); |
{ |
|
_checkRep(); |
/** |
_rep->addProperty(x); |
Gets the number of qualifiers in the object. |
return *this; |
@return An integer count of the qualifiers in the CIMObject. |
} |
@exception UninitializedObjectException If the object is not |
|
initialized. |
/** findProperty - Searches the CIMProperty objects installed in the |
|
CIMObject for property objects with the name defined by the |
|
input. |
|
@param String with the name of the property object to be found |
|
@return Position in the CIM object to the property object if found or |
|
PEG_NOT_FOUND if no property object found with the name defined by the |
|
input. |
|
*/ | */ |
Uint32 findProperty(const String& name) |
Uint32 getQualifierCount() const; |
{ |
|
_checkRep(); |
|
return _rep->findProperty(name); |
|
} |
|
| |
Uint32 findProperty(const String& name) const |
/** |
{ |
Adds a property to the object. |
_checkRep(); |
@param x The CIMProperty to be added. |
return _rep->findProperty(name); |
@return A reference to this CIMObject object. |
} |
@exception AlreadyExistsException If a property with the |
|
same name already exists in the CIMObject. |
/** existsPropery - Determines if a property object with the |
@exception UninitializedObjectException If the object is not |
name defined by the input parameter exists in the class. |
initialized. |
@parm String parameter with the property name. |
|
@return True if the property object exists. |
|
*/ | */ |
Boolean existsProperty(const String& name) |
CIMObject& addProperty(const CIMProperty& x); |
{ |
|
_checkRep(); |
|
return _rep->existsProperty(name); |
|
} |
|
| |
Boolean existsProperty(const String& name) const |
/** |
{ |
Finds a property by name. |
_checkRep(); |
@param name A CIMName specifying the name of the property to be found. |
return _rep->existsProperty(name); |
@return Index of the property if found or PEG_NOT_FOUND if not found. |
} |
@exception UninitializedObjectException If the object is not |
|
initialized. |
/** getProperty - Gets the CIMproperty object in the CIMObject defined |
*/ |
by the input index parameter. |
Uint32 findProperty(const CIMName& name) const; |
@param Index to the property object in the CIMObject. |
|
The index to qualifier objects is zero-origin and continuous |
|
so that incrementing loops can be used to get all qualifier |
|
objects in a CIMObject. |
|
@return CIMProperty object corresponding to the index. |
|
@exception Throws the OutOfBounds exception if the index |
|
is out of bounds |
|
| |
ATTN: What is the effect of out of range? |
/** |
|
Gets the property at the specified index. |
|
@param index The index of the property to be retrieved. |
|
@return The CIMProperty at the specified index. |
|
@exception IndexOutOfBoundsException If the index is outside |
|
the range of properties available for the CIMObject. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMProperty getProperty(Uint32 pos) |
CIMProperty getProperty(Uint32 index); |
{ |
|
_checkRep(); |
|
return _rep->getProperty(pos); |
|
} |
|
|
|
/** getProperty - Gets the CIMproperty object in the CIMObject defined |
|
by the input index parameter. |
|
@param Index to the property object in the CIMObject. |
|
The index to qualifier objects is zero-origin and continuous |
|
so that incrementing loops can be used to get all qualifier |
|
objects in a CIMInstnace. |
|
@return CIMProperty object corresponding to the index. |
|
@exception Throws the OutOfBounds exception if the index |
|
is out of bounds |
|
| |
ATTN: What is the effect of out of range? |
/** |
|
Gets the property at the specified index. |
|
@param index The index of the property to be retrieved. |
|
@return The CIMConstProperty at the specified index. |
|
@exception IndexOutOfBoundsException If the index is outside |
|
the range of properties available for the CIMObject. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMConstProperty getProperty(Uint32 pos) const |
CIMConstProperty getProperty(Uint32 index) const; |
{ |
|
_checkRep(); |
/** |
return _rep->getProperty(pos); |
Removes a property from the object. |
} |
@param index The index of the property to remove. |
|
@exception IndexOutOfBoundsException If the index is |
/** removeProperty - Removes the property represented |
outside the range of properties available for the CIMObject. |
by the position input parameter from the instance. |
@exception UninitializedObjectException If the object is not |
@param pos Index to the property to be removed from the |
initialized. |
instance. Normally this is obtained by getProperty(); |
|
@exception Throws OutofBounds if index is not a property object |
|
*/ | */ |
void removeProperty(Uint32 pos) |
void removeProperty(Uint32 index); |
{ |
|
_checkRep(); |
|
_rep->removeProperty(pos); |
|
} |
|
|
|
/** getPropertyCount - Gets the numbercount of CIMProperty |
|
objects defined for this CIMObject. |
|
@return Count of the number of CIMProperty objects in the |
|
CIMObject. Zero indicates that no CIMProperty objects |
|
are contained in the CIMObject |
|
@exception Throws the OutOfBounds exception if the index |
|
is out of bounds |
|
| |
|
/** |
|
Gets the number of properties in the object. |
|
@return An integer count of the properties in the CIMObject. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
Uint32 getPropertyCount() const |
Uint32 getPropertyCount() const; |
{ |
|
_checkRep(); |
|
return _rep->getPropertyCount(); |
|
} |
|
| |
/** operator int() - ATTN: */ |
/** |
operator int() const { return _rep != 0; } |
Makes a deep copy of the object. This creates a new copy of all |
|
the object attributes including qualifiers and properties. |
|
@return A new copy of the CIMObject object. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMObject clone() const; |
| |
/** Returns true if the two classes are structurally identical. |
/** |
|
Compares the CIMObject with a specified CIMConstObject. |
|
@param x The CIMConstObject to be compared. |
|
@return True if this object is identical to the one specified, |
|
false otherwise. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
Boolean identical(const CIMConstObject& x) const; | Boolean identical(const CIMConstObject& x) const; |
| |
/** Convert object to XML format. |
/** |
|
Determines whether the object has been initialized. |
|
@return True if the object has not been initialized, false otherwise. |
*/ | */ |
void toXml(Array<Sint8>& out) const |
Boolean isUninitialized() const; |
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
| |
/** Clones the given object. |
/** |
|
Generates a human-readable String representing the value of the |
|
CIMObject. The String may be in MOF format, but the format is not |
|
guaranteed and may change without notice. |
|
@return A human-readable String representing the CIMObject value. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMObject clone() const |
String toString() const; |
{ |
|
_checkRep(); |
|
return CIMObject(_rep->clone()); |
|
} |
|
| |
private: |
/** |
|
Indicates whether the object represents a CIMClass. |
|
@return True if the object represents a CIMClass; false otherwise. |
|
*/ |
|
Boolean isClass() const; |
| |
CIMObject(CIMObjectRep* rep) : _rep(rep) |
/** |
{ |
Indicates whether the object represents a CIMInstance. |
|
@return True if the object represents a CIMInstance; false otherwise. |
|
*/ |
|
Boolean isInstance() const; |
| |
} |
void instanceFilter( |
|
Boolean includeQualifiers, |
|
Boolean includeClassOrigin, |
|
const CIMPropertyList & propertyList); |
| |
void _checkRep() const |
private: |
{ |
|
if (!_rep) |
|
ThrowUnitializedHandle(); |
|
} |
|
| |
CIMObjectRep* _rep; | CIMObjectRep* _rep; |
| |
|
CIMObject(CIMObjectRep* rep); |
|
|
friend class CIMConstObject; | friend class CIMConstObject; |
friend class CIMClass; | friend class CIMClass; |
friend class CIMConstClass; | friend class CIMConstClass; |
|
|
friend class CIMConstInstance; | friend class CIMConstInstance; |
}; | }; |
| |
|
#define PEGASUS_ARRAY_T CIMObject |
|
# include <Pegasus/Common/ArrayInter.h> |
|
#undef PEGASUS_ARRAY_T |
|
|
|
|
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
// CIMConstObject | // CIMConstObject |
// | // |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
|
/** |
|
The CIMConstObject class provides a const interface to a CIMObject |
|
object. This class is needed because the shared representation model |
|
used by CIMObject does not prevent modification to a const CIMObject |
|
object. Note that the value of a CIMConstObject object could still be |
|
modified by a CIMObject object that refers to the same data copy. |
|
*/ |
class PEGASUS_COMMON_LINKAGE CIMConstObject | class PEGASUS_COMMON_LINKAGE CIMConstObject |
{ | { |
public: | public: |
| |
CIMConstObject() : _rep(0) |
/** |
{ |
Constructs an uninitialized CIMConstObject 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 |
|
operator with an initialized object. |
|
*/ |
|
CIMConstObject(); |
| |
CIMConstObject(const CIMConstObject& x) |
/** |
{ |
Constructs a CIMConstObject object from the value of a specified |
Inc(_rep = x._rep); |
CIMConstObject object, so that both objects refer to the same data |
} |
copy. |
|
@param x The CIMConstObject object from which to construct a new |
|
CIMConstObject object. |
|
*/ |
|
CIMConstObject(const CIMConstObject& x); |
| |
CIMConstObject(const CIMObject& x) |
/** |
{ |
Constructs a CIMConstObject object from the value of a specified |
Inc(_rep = x._rep); |
CIMObject object, so that both objects refer to the same data copy. |
} |
@param x The CIMObject object from which to construct a new |
|
CIMConstObject object. |
|
*/ |
|
CIMConstObject(const CIMObject& x); |
| |
/** Construction from CIMClass. |
/** |
|
Constructs a CIMConstObject object from the value of a specified |
|
CIMClass object, so that both objects refer to the same data copy. |
|
@param x The CIMClass object from which to construct the |
|
CIMConstObject object. |
*/ | */ |
CIMConstObject(const CIMClass& x); | CIMConstObject(const CIMClass& x); |
| |
/** Construction from CIMInstance. |
/** |
|
Constructs a CIMConstObject object from the value of a specified |
|
CIMInstance object, so that both objects refer to the same data copy. |
|
@param x The CIMInstance object from which to construct the |
|
CIMConstObject object. |
*/ | */ |
CIMConstObject(const CIMInstance& x); | CIMConstObject(const CIMInstance& x); |
| |
/** Construction from CIMClass. |
/** |
|
Constructs a CIMConstObject object from the value of a specified |
|
CIMConstClass object, so that both objects refer to the same data copy. |
|
@param x The CIMConstClass object from which to construct the |
|
CIMConstObject object. |
*/ | */ |
CIMConstObject(const CIMConstClass& x); | CIMConstObject(const CIMConstClass& x); |
| |
/** Construction from CIMInstance. |
/** |
|
Constructs a CIMConstObject object from the value of a specified |
|
CIMConstInstance object, so that both objects refer to the same data |
|
copy. |
|
@param x The CIMConstInstance object from which to construct the |
|
CIMConstObject object. |
*/ | */ |
CIMConstObject(const CIMConstInstance& x); | CIMConstObject(const CIMConstInstance& x); |
| |
CIMConstObject& operator=(const CIMConstObject& x) |
/** |
{ |
Assigns the value of the specified CIMConstObject object to this |
if (x._rep != _rep) |
object, so that both objects refer to the same data copy. |
{ |
@param x The CIMConstObject object from which to assign this |
Dec(_rep); |
CIMConstObject object. |
Inc(_rep = x._rep); |
@return A reference to this CIMConstObject object. |
} |
*/ |
return *this; |
CIMConstObject& operator=(const CIMConstObject& x); |
} |
|
|
|
CIMConstObject& operator=(const CIMObject& x) |
|
{ |
|
if (x._rep != _rep) |
|
{ |
|
Dec(_rep); |
|
Inc(_rep = x._rep); |
|
} |
|
return *this; |
|
} |
|
|
|
CIMConstObject& operator=(const CIMClass& x); |
|
|
|
CIMConstObject& operator=(const CIMConstClass& x); |
|
|
|
CIMConstObject& operator=(const CIMInstance& x); |
|
|
|
CIMConstObject& operator=(const CIMConstInstance& x); |
|
|
|
~CIMConstObject() |
|
{ |
|
Dec(_rep); |
|
} |
|
|
|
const CIMReference & getPath(void) const |
|
{ |
|
_checkRep(); |
|
return _rep->getPath(); |
|
} |
|
|
|
const String& getClassName() const |
|
{ |
|
_checkRep(); |
|
return _rep->getClassName(); |
|
} |
|
|
|
Uint32 findQualifier(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->findQualifier(name); |
|
} |
|
|
|
CIMConstQualifier getQualifier(Uint32 pos) const |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifier(pos); |
|
} |
|
|
|
Uint32 getQualifierCount() const |
|
{ |
|
_checkRep(); |
|
return _rep->getQualifierCount(); |
|
} |
|
|
|
Uint32 findProperty(const String& name) const |
|
{ |
|
_checkRep(); |
|
return _rep->findProperty(name); |
|
} |
|
|
|
CIMConstProperty getProperty(Uint32 pos) const |
|
{ |
|
_checkRep(); |
|
return _rep->getProperty(pos); |
|
} |
|
|
|
Uint32 getPropertyCount() const |
|
{ |
|
_checkRep(); |
|
return _rep->getPropertyCount(); |
|
} |
|
|
|
operator int() const { return _rep != 0; } |
|
|
|
void toXml(Array<Sint8>& out) const |
|
{ |
|
_checkRep(); |
|
_rep->toXml(out); |
|
} |
|
|
|
void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const |
|
{ |
|
_checkRep(); |
|
_rep->print(o); |
|
} |
|
|
|
Boolean identical(const CIMConstObject& x) const |
|
{ |
|
x._checkRep(); |
|
_checkRep(); |
|
return _rep->identical(x._rep); |
|
} |
|
|
|
CIMObject clone() const |
|
{ |
|
return CIMObject(_rep->clone()); |
|
} |
|
|
|
private: |
|
| |
void _checkRep() const |
/** |
{ |
Destructs the CIMConstObject object. |
if (!_rep) |
*/ |
ThrowUnitializedHandle(); |
~CIMConstObject(); |
} |
|
| |
CIMObjectRep* _rep; |
/** |
|
Gets the class name of the object. |
|
@return A CIMName containing the class name. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
const CIMName& getClassName() const; |
| |
friend class CIMObject; |
/** |
friend class CIMClass; |
Gets the object path for the object. |
friend class CIMConstClass; |
@return A CIMObjectPath containing the object path. |
friend class CIMInstance; |
@exception UninitializedObjectException If the object is not |
friend class CIMConstInstance; |
initialized. |
}; |
*/ |
|
const CIMObjectPath& getPath() const; |
| |
/** The CIMObjectWithPath encapsulates a CIMReference and CIMObject. |
/** |
Accessors are provided for getting the two parts. Constructors are |
Finds a qualifier by name. |
provided for initializing it from a CIMObject. |
@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. |
*/ | */ |
class PEGASUS_COMMON_LINKAGE CIMObjectWithPath |
Uint32 findQualifier(const CIMName& name) const; |
{ |
|
public: |
|
| |
/** Constructor |
/** |
|
Gets the qualifier at the specified index. |
|
@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 CIMConstObject. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMObjectWithPath(); |
CIMConstQualifier getQualifier(Uint32 index) const; |
| |
/** constructor |
/** |
|
Gets the number of qualifiers in the object. |
|
@return An integer count of the qualifiers in the CIMConstObject. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMObjectWithPath(const CIMReference& reference, const CIMObject& object); |
Uint32 getQualifierCount() const; |
| |
/** Constructor - Constructs a CIMObjectWithPath Object from |
/** |
another CimObjectWithPath |
Finds a property by name. |
@param - ATTN |
@param name A CIMName specifying the name of the property to be found. |
|
@return Index of the property if found or PEG_NOT_FOUND if not found. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMObjectWithPath(const CIMObjectWithPath& x); |
Uint32 findProperty(const CIMName& name) const; |
| |
~CIMObjectWithPath(); |
/** |
|
Gets the property at the specified index. |
|
@param index The index of the property to be retrieved. |
|
@return The CIMConstProperty at the specified index. |
|
@exception IndexOutOfBoundsException If the index is outside |
|
the range of properties available for the CIMConstObject. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
CIMConstProperty getProperty(Uint32 index) const; |
| |
CIMObjectWithPath& operator=(const CIMObjectWithPath& x); |
/** |
|
Gets the number of properties in the object. |
|
@return An integer count of the properties in the CIMConstObject. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
|
*/ |
|
Uint32 getPropertyCount() const; |
| |
/** set - |
/** |
|
Makes a deep copy of the object. This creates a new copy of all |
|
the object attributes including qualifiers and properties. |
|
@return A CIMObject object with a separate copy of the |
|
CIMConstObject object. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
void set(const CIMReference& reference, const CIMObject& object); |
CIMObject clone() const; |
| |
/** | /** |
|
Compares the CIMConstObject with a specified CIMConstObject. |
|
@param x The CIMConstObject to be compared. |
|
@return True if this object is identical to the one specified, |
|
false otherwise. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
const CIMReference& getReference() const { return _reference; } |
Boolean identical(const CIMConstObject& x) const; |
| |
/** | /** |
|
Determines whether the object has been initialized. |
|
@return True if the object has not been initialized, false otherwise. |
*/ | */ |
const CIMObject& getObject() const { return _object; } |
Boolean isUninitialized() const; |
| |
/** | /** |
|
Generates a human-readable String representing the value of the |
|
CIMObject. The String may be in MOF format, but the format is not |
|
guaranteed and may change without notice. |
|
@return A human-readable String representing the CIMObject value. |
|
@exception UninitializedObjectException If the object is not |
|
initialized. |
*/ | */ |
CIMReference& getReference() { return _reference; } |
String toString () const; |
| |
/** | /** |
|
Indicates whether the object represents a CIMConstClass. |
|
@return True if the object represents a CIMConstClass; false otherwise. |
*/ | */ |
CIMObject& getObject() { return _object; } |
Boolean isClass() const; |
| |
/** | /** |
|
Indicates whether the object represents a CIMConstInstance. |
|
@return True if the object represents a CIMConstInstance; false |
|
otherwise. |
*/ | */ |
void toXml(Array<Sint8>& out) const; |
Boolean isInstance() const; |
| |
private: | private: |
| |
CIMReference _reference; |
CIMObjectRep* _rep; |
CIMObject _object; |
|
|
friend class CIMObject; |
|
friend class CIMClass; |
|
friend class CIMConstClass; |
|
friend class CIMInstance; |
|
friend class CIMConstInstance; |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |