1 karl 1.5 //%2005////////////////////////////////////////////////////////////////////////
|
2 chuck 1.2 //
|
3 karl 1.5 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 chuck 1.2 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.5 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 chuck 1.2 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
18 //
19 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Author: Dave Rosckes (rosckes@us.ibm.com)
31 //
|
32 david.dillard 1.3 // Modified By: David Dillard, VERITAS Software Corp.
33 // (david.dillard@veritas.com)
|
34 vijay.eli 1.7 // Vijay Eli, IBM (vijayeli@in.ibm.com) bug#3590
|
35 chuck 1.2 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38 #ifndef PEGASUS_CQLVALUEREP_H
39 #define PEGASUS_CQLVALUEREP_H
40
41
42 #include <Pegasus/Common/Config.h>
43 #include <Pegasus/Common/CIMInstance.h>
44 #include <Pegasus/Query/QueryCommon/QueryContext.h>
45 #include <Pegasus/Common/CIMObjectPath.h>
46 #include <Pegasus/CQL/CQLChainedIdentifier.h>
47 #include <Pegasus/CQL/CQLValue.h>
48 #include <Pegasus/Common/ArrayInternal.h>
49 #include <Pegasus/CQL/Linkage.h>
50
51 PEGASUS_NAMESPACE_BEGIN
52 class PEGASUS_CQL_LINKAGE CQLFactory;
53
54 class PEGASUS_CQL_LINKAGE CQLValueRep
55 {
56 chuck 1.2 public:
57
58 CQLValueRep();
59 ~CQLValueRep();
60 CQLValueRep(const CQLValueRep& val);
61 CQLValueRep(const CQLValueRep* val);
62 CQLValueRep(const String & inString, CQLValue::NumericType inValueType,
63 Boolean inSign = true);
64
65 /** Initializes object as a CQLIdentifier.
66 */
67 CQLValueRep(const CQLChainedIdentifier& inCQLIdent);
68
69 /** Initializes object as a CIMObjectPath.
70 */
71 CQLValueRep(const CIMObjectPath& inObjPath);
72
73 /** Initializes object as a CIMDateTime.
74 */
75 CQLValueRep(const CIMDateTime& inDateTime);
76
77 chuck 1.2 /** Initializes object as a literal string (non-numeric).
78 */
79 CQLValueRep(const String& inString);
80
|
81 david.dillard 1.3 CQLValueRep(Sint64 inSint);
82 CQLValueRep(Uint64 inUint);
83 CQLValueRep(Real64 inReal);
|
84 chuck 1.2 CQLValueRep(const CIMInstance& inInstance);
|
85 david.dillard 1.3 CQLValueRep(Boolean inBool);
|
86 chuck 1.2 CQLValueRep(const CIMClass& inClass);
87 CQLValueRep(const CIMObject& inObject);
88 CQLValueRep(const CIMValue& inVal);
89
90 /** This method is used to ask an identifier to resolve itself to
91 a number or string (primitive value).
92
93 Resolves:
94 - symbolic constants
95 - indexing an array
96 - decoding identifier
97 * URI reference
98 * embedded object (e.g. myclass.embeddedobject.prop1)
99 and this is recursive
100 - class aliasing
101 */
102
103 void resolve(const CIMInstance& CI, const QueryContext& inQueryCtx);
104
105 CQLValueRep& operator=(const CQLValueRep& rhs);
106
107 chuck 1.2 /** operator == compares two CQLValue objects for equality and
108 performs type checking.
109 @param x - First CQLValue to compare
110 @param y - Second CQLValue to compare
111 @return true if they are identical in type, attribute and value,
112 false otherwise.
113 */
114
115 Boolean operator==(const CQLValueRep& x);
116
117 /** operator == compares two CQLValue objects for inequality and
118 performs type checking.
119 @param x - First CQLValue to compare
120 @param y - Second CQLValue to compare
121 @return true if they are NOT identical in type, attribute and value,
122 false otherwise.
123 */
124
125 Boolean operator!=(const CQLValueRep& x);
126
127 /** operator <= compares two CQLValue objects to see if x is less than or
128 chuck 1.2 equal to y and performs type checking.
129 @param x - First CQLValue to compare
130 @param y - Second CQLValue to compare
131 @return true if x is less than or equal to y,
132 false otherwise.
133 */
134
135 Boolean operator<=(const CQLValueRep& x);
136
137 /** operator >= compares two CQLValue objects to see if x is greater than or
138 equal to y and performs type checking.
139 @param x - First CQLValue to compare
140 @param y - Second CQLValue to compare
141 @return true if x is greater than or equal to y,
142 false otherwise.
143 */
144
145 Boolean operator>=(const CQLValueRep& x);
146
147 /** The overload operator (<) compares CQLValue obects and
148 performs type checking.
149 chuck 1.2 <pre>
150 CQLValue val1 = "def";
151 CQLValue val2 = "a";
|
152 jim.wunderlich 1.8 PEGASUS_ASSERT (val2 < val1);
|
153 chuck 1.2 </pre>
154 */
155
156 Boolean operator<(const CQLValueRep& val1);
157
158 /** The overload operator (>) compares CQLValue obects and
159 performs type checking.
160 <pre>
161 CQLValue val1 = "def";
162 CQLValue val2 = "a";
|
163 jim.wunderlich 1.8 PEGASUS_ASSERT (val2 < val1);
|
164 chuck 1.2 </pre>
165 */
166
167 Boolean operator>(const CQLValueRep& val1);
168
169 /** This overload operator (+) concatenates or adds the value of
170 CQLValue objects and performs type checking and Uint64 handling.
171 For example,
172 <pre>
173 CQLValue t1 = "abc"; // it's a string type
174 CQLValue t2 = "def"; // it's another string type
175 CQLValue t3 = t1 + t2;
|
176 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == "abcdef");
|
177 chuck 1.2 </pre>
178 */
179
180 CQLValueRep operator+(const CQLValueRep x);
181
182 /** This overload operator (-) subtracts the value of CQLValue
183 objects and performs type checking and Uint64 handling.
184 For example,
185 <pre>
186 CQLValue t1 = 5;
187 CQLValue t2 = 2;
188 CQLValue t3 = t1 - t2;
|
189 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == 3);
|
190 chuck 1.2 </pre>
191 */
192
193 //CQLValueRep operator-(const CQLValueRep& x);
194
195 /** This overload operator (*) multiplies the values of CQLValue
196 objects and performs type checking and Uint64 handling.
197 For example,
198 <pre>
199 CQLValue t1 = 3;
200 CQLValue t2 = 2;
201 CQLValue t3 = t1 * t2;
|
202 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == 6);
|
203 chuck 1.2 </pre>
204 */
205
206 //CQLValueRep operator*(const CQLValueRep& x);
207
208 /** This overload operator (*) divides the values of CQLValue
209 objects and performs type checking and Uint64 handling.
210 For example,
211 <pre>
212 CQLValue t1 = 6;
213 CQLValue t2 = 2;
214 CQLValue t3 = t1 / t2;
|
215 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == 2);
|
216 chuck 1.2 </pre>
217 */
218
219 //CQLValueRep operator/(const CQLValueRep& x);
220
221 /** Accessor for getting the type of the CQLValue.
222
223 TODO: do we need this method?
224 */
225
226 CQLValue::CQLValueType getValueType();
227
228 /** Clears this object and sets its type to NULL_VALUE
229 */
230
231 void setNull();
232
233 /** Returns whether the value has been resolved to a primitive.
234 */
235
236 Boolean isResolved();
237 chuck 1.2
238 /** Returns whether the CQLValue is null.
239 */
240
241 Boolean isNull();
242
243 /** Tests to see if this "isa" the input string.
244 */
245
246 Boolean isa(const CQLChainedIdentifier& inID, QueryContext& QueryCtx);
247
248 /** Tests to see if this "like" the input string.
249 Both sides of the LIKE comparison must have a String type:
250 the result is a Boolean type.
251
252 The LIKE comparison allows a string to be tested by pattern-matching,
253 using special characters n the right-hand-side string.
254 See the DMTF CQL Specification for details.
255
256 For Basic Query, the left-hand expression (this) may be restricted to
257 chain, and
258 chuck 1.2 the right-hand expression may be restricted to be a literal-string.
259 */
260
261 Boolean like(const CQLValueRep& inVal);
262 /*
263 void invert();
264 */
265 CQLChainedIdentifier getChainedIdentifier()const;
266 Uint64 getUint()const;
267 Sint64 getSint()const;
268 Real64 getReal()const;
269 String getString()const;
270 Boolean getBool()const;
271 CIMDateTime getDateTime()const;
272 CIMObjectPath getReference()const;
273 CIMObject getObject()const;
274 String toString()const;
|
275 vijay.eli 1.7 void applyContext(const QueryContext& _ctx,
276 const CQLChainedIdentifier& inCid);
|
277 humberto 1.4
278 static String valueTypeToString(const CQLValue::CQLValueType parmType);
|
279 chuck 1.2 friend class CQLFactory;
280 friend class CQLValue;
281 private:
282 Boolean _areClassesInline(const CIMClass& c1,const CIMClass& c2,QueryContext& in);
283 void _validate(const CQLValueRep& x);
284 void _resolveSymbolicConstant(const QueryContext& inQueryCtx);
285 void _setValue(CIMValue cv, Sint64 Index = -1);
286 void _process_value(CIMProperty& propObj,CQLIdentifier& _id,const QueryContext& inQueryContext);
287 Boolean _compareObjects(CIMObject& _in1, CIMObject& _in2);
288 Boolean _compareArray(const CQLValueRep& _in);
289
290 CIMValue _theValue;
291
292 CQLChainedIdentifier _CQLChainId;
293
294 Boolean _isResolved;
295
296 CQLValue::CQLValueType _valueType;
297
298 String _ArrayType;
299 };
300 chuck 1.2
301 /*
302 #ifndef PEGASUS_ARRAY_T
303 #define PEGASUS_ARRAY_T CQLValueRep
304 #include <Pegasus/Common/ArrayInter.h>
305 #undef PEGASUS_ARRAY_T
306 #endif
307 */
308
309 PEGASUS_NAMESPACE_END
310
311 #endif /* CQLVALUEREP_H */
|