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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2