📄 cimvalue.h
字号:
//%2006//////////////////////////////////////////////////////////////////////////// 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.////==============================================================================////%/////////////////////////////////////////////////////////////////////////////#ifndef Pegasus_Value_h#define Pegasus_Value_h#include <Pegasus/Common/String.h>#include <Pegasus/Common/Config.h>#include <Pegasus/Common/CIMType.h>#include <Pegasus/Common/CIMObjectPath.h>#include <Pegasus/Common/CIMObject.h>#include <Pegasus/Common/CIMDateTime.h>#include <Pegasus/Common/Exception.h>#include <Pegasus/Common/Array.h>#include <Pegasus/Common/Linkage.h>PEGASUS_NAMESPACE_BEGINclass CIMValueRep;class CIMObject;/** The CIMValue class represents a value of any of the CIM data types (see \Ref{CIMType} for a list of valid CIM data types). This class encapsulates a union which holds the current value. The class also has a type field indicating the type of that value.*/class PEGASUS_COMMON_LINKAGE CIMValue{public: /** Constructor - Creates an NULL CIMValue object set to null and with type CIMType:none and !arraytype. */ CIMValue(); /** Constructor - Creates a NULL CIMValue object with the type and 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); /// Constructor. CIMValue(Boolean x); /// Constructor. CIMValue(Uint8 x); /// Constructor. CIMValue(Sint8 x); /// Constructor. CIMValue(Uint16 x); /// Constructor. CIMValue(Sint16 x); /// Constructor. CIMValue(Uint32 x); /// Constructor. CIMValue(Sint32 x); /// Constructor. CIMValue(Uint64 x); /// Constructor. CIMValue(Sint64 x); /// Constructor. CIMValue(Real32 x); /// Constructor. CIMValue(Real64 x); /// Constructor. CIMValue(const Char16& x); /// Constructor. CIMValue(const String& x); /// Constructor. CIMValue(const CIMDateTime& x); /// Constructor. CIMValue(const CIMObjectPath& x); /** Constructor. Note: Constructing a CIMValue with an uninitialized CIMObject is not defined and results in a thrown UninitializedObjectException. Note: The input CIMObject will be cloned before putting it into the value of the constructed CIMValue. This is because CIMObjects use a shared representation model, but we don't want CIMObjects inside a CIMValue to be altered by other external changes. */ CIMValue(const CIMObject& x); /// Constructor. CIMValue(const Array<Boolean>& x); /// Constructor. CIMValue(const Array<Uint8>& x); /// Constructor. CIMValue(const Array<Sint8>& x); /// Constructor. CIMValue(const Array<Uint16>& x); /// Constructor. CIMValue(const Array<Sint16>& x); /// Constructor. CIMValue(const Array<Uint32>& x); /// Constructor. CIMValue(const Array<Sint32>& x); /// Constructor. CIMValue(const Array<Uint64>& x); /// Constructor. CIMValue(const Array<Sint64>& x); /// Constructor. CIMValue(const Array<Real32>& x); /// Constructor. CIMValue(const Array<Real64>& x); /// Constructor. CIMValue(const Array<Char16>& x); /// Constructor. CIMValue(const Array<String>& x); /// Constructor. CIMValue(const Array<CIMDateTime>& x); /// Constructor. CIMValue(const Array<CIMObjectPath>& x); /** Constructor. Note: Constructing a CIMValue with an uninitialized CIMObject anywhere in the input array is not defined and results in a thrown UninitializedObjectException. Note: Each CIMObject in the input Array will be cloned before putting the Array into the value of the constructed CIMValue. This is because CIMObjects use a shared representation model, but we don't want CIMObjects inside a CIMValue to be altered by other external changes. */ CIMValue(const Array<CIMObject>& x); /** Constructor. Note: If the input type is CIMObject, it/they will be cloned before putting it into the value of the constructed CIMValue. This is because CIMObjects use a shared representation model, but we don't want CIMObjects inside a CIMValue to be altered by other external changes. */ CIMValue(const CIMValue& x); /// Destructor. ~CIMValue(); /** Operator = Note: If the right hand side type is CIMObject, it/they will be cloned before putting it into the value of the target CIMValue. This is because CIMObjects use a shared representation model, but we don't want CIMObjects inside a CIMValue to be altered by other external changes. */ CIMValue& operator=(const CIMValue& x); /** Assigns one CIMValue object to another CIMValue object. @param x - CIMValue object to be used for assignment. Note: If the input type is CIMObject, it/they will be cloned before putting it into the value of the target CIMValue. This is because CIMObjects use a shared representation model, but we don't want CIMObjects inside a CIMValue to be altered by other external changes. */ void assign(const CIMValue& x); /** Clears the attributes and value of the CIMValue object. */ void clear(); /** Compares the types of two CIMValues. This compares the type field and the array indicators. @return true if both are of the same type and both are either arrays or not, false otherwise. <pre> CIMValue a(Boolean(true); CIMValue b = a; if b.typeCompatible(a) ... </pre> */ Boolean typeCompatible(const CIMValue& x) const; /** Determines if the value is an array. @return true if the value is an array, false otherwise. */ Boolean isArray() const; /** Determines whether the CIMvalue object is Null. Null is the specific condition where no value has yet been set. If a CIMValue object is Null, any get on that object will create an exception. @return true if the CIMValue object is Null, false otherwise. */ Boolean isNull() const; /** Gets the size of an Array CIMValue. @return The number of entries in the array. */ Uint32 getArraySize() const; /** Gets the CIMType attribute for the CIMValue. @return the CIMType value. */ CIMType getType() const; /** Sets the CIMValue a NULL, but with valid CIMType and array characteristics. @param type - CIMType for this CIMValue. @param isArray - Boolean indicating whether this is an array CIMValue. @param arraySize - Optional parameter indicating the array size. <pre> CIMValue value; value.setNullValue(CIMType::BOOLEAN, false); </pre> */ void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0); /** Sets the type, Array attribute and puts the value provided into the value of the target CIMValue. <pre> CIMValue x;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -