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