(file) Return to CQLValue.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / CQL

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2