//%2005//////////////////////////////////////////////////////////////////////// // // 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. // // 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: Dave Rosckes (rosckes@us.ibm.com) // // Modified By: // //%///////////////////////////////////////////////////////////////////////////// #ifndef PEGASUS_CQLVALUE_H #define PEGASUS_CQLVALUE_H #include #include #include #include #include #include #include #include #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES PEGASUS_NAMESPACE_BEGIN class PEGASUS_CQL_LINKAGE CQLFactory; class PEGASUS_CQL_LINKAGE CQLValueRep; /** The CQLValue class encapulates a value that is a CQL value. The possible CQLValue types are the following: Sint64 Uint64 String CIMDateTime CIMReference CQLIdentifier This class can resolve an identifier to a primitive value such as Sint64, Uint64 or String, CIMDateTime, and CIMReference. This class overloads and performs type checking on the following operators: <, >, =, >=. <=. <> NOTE: the CQLValue class assumes a symbolic constant is fully qualified. */ class PEGASUS_CQL_LINKAGE CQLValue { public: enum NumericType { Hex, Binary, Decimal, Real}; enum CQLValueType { Null_type, Sint64_type, Uint64_type, Real_type, String_type, CIMDateTime_type, CIMReference_type, CQLIdentifier_type, CIMObject_type, Boolean_type}; /** Contructs CQLValue default object. @param - None. @return - None. @throw - None. Experimental Interface
*/ CQLValue(); /** Destroys CQLValue object. @param - None. @return - None. @throw - None. Experimental Interface
*/ ~CQLValue() /** Contructs CQLValue object (Copy-Constructor). @param - None. @return - None. @throw - None. Experimental Interface
*/; CQLValue(const CQLValue& val); /** Contructs CQLValue object given a string and a numbericType @param - inString - the string representation of a number @param - inValueType - the NumericType @return - None. @throw - None. Experimental Interface
*/ CQLValue(String inString, NumericType inValueType, Boolean inSign = true); /** Contructs CQLValue object via CQLChainedIdentifier. @param - inCQLIdent - The CQLChained Identifer used to create the object @return - None. @throw - None. Experimental Interface
*/ CQLValue(CQLChainedIdentifier inCQLIdent); /** Initializes object as a CIMObjectPath. @param - inObjPath - CIMObjectPath use to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(CIMObjectPath inObjPath); /** Initializes object as a CIMDateTime. @param - inDateTime - used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(CIMDateTime inDateTime); /** Initializes object as a literal string (non-numeric). @param - inString - String used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(String inString); /** Initializes object as an Sint64. @param - inSint - Sint64 used to contruct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(Sint64 inSint); /** Initializes object as a Uint64 @param - inUint - Uint64 used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(Uint64 inUint); /** Initializes object as a Real64 @param - inReal - Real64 used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(Real64 inReal); /** Initializes object as a CIMInstance @param - inInstance - CIMInstance used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(CIMInstance inInstance); /** Initializes object as a Boolean @param - inBool - inBool used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(Boolean inBool); /** Initializes object as a inClass @param - inClass - CIMClass used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(CIMClass inClass); /** Initializes object as a CQLValueRep @param - rhs - CQLValueRep used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(CQLValueRep rhs); /** Initializes object as a CIMObject @param - inObject - CIMObject used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(CIMObject inObject); /** Initializes object as a CIMValue @param - inVal - CIMValue used to construct object. @return - None. @throw - None. Experimental Interface
*/ CQLValue(CIMValue inVal); /** This method is used to ask an identifier to resolve itself to a primitive value. Resolves: - symbolic constants - indexing an array - decoding identifier * embedded object (e.g. myclass.embeddedobject.prop1) and this is recursive - class aliasing @param - CI - CIMInstance where information is retrieved. @param - inQueryCtx - QueryContext contains query data. @return - None. @throw - CQLRuntimeException. Experimental Interface
*/ void resolve(const CIMInstance& CI,const QueryContext& inQueryCtx); /** Assignment operator. @param - rhs - right hand side of operator. @return - CQLValue. @throw - None. Experimental Interface
*/ CQLValue& operator=(const CQLValue& rhs); /** operator == compares two CQLValue objects for equality and performs type checking. @param - rhs - right hand side of operator. @return - Boolean. @throw - None. Experimental Interface
*/ Boolean operator==(const CQLValue& x); /** operator != compares two CQLValue objects for inequality and performs type checking. @param - x - right hand side of operator. @return - Boolean. @throw - None. Experimental Interface
*/ Boolean operator!=(const CQLValue& x); /** operator <= compares two CQLValue objects to see if leftside is less than or equal to right side and performs type checking. @param - x - right hand side of operator. @return - Boolean. @throw - None. Experimental Interface
*/ Boolean operator<=(const CQLValue& x); /** operator >= compares two CQLValue objects to see if leftside is greater than or equal to rightside and performs type checking. @param - x - right hand side of operator. @return - Boolean. @throw - None. Experimental Interface
*/ Boolean operator>=(const CQLValue& x); /** The overload operator < compares CQLValue obects and performs type checking. @param - val1 - right hand side of operator. @return - Boolean. @throw - None. Experimental Interface
*/ Boolean operator<(const CQLValue& val1); /** The overload operator > compares CQLValue obects and performs type checking. @param - val1 - right hand side of operator. @return - Boolean. @throw - None. Experimental Interface
*/ Boolean operator>(const CQLValue& val1); /** This overload operator (+) concatenates the value of CQLValue objects and performs type checking. (Currently supports only CQLValue of String type.) @param - x - right hand side of operator. @return - Boolean. @throw - None. Experimental Interface
*/ CQLValue operator+(const CQLValue& x); /** Accessor for getting the type of the CQLValue. @param - None. @return - CQLValueType. @throw - None. Experimental Interface
*/ CQLValueType getValueType(); /** Clears this object and sets its type to NULL_VALUE @param - None. @return - None. @throw - None. Experimental Interface
*/ void setNull(); /** Returns whether the value has been resolved to a primitive. @param - None. @return - true when value is a primitive. @throw - None. Experimental Interface
*/ Boolean isResolved(); /** Returns whether the CQLValue is null. @param - None. @return - true if CQLValue primitive value is NULL. @throw - None. Experimental Interface
*/ Boolean isNull(); /** This will test to determine if the CQLValue isa String contained in the cid, that identifies a class. The CQLValue must be of a type Instance or Class; Also the cid must contain a String that is a valid class name. @param - cid - Contains the class name. @param - QueryCtx - contains query related data. @return - true CQLValue isa class identified by cid. @throw - None. Experimental Interface
*/ Boolean isa(const CQLChainedIdentifier& cid, QueryContext& QueryCtx); /** Tests to see if this "like" the input string. Both sides of the LIKE comparison must have a String type: the result is a Boolean type. The LIKE comparison allows a string to be tested by pattern-matching, using special characters n the right-hand-side string. See the DMTF CQL Specification for details. For Basic Query, the left-hand expression (this) may be restricted to chain, and the right-hand expression may be restricted to be a literal-string. @param - inVal - CQLValue to be compared. @return - true CQLValue is like the passed in CQLValue. @throw - None. Experimental Interface
*/ Boolean like(const CQLValue& inVal); /** Get the ChainedIdentifier. Primitive from CQLValue @param - None. @return - ChainedIdentifier. @throw - CQLRuntimeException. Experimental Interface
*/ CQLChainedIdentifier getChainedIdentifier()const; /** Get the Uint64. Primitive from CQLValue @param - None. @return - Uint64. @throw - CQLRuntimeException. Experimental Interface
*/ Uint64 getUint()const; /** Get the Sint64. Primitive from CQLValue. @param - None. @return - Sint64. @throw - CQLRuntimeException. Experimental Interface
*/ Sint64 getSint()const; /** Get the Real64. Primitive from CQLValue. @param - None. @return - Real64. @throw - CQLRuntimeException. Experimental Interface
*/ Real64 getReal()const; /** Get the String. Primitive from CQLValue @param - None. @return - String. @throw - CQLRuntimeException. Experimental Interface
*/ String getString()const; /** Get the Boolean. Primitive from CQLValue @param - None. @return - Boolean @throw - CQLRuntimeException. Experimental Interface
*/ Boolean getBool()const; /** Get the CIMDateTime. Primitive from CQLValue. @param - None. @return - CIMDateTime @throw - CQLRuntimeException. Experimental Interface
*/ CIMDateTime getDateTime()const; /** Get the CIMObjectPath. Primitive from CQLValue. @param - None. @return - Reference. @throw - CQLRuntimeException. Experimental Interface
*/ CIMObjectPath getReference()const; /** Get the CIMObject. Primitive from CQLValue. @param - None. @return - CIMObject. @throw - CQLRuntimeException. Experimental Interface
*/ CIMObject getObject()const; /** Return String representation of object. @param - None. @return - String @throw - None. Experimental Interface
*/ String toString()const; /** Apply scope and class to CQLValue's chainedIdentifier. @param - None. @return - None. @throw - None. Experimental Interface
*/ void applyContext(QueryContext& _ctx, CQLChainedIdentifier& inCid); friend class CQLFactory; private: CQLValueRep *_rep; }; /* #ifndef PEGASUS_ARRAY_T #define PEGASUS_ARRAY_T CQLValue #include #undef PEGASUS_ARRAY_T #endif */ PEGASUS_NAMESPACE_END #endif #endif /* CQLVALUE_H */