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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2