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