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

  1 karl  1.9 //%2006////////////////////////////////////////////////////////////////////////
  2 chuck 1.2 //
  3 karl  1.5 // 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.5 // 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           // 
 21           // 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.3 // Modified By: David Dillard, VERITAS Software Corp.
 35                   //                  (david.dillard@veritas.com)
 36 vijay.eli     1.7 //              Vijay Eli, IBM (vijayeli@in.ibm.com) bug#3590
 37 chuck         1.2 //
 38                   //%/////////////////////////////////////////////////////////////////////////////
 39                   
 40                   #ifndef PEGASUS_CQLVALUEREP_H
 41                   #define PEGASUS_CQLVALUEREP_H
 42                   
 43                   
 44                   #include <Pegasus/Common/Config.h>
 45                   #include <Pegasus/Common/CIMInstance.h>
 46                   #include <Pegasus/Query/QueryCommon/QueryContext.h>
 47                   #include <Pegasus/Common/CIMObjectPath.h>
 48                   #include <Pegasus/CQL/CQLChainedIdentifier.h>
 49                   #include <Pegasus/CQL/CQLValue.h>
 50                   #include <Pegasus/Common/ArrayInternal.h>
 51                   #include <Pegasus/CQL/Linkage.h>
 52                   
 53                   PEGASUS_NAMESPACE_BEGIN
 54 mike          1.10 class CQLFactory;
 55 chuck         1.2  
 56 mike          1.10 class CQLValueRep
 57 chuck         1.2  {
 58                      public:
 59                    
 60                        CQLValueRep();
 61                        ~CQLValueRep();
 62                        CQLValueRep(const CQLValueRep& val);
 63                        CQLValueRep(const CQLValueRep* val);
 64                        CQLValueRep(const String & inString, CQLValue::NumericType inValueType,
 65                            Boolean inSign = true);
 66                    
 67                        /**  Initializes object as a CQLIdentifier.
 68                           */
 69                        CQLValueRep(const CQLChainedIdentifier& inCQLIdent);
 70                    
 71                       /**  Initializes object as a CIMObjectPath.
 72                           */
 73                        CQLValueRep(const CIMObjectPath& inObjPath);
 74                    
 75                       /**  Initializes object as a CIMDateTime.
 76                           */
 77                        CQLValueRep(const CIMDateTime& inDateTime);
 78 chuck         1.2  
 79                        /**  Initializes object as a literal string (non-numeric).
 80                           */
 81                        CQLValueRep(const String& inString);
 82                    
 83 david.dillard 1.3     CQLValueRep(Sint64 inSint);
 84                       CQLValueRep(Uint64 inUint);
 85                       CQLValueRep(Real64 inReal);
 86 chuck         1.2     CQLValueRep(const CIMInstance& inInstance);
 87 david.dillard 1.3     CQLValueRep(Boolean inBool);
 88 chuck         1.2     CQLValueRep(const CIMClass& inClass);
 89                       CQLValueRep(const CIMObject& inObject);
 90                       CQLValueRep(const CIMValue& inVal);
 91                    
 92                        /**  This method is used to ask an identifier to resolve itself to 
 93                               a number or string (primitive value).
 94                        
 95                              Resolves:
 96                               - symbolic constants
 97                               - indexing an array
 98                               - decoding identifier
 99                                    * URI reference
100                                    * embedded object (e.g. myclass.embeddedobject.prop1)
101                                        and this is recursive
102                               - class aliasing
103                         */
104                    
105                        void resolve(const CIMInstance& CI, const QueryContext& inQueryCtx);
106                    
107                        CQLValueRep& operator=(const CQLValueRep& rhs);
108                    
109 chuck         1.2      /** operator == compares two CQLValue objects for equality and
110                                                performs type checking.
111                            @param x - First CQLValue to compare
112                            @param y - Second CQLValue to compare
113                            @return true if they are identical in type, attribute and value,
114                            false otherwise.
115                        */
116                    
117                        Boolean operator==(const CQLValueRep& x);
118                    
119                        /** operator == compares two CQLValue objects for inequality and
120                                                performs type checking.
121                            @param x - First CQLValue to compare
122                            @param y - Second CQLValue to compare
123                            @return true if they are NOT identical in type, attribute and value,
124                            false otherwise.
125                        */
126                    
127                        Boolean operator!=(const CQLValueRep& x);
128                    
129                        /** operator <= compares two CQLValue objects to see if x is less than or
130 chuck         1.2                              equal to y and performs type checking.
131                            @param x - First CQLValue to compare
132                            @param y - Second CQLValue to compare
133                            @return true if x is less than or equal to y,
134                            false otherwise.
135                        */
136                    
137                        Boolean operator<=(const CQLValueRep& x);
138                    
139                        /** operator >= compares two CQLValue objects to see if x is greater than or
140                                                equal to y and performs type checking.
141                            @param x - First CQLValue to compare
142                            @param y - Second CQLValue to compare
143                            @return true if x is greater than or equal to y,
144                            false otherwise.
145                        */
146                    
147                        Boolean operator>=(const CQLValueRep& x);
148                    
149                        /** The overload operator (<) compares CQLValue obects and
150                              performs type checking.
151 chuck         1.2          <pre>
152                                CQLValue   val1 = "def";
153                                CQLValue   val2 = "a";
154 jim.wunderlich 1.8              PEGASUS_ASSERT (val2 < val1);
155 chuck          1.2          </pre>
156                         */
157                     
158                         Boolean operator<(const CQLValueRep& val1);
159                     
160                         /** The overload operator (>) compares CQLValue obects and
161                               performs type checking.
162                             <pre>
163                                 CQLValue   val1 = "def";
164                                 CQLValue   val2 = "a";
165 jim.wunderlich 1.8              PEGASUS_ASSERT (val2 < val1);
166 chuck          1.2          </pre>
167                         */
168                     
169                         Boolean operator>(const CQLValueRep& val1);
170                     
171                         /** This overload operator (+) concatenates or adds the value of
172                         CQLValue objects and performs type checking and Uint64 handling.
173                               For example, 
174                             <pre>
175                                 CQLValue  t1 = "abc";  // it's a string type
176                                 CQLValue  t2 = "def";   // it's another string type
177                                 CQLValue   t3 = t1 + t2;
178 jim.wunderlich 1.8              PEGASUS_ASSERT(t3 == "abcdef");
179 chuck          1.2          </pre>
180                         */
181                      
182                          CQLValueRep operator+(const CQLValueRep x);
183                     
184                         /** This overload operator (-) subtracts the value of CQLValue
185                               objects and performs type checking and Uint64 handling.
186                               For example, 
187                             <pre>
188                                 CQLValue  t1 = 5;  
189                                 CQLValue  t2 = 2;   
190                                 CQLValue   t3 = t1 - t2;
191 jim.wunderlich 1.8              PEGASUS_ASSERT(t3 == 3);
192 chuck          1.2          </pre>
193                         */
194                      
195                         //CQLValueRep operator-(const CQLValueRep& x);
196                     
197                         /** This overload operator (*) multiplies the values of CQLValue
198                               objects and performs type checking and Uint64 handling.
199                               For example, 
200                             <pre>
201                                 CQLValue  t1 = 3;  
202                                 CQLValue  t2 = 2;   
203                                 CQLValue   t3 = t1 *  t2;
204 jim.wunderlich 1.8              PEGASUS_ASSERT(t3 == 6);
205 chuck          1.2          </pre>
206                         */
207                     
208                         //CQLValueRep operator*(const CQLValueRep& x);
209                     
210                         /** This overload operator (*) divides the values of CQLValue
211                               objects and performs type checking and Uint64 handling.
212                               For example, 
213                             <pre>
214                                 CQLValue  t1 = 6;  
215                                 CQLValue  t2 = 2;   
216                                 CQLValue   t3 = t1 /  t2;
217 jim.wunderlich 1.8              PEGASUS_ASSERT(t3 == 2);
218 chuck          1.2          </pre>
219                         */
220                     
221                         //CQLValueRep operator/(const CQLValueRep& x);
222                     
223                         /** Accessor for getting the type of the CQLValue.
224                         
225                         TODO:  do we need this method?
226                           */
227                     
228                         CQLValue::CQLValueType getValueType();
229                     
230                         /** Clears this object and sets its type to NULL_VALUE
231                           */
232                     
233                         void setNull();
234                     
235                         /** Returns whether the value has been resolved to a primitive.
236                           */
237                     
238                         Boolean isResolved();
239 chuck          1.2  
240                         /** Returns whether the CQLValue is null.
241                           */
242                     
243                         Boolean isNull();
244                     
245                         /** Tests to see if this "isa" the input string.
246                         */
247                     
248                         Boolean isa(const CQLChainedIdentifier& inID, QueryContext& QueryCtx);
249                     
250                         /** Tests to see if this "like" the input string.
251                               Both sides of the LIKE comparison must have a String type:
252                               the result is a Boolean type.
253                         
254                              The LIKE comparison allows a string to be tested by pattern-matching,
255                               using special characters n the right-hand-side string.
256                               See the DMTF CQL Specification for details.
257                         
258                               For Basic Query, the left-hand expression (this) may be restricted to
259                         chain, and 
260 chuck          1.2            the right-hand expression may be restricted to be a literal-string.
261                         */
262                     
263                         Boolean like(const CQLValueRep& inVal);
264                         /*
265                        void invert();
266                         */
267                        CQLChainedIdentifier getChainedIdentifier()const;
268                        Uint64 getUint()const;
269                        Sint64 getSint()const;
270                        Real64 getReal()const;
271                        String getString()const;
272                        Boolean getBool()const;
273                        CIMDateTime getDateTime()const;
274                        CIMObjectPath getReference()const;
275                        CIMObject getObject()const;
276                        String toString()const;
277 vijay.eli      1.7     void applyContext(const QueryContext& _ctx,
278                                          const CQLChainedIdentifier& inCid);
279 humberto       1.4     
280                        static String valueTypeToString(const CQLValue::CQLValueType parmType);
281 chuck          1.2     friend class CQLFactory; 
282                        friend class CQLValue;
283                       private:
284                        Boolean _areClassesInline(const CIMClass& c1,const CIMClass& c2,QueryContext& in);
285                        void _validate(const CQLValueRep& x);
286                        void _resolveSymbolicConstant(const QueryContext& inQueryCtx);
287                        void _setValue(CIMValue cv, Sint64 Index = -1);
288                        void _process_value(CIMProperty& propObj,CQLIdentifier& _id,const QueryContext& inQueryContext);
289                        Boolean _compareObjects(CIMObject& _in1, CIMObject& _in2);
290                        Boolean _compareArray(const CQLValueRep& _in);
291                     
292                        CIMValue _theValue;
293                     
294                        CQLChainedIdentifier _CQLChainId;
295                     
296                        Boolean _isResolved;
297                     
298                        CQLValue::CQLValueType _valueType;
299                     
300                        String _ArrayType;
301                     };
302 chuck          1.2  
303                     /*
304                     #ifndef PEGASUS_ARRAY_T
305                     #define PEGASUS_ARRAY_T CQLValueRep
306                     #include <Pegasus/Common/ArrayInter.h>
307                     #undef PEGASUS_ARRAY_T
308                     #endif
309                     */
310                     
311                     PEGASUS_NAMESPACE_END
312                     
313                     #endif /* CQLVALUEREP_H */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2