1 karl 1.4 //%2005////////////////////////////////////////////////////////////////////////
|
2 chuck 1.2 //
|
3 karl 1.4 // 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.4 // 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 david.dillard 1.5 //
|
19 chuck 1.2 // 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.5 // Modified By: David Dillard, VERITAS Software Corp.
33 // (david.dillard@veritas.com)
|
34 vijay.eli 1.8 // Vijay Eli, IBM (vijayeli@in.ibm.com) bug#3590
|
35 chuck 1.2 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38 #ifndef PEGASUS_CQLVALUE_H
39 #define PEGASUS_CQLVALUE_H
40
|
41 david.dillard 1.7 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
|
42 chuck 1.2
|
43 david.dillard 1.7 #include <Pegasus/CQL/Linkage.h>
|
44 chuck 1.2 #include <Pegasus/Common/CIMInstance.h>
45 #include <Pegasus/Common/ArrayInternal.h>
46 #include <Pegasus/Common/String.h>
47 #include <Pegasus/Query/QueryCommon/QueryContext.h>
48 #include <Pegasus/Common/CIMObjectPath.h>
49 #include <Pegasus/CQL/CQLChainedIdentifier.h>
50
51 PEGASUS_NAMESPACE_BEGIN
52 class PEGASUS_CQL_LINKAGE CQLFactory;
53 class PEGASUS_CQL_LINKAGE CQLValueRep;
54
55 /** The CQLValue class encapulates a value
56 that is a CQL value. The possible CQLValue
57 types are the following:
|
58 david.dillard 1.5
|
59 chuck 1.2 Sint64
60 Uint64
61 String
62 CIMDateTime
63 CIMReference
64 CQLIdentifier
|
65 david.dillard 1.5
66
67 This class can resolve an identifier to a primitive
|
68 chuck 1.2 value such as Sint64, Uint64 or String, CIMDateTime,
|
69 david.dillard 1.5 and CIMReference.
70
|
71 chuck 1.2 This class overloads and performs type checking
72 on the following operators:
73 <, >, =, >=. <=. <>
74
|
75 david.dillard 1.5
|
76 chuck 1.2 NOTE: the CQLValue class assumes a symbolic constant
77 is fully qualified.
|
78 david.dillard 1.5
|
79 chuck 1.2 */
80
81 class PEGASUS_CQL_LINKAGE CQLValue
82 {
|
83 david.dillard 1.5 public:
|
84 chuck 1.2
85 enum NumericType { Hex, Binary, Decimal, Real};
86 enum CQLValueType { Null_type, Sint64_type, Uint64_type, Real_type, String_type,
|
87 david.dillard 1.5 CIMDateTime_type, CIMReference_type, CQLIdentifier_type,
88 CIMObject_type, Boolean_type};
|
89 chuck 1.2
|
90 david.dillard 1.5 /**
|
91 david 1.3 Contructs CQLValue default object.
|
92 david.dillard 1.5
|
93 david.dillard 1.6 @param None.
94 @return None.
95 @throw None.
|
96 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
97 */
98 CQLValue();
99
|
100 david.dillard 1.5 /**
|
101 david 1.3 Destroys CQLValue object.
|
102 david.dillard 1.5
|
103 david.dillard 1.6 @param None.
104 @return None.
105 @throw None.
|
106 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
107 */
108 ~CQLValue()
109
|
110 david.dillard 1.5 /**
|
111 david 1.3 Contructs CQLValue object (Copy-Constructor).
|
112 david.dillard 1.5
|
113 david.dillard 1.6 @param None.
114 @return None.
115 @throw None.
|
116 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
117 */;
118 CQLValue(const CQLValue& val);
119
|
120 david.dillard 1.5 /**
|
121 david 1.3 Contructs CQLValue object given a string and a numbericType
|
122 david.dillard 1.5
|
123 david.dillard 1.6 @param inString The string representation of a number
124 @param inValueType The NumericType
125 @return None.
126 @throw None.
|
127 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
128 */
|
129 david.dillard 1.6 CQLValue(const String& inString, NumericType inValueType,
|
130 david.dillard 1.5 Boolean inSign = true);
131
132 /**
|
133 david 1.3 Contructs CQLValue object via CQLChainedIdentifier.
|
134 david.dillard 1.5
|
135 david.dillard 1.6 @param inCQLIdent The CQLChained Identifer used to create the object
136 @return None.
137 @throw None.
|
138 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
139 */
|
140 david.dillard 1.6 CQLValue(const CQLChainedIdentifier& inCQLIdent);
|
141 david.dillard 1.5
|
142 david 1.3 /**
143 Initializes object as a CIMObjectPath.
144
|
145 david.dillard 1.6 @param inObjPath CIMObjectPath used to construct object.
146 @return None.
147 @throw None.
|
148 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
149 */
|
150 david.dillard 1.6 CQLValue(const CIMObjectPath& inObjPath);
|
151 david.dillard 1.5
|
152 david 1.3 /**
153 Initializes object as a CIMDateTime.
154
|
155 david.dillard 1.6 @param inDateTime Datetime used to construct object.
156 @return None.
157 @throw None.
|
158 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
159 */
|
160 david.dillard 1.6 CQLValue(const CIMDateTime& inDateTime);
|
161 david.dillard 1.5
162 /**
|
163 david 1.3 Initializes object as a literal string (non-numeric).
164
|
165 david.dillard 1.6 @param inString String used to construct object.
166 @return None.
167 @throw None.
|
168 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
169 */
|
170 david.dillard 1.6 CQLValue(const String& inString);
|
171 david.dillard 1.5
172 /**
|
173 david 1.3 Initializes object as an Sint64.
|
174 david.dillard 1.5
|
175 david.dillard 1.6 @param inSint Sint64 used to contruct object.
176 @return None.
177 @throw None.
|
178 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
179 */
180 CQLValue(Sint64 inSint);
181
|
182 david.dillard 1.5 /**
|
183 david 1.3 Initializes object as a Uint64
|
184 david.dillard 1.5
|
185 david.dillard 1.6 @param inUint Uint64 used to construct object.
186 @return None.
187 @throw None.
|
188 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
189 */
190 CQLValue(Uint64 inUint);
191
|
192 david.dillard 1.5 /**
|
193 david 1.3 Initializes object as a Real64
|
194 david.dillard 1.5
|
195 david.dillard 1.6 @param inReal Real64 used to construct object.
196 @return None.
197 @throw None.
|
198 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
199 */
200 CQLValue(Real64 inReal);
|
201 david.dillard 1.5
202 /**
|
203 david 1.3 Initializes object as a CIMInstance
|
204 david.dillard 1.5
|
205 david.dillard 1.6 @param inInstance CIMInstance used to construct object.
206 @return None.
207 @throw None.
|
208 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
209 */
|
210 david.dillard 1.6 CQLValue(const CIMInstance& inInstance);
|
211 chuck 1.2
|
212 david.dillard 1.5 /**
|
213 david 1.3 Initializes object as a Boolean
|
214 david.dillard 1.5
|
215 david.dillard 1.6 @param inBool inBool used to construct object.
216 @return None.
217 @throw None.
|
218 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
219 */
220 CQLValue(Boolean inBool);
221
|
222 david.dillard 1.5 /**
|
223 david 1.3 Initializes object as a inClass
|
224 david.dillard 1.5
|
225 david.dillard 1.6 @param inClass CIMClass used to construct object.
226 @return None.
227 @throw None.
|
228 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
229 */
|
230 david.dillard 1.6 CQLValue(const CIMClass& inClass);
|
231 chuck 1.2
|
232 david.dillard 1.5 /**
|
233 david 1.3 Initializes object as a CQLValueRep
|
234 david.dillard 1.5
|
235 david.dillard 1.6 @param rhs CQLValueRep used to construct object.
236 @return None.
237 @throw None.
|
238 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
239 */
|
240 david.dillard 1.6 CQLValue(const CQLValueRep& rhs);
|
241 chuck 1.2
|
242 david.dillard 1.5 /**
|
243 david 1.3 Initializes object as a CIMObject
|
244 david.dillard 1.5
|
245 david.dillard 1.6 @param inObject CIMObject used to construct object.
246 @return None.
247 @throw None.
|
248 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
249 */
|
250 david.dillard 1.6 CQLValue(const CIMObject& inObject);
|
251 chuck 1.2
|
252 david.dillard 1.5 /**
|
253 david 1.3 Initializes object as a CIMValue
|
254 david.dillard 1.5
|
255 david.dillard 1.6 @param inVal CIMValue used to construct object.
256 @return None.
257 @throw None.
|
258 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
259 */
|
260 david.dillard 1.6 CQLValue(const CIMValue& inVal);
|
261 david.dillard 1.5
262 /** This method is used to ask an identifier to resolve itself to
|
263 david 1.3 a primitive value.
|
264 david.dillard 1.5
|
265 chuck 1.2 Resolves:
266 - symbolic constants
267 - indexing an array
268 - decoding identifier
269 * embedded object (e.g. myclass.embeddedobject.prop1)
270 and this is recursive
271 - class aliasing
|
272 david 1.3
|
273 david.dillard 1.6 @param CI CIMInstance where information is retrieved.
274 @param inQueryCtx QueryContext contains query data.
275 @return None.
276 @throw CQLRuntimeException.
|
277 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
278 chuck 1.2 */
|
279 david 1.3 void resolve(const CIMInstance& CI,const QueryContext& inQueryCtx);
|
280 david.dillard 1.5
281 /**
|
282 david 1.3 Assignment operator.
|
283 david.dillard 1.5
|
284 david.dillard 1.6 @param rhs right hand side of operator.
285 @return Reference to this object.
286 @throw None.
|
287 chuck 1.2 <I><B>Experimental Interface</B></I><BR>
288 */
289 CQLValue& operator=(const CQLValue& rhs);
|
290 david.dillard 1.5
291 /**
|
292 david 1.3 operator == compares two CQLValue objects for equality and
|
293 chuck 1.2 performs type checking.
|
294 david.dillard 1.5
|
295 david.dillard 1.6 @param rhs right hand side of operator.
296 @return Boolean.
297 @throw None.
|
298 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
299 chuck 1.2 */
|
300 david.dillard 1.5 Boolean operator==(const CQLValue& x) const;
301
302 /**
|
303 david 1.3 operator != compares two CQLValue objects for inequality and
|
304 chuck 1.2 performs type checking.
|
305 david.dillard 1.5
|
306 david.dillard 1.6 @param x Right hand side of operator.
307 @return Boolean.
308 @throw None.
|
309 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
310 chuck 1.2 */
|
311 david.dillard 1.5 Boolean operator!=(const CQLValue& x) const;
312
313 /**
|
314 david 1.3 operator <= compares two CQLValue objects to see if leftside is less than or
315 equal to right side and performs type checking.
316
|
317 david.dillard 1.6 @param x Right hand side of operator.
318 @return Boolean.
319 @throw None.
|
320 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
321 chuck 1.2 */
|
322 david.dillard 1.5 Boolean operator<=(const CQLValue& x) const;
323
324 /**
|
325 david 1.3 operator >= compares two CQLValue objects to see if leftside is greater than or
326 equal to rightside and performs type checking.
327
|
328 david.dillard 1.6 @param x Right hand side of operator.
329 @return Boolean.
330 @throw None.
|
331 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
332 chuck 1.2 */
|
333 david.dillard 1.5 Boolean operator>=(const CQLValue& x) const;
334
335 /**
|
336 david 1.3 The overload operator < compares CQLValue obects and
|
337 chuck 1.2 performs type checking.
|
338 david 1.3
|
339 david.dillard 1.6 @param val1 Right hand side of operator.
340 @return Boolean.
341 @throw None.
|
342 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
343 chuck 1.2 */
|
344 david.dillard 1.5 Boolean operator<(const CQLValue& val1) const;
345
346 /**
|
347 david 1.3 The overload operator > compares CQLValue obects and
|
348 chuck 1.2 performs type checking.
|
349 david 1.3
|
350 david.dillard 1.6 @param val1 Right hand side of operator.
351 @return Boolean.
352 @throw None.
|
353 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
354 chuck 1.2 */
|
355 david.dillard 1.5 Boolean operator>(const CQLValue& val1) const;
356
|
357 david 1.3 /** This overload operator (+) concatenates the value of
|
358 david.dillard 1.5 CQLValue objects and performs type checking.
|
359 david 1.3 (Currently supports only CQLValue of String type.)
360
|
361 david.dillard 1.6 @param x Right hand side of operator.
362 @return Boolean.
363 @throw None.
|
364 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
365 chuck 1.2 */
|
366 david.dillard 1.5 CQLValue operator+(const CQLValue& x);
367
368 /**
|
369 david 1.3 Accessor for getting the type of the CQLValue.
370
|
371 david.dillard 1.6 @param None.
372 @return CQLValueType.
373 @throw None.
|
374 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
375 david.dillard 1.5 */
376 CQLValueType getValueType() const;
377
378 /**
|
379 david 1.3 Clears this object and sets its type to NULL_VALUE
380
|
381 david.dillard 1.6 @param None.
382 @return None.
383 @throw None.
|
384 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
385 david.dillard 1.5 */
|
386 chuck 1.2 void setNull();
|
387 david.dillard 1.5
388 /**
|
389 david 1.3 Returns whether the value has been resolved to a primitive.
390
|
391 david.dillard 1.6 @param None.
392 @return True when value is a primitive.
393 @throw None.
|
394 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
395 david.dillard 1.5 */
396 Boolean isResolved() const;
397
398 /**
|
399 david 1.3 Returns whether the CQLValue is null.
400
|
401 david.dillard 1.6 @param None.
402 @return True if CQLValue primitive value is NULL.
403 @throw None.
|
404 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
405 david.dillard 1.5 */
406 Boolean isNull() const;
407
|
408 david 1.3 /** This will test to determine if the CQLValue isa String contained in the cid,
409 that identifies a class. The CQLValue must be of a type Instance or Class; Also
410 the cid must contain a String that is a valid class name.
411
|
412 david.dillard 1.6 @param cid Contains the class name.
413 @param QueryCtx Contains query related data.
414 @return true CQLValue isa class identified by cid.
415 @throw None.
|
416 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
417 david.dillard 1.5 */
418 Boolean isa(const CQLChainedIdentifier& cid, QueryContext& QueryCtx) const;
419
|
420 chuck 1.2 /** Tests to see if this "like" the input string.
421 Both sides of the LIKE comparison must have a String type:
422 the result is a Boolean type.
|
423 david.dillard 1.5
|
424 chuck 1.2 The LIKE comparison allows a string to be tested by pattern-matching,
425 using special characters n the right-hand-side string.
426 See the DMTF CQL Specification for details.
|
427 david.dillard 1.5
|
428 chuck 1.2 For Basic Query, the left-hand expression (this) may be restricted to
|
429 david.dillard 1.5 chain, and
|
430 chuck 1.2 the right-hand expression may be restricted to be a literal-string.
|
431 david 1.3
|
432 david.dillard 1.6 @param inVal CQLValue to be compared.
433 @return true CQLValue is like the passed in CQLValue.
434 @throw None.
|
435 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
436 chuck 1.2 */
|
437 david.dillard 1.5 Boolean like(const CQLValue& inVal) const;
438
439 /**
|
440 david 1.3 Get the ChainedIdentifier. Primitive from CQLValue
441
|
442 david.dillard 1.6 @param None.
443 @return ChainedIdentifier.
444 @throw CQLRuntimeException.
|
445 david 1.3 <I><B>Experimental Interface</B></I><BR>
|
446 chuck 1.2 */
|
447 david.dillard 1.5 CQLChainedIdentifier getChainedIdentifier() const;
|
448 david 1.3
|
449 david.dillard 1.5 /**
|
450 david 1.3 Get the Uint64. Primitive from CQLValue
451
|
452 david.dillard 1.6 @param None.
453 @return Uint64.
454 @throw CQLRuntimeException.
|
455 david 1.3 <I><B>Experimental Interface</B></I><BR>
456 */
|
457 david.dillard 1.5 Uint64 getUint() const;
|
458 david 1.3
|
459 david.dillard 1.5 /**
|
460 david 1.3 Get the Sint64. Primitive from CQLValue.
461
|
462 david.dillard 1.6 @param None.
463 @return Sint64.
464 @throw CQLRuntimeException.
|
465 david 1.3 <I><B>Experimental Interface</B></I><BR>
466 */
|
467 david.dillard 1.5 Sint64 getSint() const;
|
468 david 1.3
|
469 david.dillard 1.5 /**
|
470 david 1.3 Get the Real64. Primitive from CQLValue.
471
|
472 david.dillard 1.6 @param None.
473 @return Real64.
474 @throw CQLRuntimeException.
|
475 david 1.3 <I><B>Experimental Interface</B></I><BR>
476 */
|
477 david.dillard 1.5 Real64 getReal() const;
|
478 david 1.3
|
479 david.dillard 1.5 /**
|
480 david 1.3 Get the String. Primitive from CQLValue
481
|
482 david.dillard 1.6 @param None.
483 @return String.
484 @throw CQLRuntimeException.
|
485 david 1.3 <I><B>Experimental Interface</B></I><BR>
486 */
|
487 david.dillard 1.5 String getString() const;
|
488 david 1.3
|
489 david.dillard 1.5 /**
|
490 david 1.3 Get the Boolean. Primitive from CQLValue
491
|
492 david.dillard 1.6 @param None.
493 @return Boolean
494 @throw CQLRuntimeException.
|
495 david 1.3 <I><B>Experimental Interface</B></I><BR>
496 */
|
497 david.dillard 1.5 Boolean getBool() const;
|
498 david 1.3
|
499 david.dillard 1.5 /**
|
500 david 1.3 Get the CIMDateTime. Primitive from CQLValue.
501
|
502 david.dillard 1.6 @param None.
503 @return CIMDateTime
504 @throw CQLRuntimeException.
|
505 david 1.3 <I><B>Experimental Interface</B></I><BR>
506 */
|
507 david.dillard 1.5 CIMDateTime getDateTime() const;
|
508 david 1.3
|
509 david.dillard 1.5 /**
|
510 david 1.3 Get the CIMObjectPath. Primitive from CQLValue.
511
|
512 david.dillard 1.6 @param None.
513 @return Reference.
514 @throw CQLRuntimeException.
|
515 david 1.3 <I><B>Experimental Interface</B></I><BR>
516 */
|
517 david.dillard 1.5 CIMObjectPath getReference() const;
|
518 david 1.3
|
519 david.dillard 1.5 /**
|
520 david 1.3 Get the CIMObject. Primitive from CQLValue.
521
|
522 david.dillard 1.6 @param None.
523 @return CIMObject.
524 @throw CQLRuntimeException.
|
525 david 1.3 <I><B>Experimental Interface</B></I><BR>
526 */
|
527 david.dillard 1.5 CIMObject getObject() const;
|
528 david 1.3
|
529 david.dillard 1.5 /**
|
530 david 1.3 Return String representation of object.
531
|
532 david.dillard 1.6 @param None.
533 @return String
534 @throw None.
|
535 david 1.3 <I><B>Experimental Interface</B></I><BR>
536 */
|
537 david.dillard 1.5 String toString() const;
|
538 david 1.3
|
539 david.dillard 1.5 /**
|
540 david 1.3 Apply scope and class to CQLValue's chainedIdentifier.
541
|
542 david.dillard 1.6 @param None.
543 @return None.
544 @throw None.
|
545 david 1.3 <I><B>Experimental Interface</B></I><BR>
546 */
|
547 vijay.eli 1.8 void applyContext(const QueryContext& _ctx,
548 const CQLChainedIdentifier& inCid);
|
549 david.dillard 1.5
550 friend class CQLFactory;
551
552 private:
|
553 david 1.3
|
554 chuck 1.2 CQLValueRep *_rep;
555 };
556
557 /*
558 #ifndef PEGASUS_ARRAY_T
559 #define PEGASUS_ARRAY_T CQLValue
560 #include <Pegasus/Common/ArrayInter.h>
561 #undef PEGASUS_ARRAY_T
562 #endif
563 */
564
565 PEGASUS_NAMESPACE_END
566 #endif
567 #endif /* CQLVALUE_H */
|