version 1.24, 2002/05/24 01:24:37
|
version 1.32, 2002/09/20 04:06:42
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
// 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) | // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <Pegasus/Common/CIMDateTime.h> | #include <Pegasus/Common/CIMDateTime.h> |
#include <Pegasus/Common/Exception.h> | #include <Pegasus/Common/Exception.h> |
#include <Pegasus/Common/Array.h> | #include <Pegasus/Common/Array.h> |
|
#include <Pegasus/Common/Linkage.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
*/ | */ |
CIMValue(); | CIMValue(); |
| |
/** Constructor with only the Type. This constructor creates a NULL CIMValue |
/** Constructor that creates a NULL CIMValue object with the type and |
object with the array indicator set as shown and with the |
array indicator set as specified. |
|
@exception TypeMismatchException If the given type is not valid for a |
|
CIMValue object. |
*/ | */ |
CIMValue(CIMType type, Boolean isArray, Uint32 arraySize = 0); | CIMValue(CIMType type, Boolean isArray, Uint32 arraySize = 0); |
| |
/** Constructor with the Value constructor and a value. This constructs a |
// ATTN This needs an example |
CIMValue object with the type defined by the value constructor and the value |
/** Constructor with the Value constructor and a value. |
|
This constructs a |
|
CIMValue object with the type defined by the value constructor |
|
and the value |
installed | installed |
<pre> |
|
ATTN: Add example |
|
</pre> |
|
*/ | */ |
CIMValue(Boolean x); | CIMValue(Boolean x); |
| |
|
|
CIMValue(const String& x); | CIMValue(const String& x); |
| |
/// Constructor | /// Constructor |
CIMValue(const char* x); |
|
|
|
/// Constructor |
|
CIMValue(const CIMDateTime& x); | CIMValue(const CIMDateTime& x); |
| |
/// Constructor | /// Constructor |
|
|
void assign(const CIMValue& x); | void assign(const CIMValue& x); |
| |
/** clear - Clears the attributes and value of the CIMValue object. | /** clear - Clears the attributes and value of the CIMValue object. |
<pre> |
|
ATTNDOC: |
|
</pre> |
|
*/ | */ |
void clear(); | void clear(); |
| |
/** typeCompatible - Compares the types of two CIMvalues. This |
/** typeCompatible - Compares the types of two CIMValues. This |
compares the type field and the array indicators. | compares the type field and the array indicators. |
@return true if both are of the same type and both are either arrays | @return true if both are of the same type and both are either arrays |
or not. Else returns false. | or not. Else returns false. |
|
|
Uint32 getArraySize() const; | Uint32 getArraySize() const; |
| |
/** getType - Gets the CIMType attribute for the CIMValue. | /** getType - Gets the CIMType attribute for the CIMValue. |
The CIMType is defined in ATTN: |
@return the CIMType value |
@return Returns the CIMType value |
|
*/ | */ |
CIMType getType() const; | CIMType getType() const; |
| |
|
|
*/ | */ |
void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0); | void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0); |
| |
|
// All of the CIMTypes defined in ATTN: and the Array types defined in |
|
// ATTN: may be set. |
/** set - Sets the type, Array attribute and puts the value provided | /** set - Sets the type, Array attribute and puts the value provided |
into the value of the target CIMValue. This function sets the | into the value of the target CIMValue. This function sets the |
CIMValue to nonNull also. The result is a complete CIMValue object | CIMValue to nonNull also. The result is a complete CIMValue object |
All of the CIMTypes defined in ATTN: and the Array types defined in |
|
ATTN: may be set. |
|
@param x Typed value (ex. Boolean(true). | @param x Typed value (ex. Boolean(true). |
@return void | @return void |
<pre> | <pre> |
|
|
/// | /// |
void set(const String& x); | void set(const String& x); |
/// | /// |
void set(const char* x); |
|
/// |
|
void set(const CIMDateTime& x); | void set(const CIMDateTime& x); |
/// | /// |
void set(const CIMObjectPath& x); | void set(const CIMObjectPath& x); |
|
|
void set(const Array<CIMObjectPath>& x); | void set(const Array<CIMObjectPath>& x); |
| |
/** get - Gets the value of a CIMValue | /** get - Gets the value of a CIMValue |
@param Variable in which we return the value: |
|
@return void |
Note: Before using get, the caller should use getType () and isNull () |
|
to ensure that the value is not null, and is of the correct type. |
|
If the CIMValue is null, the output parameter is not updated. |
|
|
|
@param Variable in which we return the value |
|
|
|
@exception TypeMismatchException If the CIMValue type is not compatible |
|
with the type of the output parameter |
<pre> | <pre> |
Uint32 v; | Uint32 v; |
CIMValue value(CIMValue::UINT32, UINT32(99)); | CIMValue value(CIMValue::UINT32, UINT32(99)); |
value.get(v); | value.get(v); |
</pre> | </pre> |
|
|
|
<pre> |
|
Uint32 v; |
|
CIMValue value = property.getValue (); |
|
if ((value.getType () == CIMTYPE_UINT32) && (!value.isNull ())) |
|
value.get (v); |
|
</pre> |
*/ | */ |
void get(Boolean& x) const; | void get(Boolean& x) const; |
/// | /// |
|
|
/// | /// |
void get(Array<CIMObjectPath>& x) const; | void get(Array<CIMObjectPath>& x) const; |
| |
/** Makes a deep copy (clone) of the given object. */ |
/** Compare with another CIMValue object for equality. |
CIMValue clone() const; |
@param x - CIMValue to compare with |
|
@return True if they are identical in type, attribute and value. |
|
*/ |
|
Boolean equal(const CIMValue& x) const; |
| |
/** toString - Converts the CIMvalue to a string. Should only be | /** toString - Converts the CIMvalue to a string. Should only be |
used for output purposes. To get an actual String value, use | used for output purposes. To get an actual String value, use |
get(String &). | get(String &). |
@return - String output for CIMValue. | @return - String output for CIMValue. |
@exception - Throws exception CIMValueInvalidType if the CIMValue |
|
has an invalid type. Normally this is a Pegasus internal error. |
|
<PRE> | <PRE> |
Example: | Example: |
String test; | String test; |
|
|
| |
private: | private: |
| |
|
// ATTN-RK-P2-20020719: For debugging only; remove before API release. |
|
// Use CIMValue(const String&) instead. |
|
PEGASUS_EXPLICIT CIMValue(const char* x) {} |
|
|
CIMValueRep* _rep; | CIMValueRep* _rep; |
| |
friend class CIMMethodRep; | friend class CIMMethodRep; |
|
|
friend class CIMPropertyRep; | friend class CIMPropertyRep; |
friend class CIMQualifierRep; | friend class CIMQualifierRep; |
friend class CIMQualifierDeclRep; | friend class CIMQualifierDeclRep; |
PEGASUS_COMMON_LINKAGE friend Boolean operator==( |
|
const CIMValue& x, |
|
const CIMValue& y); |
|
}; | }; |
| |
/** operator == compares two CIMValue objects for equality. | /** operator == compares two CIMValue objects for equality. |
@param x - First CIMvalue to compare |
@param x - First CIMValue to compare |
@parm y - Second CIMValue to compare |
@param y - Second CIMValue to compare |
@return True if they are identical in type, attribute and value. | @return True if they are identical in type, attribute and value. |
*/ | */ |
PEGASUS_COMMON_LINKAGE Boolean operator==(const CIMValue& x, const CIMValue& y); | PEGASUS_COMMON_LINKAGE Boolean operator==(const CIMValue& x, const CIMValue& y); |
| |
/** operator != compares two CIMValue objects for nonequality |
/** operator != compares two CIMValue objects for inequality |
*/ | */ |
PEGASUS_COMMON_LINKAGE Boolean operator!=(const CIMValue& x, const CIMValue& y); | PEGASUS_COMMON_LINKAGE Boolean operator!=(const CIMValue& x, const CIMValue& y); |
| |