1 martin 1.14 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.15 //
|
3 martin 1.14 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.15 //
|
10 martin 1.14 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.15 //
|
17 martin 1.14 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.15 //
|
20 martin 1.14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.15 //
|
28 martin 1.14 //////////////////////////////////////////////////////////////////////////
|
29 chuck 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef PEGASUS_CQLVALUEREP_H
33 #define PEGASUS_CQLVALUEREP_H
34
35
36 #include <Pegasus/Common/Config.h>
37 #include <Pegasus/Common/CIMInstance.h>
38 #include <Pegasus/Query/QueryCommon/QueryContext.h>
39 #include <Pegasus/Common/CIMObjectPath.h>
40 #include <Pegasus/CQL/CQLChainedIdentifier.h>
41 #include <Pegasus/CQL/CQLValue.h>
42 #include <Pegasus/Common/ArrayInternal.h>
43 #include <Pegasus/CQL/Linkage.h>
44
45 PEGASUS_NAMESPACE_BEGIN
|
46 mike 1.10 class CQLFactory;
|
47 chuck 1.2
|
48 mike 1.10 class CQLValueRep
|
49 chuck 1.2 {
50 public:
51
52 CQLValueRep();
53 ~CQLValueRep();
54 CQLValueRep(const CQLValueRep& val);
55 CQLValueRep(const CQLValueRep* val);
56 CQLValueRep(const String & inString, CQLValue::NumericType inValueType,
57 Boolean inSign = true);
58
59 /** Initializes object as a CQLIdentifier.
60 */
61 CQLValueRep(const CQLChainedIdentifier& inCQLIdent);
62
63 /** Initializes object as a CIMObjectPath.
64 */
65 CQLValueRep(const CIMObjectPath& inObjPath);
66
67 /** Initializes object as a CIMDateTime.
68 */
69 CQLValueRep(const CIMDateTime& inDateTime);
70 chuck 1.2
71 /** Initializes object as a literal string (non-numeric).
72 */
73 CQLValueRep(const String& inString);
74
|
75 david.dillard 1.3 CQLValueRep(Sint64 inSint);
76 CQLValueRep(Uint64 inUint);
77 CQLValueRep(Real64 inReal);
|
78 chuck 1.2 CQLValueRep(const CIMInstance& inInstance);
|
79 david.dillard 1.3 CQLValueRep(Boolean inBool);
|
80 chuck 1.2 CQLValueRep(const CIMClass& inClass);
81 CQLValueRep(const CIMObject& inObject);
82 CQLValueRep(const CIMValue& inVal);
83
|
84 kumpf 1.16 /** This method is used to ask an identifier to resolve itself to
|
85 chuck 1.2 a number or string (primitive value).
|
86 kumpf 1.16
|
87 chuck 1.2 Resolves:
88 - symbolic constants
89 - indexing an array
90 - decoding identifier
91 * URI reference
92 * embedded object (e.g. myclass.embeddedobject.prop1)
93 and this is recursive
94 - class aliasing
95 */
96
97 void resolve(const CIMInstance& CI, const QueryContext& inQueryCtx);
98
99 CQLValueRep& operator=(const CQLValueRep& rhs);
100
101 /** operator == compares two CQLValue objects for equality and
102 performs type checking.
103 @param x - First CQLValue to compare
104 @param y - Second CQLValue to compare
105 @return true if they are identical in type, attribute and value,
106 false otherwise.
107 */
108 chuck 1.2
109 Boolean operator==(const CQLValueRep& x);
110
111 /** operator == compares two CQLValue objects for inequality and
112 performs type checking.
113 @param x - First CQLValue to compare
114 @param y - Second CQLValue to compare
115 @return true if they are NOT identical in type, attribute and value,
116 false otherwise.
117 */
118
119 Boolean operator!=(const CQLValueRep& x);
120
121 /** operator <= compares two CQLValue objects to see if x is less than or
122 equal to y and performs type checking.
123 @param x - First CQLValue to compare
124 @param y - Second CQLValue to compare
125 @return true if x is less than or equal to y,
126 false otherwise.
127 */
128
129 chuck 1.2 Boolean operator<=(const CQLValueRep& x);
130
|
131 karl 1.11 /** operator >= compares two CQLValue objects to see if x is greater than
132 or equal to y and performs type checking.
|
133 chuck 1.2 @param x - First CQLValue to compare
134 @param y - Second CQLValue to compare
135 @return true if x is greater than or equal to y,
136 false otherwise.
137 */
138
139 Boolean operator>=(const CQLValueRep& x);
140
141 /** The overload operator (<) compares CQLValue obects and
142 performs type checking.
143 <pre>
144 CQLValue val1 = "def";
145 CQLValue val2 = "a";
|
146 jim.wunderlich 1.8 PEGASUS_ASSERT (val2 < val1);
|
147 chuck 1.2 </pre>
148 */
149
150 Boolean operator<(const CQLValueRep& val1);
151
152 /** The overload operator (>) compares CQLValue obects and
153 performs type checking.
154 <pre>
155 CQLValue val1 = "def";
156 CQLValue val2 = "a";
|
157 jim.wunderlich 1.8 PEGASUS_ASSERT (val2 < val1);
|
158 chuck 1.2 </pre>
159 */
160
161 Boolean operator>(const CQLValueRep& val1);
162
163 /** This overload operator (+) concatenates or adds the value of
164 CQLValue objects and performs type checking and Uint64 handling.
|
165 kumpf 1.16 For example,
|
166 chuck 1.2 <pre>
167 CQLValue t1 = "abc"; // it's a string type
168 CQLValue t2 = "def"; // it's another string type
169 CQLValue t3 = t1 + t2;
|
170 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == "abcdef");
|
171 chuck 1.2 </pre>
172 */
|
173 kumpf 1.16
|
174 karl 1.16.8.1 CQLValueRep operator+(const CQLValueRep &x);
|
175 chuck 1.2
176 /** This overload operator (-) subtracts the value of CQLValue
177 objects and performs type checking and Uint64 handling.
|
178 kumpf 1.16 For example,
|
179 chuck 1.2 <pre>
|
180 kumpf 1.16 CQLValue t1 = 5;
181 CQLValue t2 = 2;
|
182 chuck 1.2 CQLValue t3 = t1 - t2;
|
183 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == 3);
|
184 chuck 1.2 </pre>
185 */
|
186 kumpf 1.16
|
187 chuck 1.2 //CQLValueRep operator-(const CQLValueRep& x);
188
189 /** This overload operator (*) multiplies the values of CQLValue
190 objects and performs type checking and Uint64 handling.
|
191 kumpf 1.16 For example,
|
192 chuck 1.2 <pre>
|
193 kumpf 1.16 CQLValue t1 = 3;
194 CQLValue t2 = 2;
|
195 chuck 1.2 CQLValue t3 = t1 * t2;
|
196 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == 6);
|
197 chuck 1.2 </pre>
198 */
199
200 //CQLValueRep operator*(const CQLValueRep& x);
201
202 /** This overload operator (*) divides the values of CQLValue
203 objects and performs type checking and Uint64 handling.
|
204 kumpf 1.16 For example,
|
205 chuck 1.2 <pre>
|
206 kumpf 1.16 CQLValue t1 = 6;
207 CQLValue t2 = 2;
|
208 chuck 1.2 CQLValue t3 = t1 / t2;
|
209 jim.wunderlich 1.8 PEGASUS_ASSERT(t3 == 2);
|
210 chuck 1.2 </pre>
211 */
212
213 //CQLValueRep operator/(const CQLValueRep& x);
214
215 /** Accessor for getting the type of the CQLValue.
|
216 kumpf 1.16
|
217 chuck 1.2 TODO: do we need this method?
218 */
219
220 CQLValue::CQLValueType getValueType();
221
222 /** Returns whether the value has been resolved to a primitive.
223 */
224
225 Boolean isResolved();
226
227 /** Returns whether the CQLValue is null.
228 */
229
|
230 dave.sudlik 1.12 Boolean isNull() const;
|
231 chuck 1.2
232 /** Tests to see if this "isa" the input string.
233 */
234
235 Boolean isa(const CQLChainedIdentifier& inID, QueryContext& QueryCtx);
236
237 /** Tests to see if this "like" the input string.
238 Both sides of the LIKE comparison must have a String type:
239 the result is a Boolean type.
|
240 kumpf 1.16
|
241 chuck 1.2 The LIKE comparison allows a string to be tested by pattern-matching,
242 using special characters n the right-hand-side string.
243 See the DMTF CQL Specification for details.
|
244 kumpf 1.16
|
245 chuck 1.2 For Basic Query, the left-hand expression (this) may be restricted to
|
246 kumpf 1.16 chain, and
|
247 chuck 1.2 the right-hand expression may be restricted to be a literal-string.
248 */
249
250 Boolean like(const CQLValueRep& inVal);
251 /*
252 void invert();
253 */
254 CQLChainedIdentifier getChainedIdentifier()const;
255 Uint64 getUint()const;
256 Sint64 getSint()const;
257 Real64 getReal()const;
258 String getString()const;
259 Boolean getBool()const;
260 CIMDateTime getDateTime()const;
261 CIMObjectPath getReference()const;
262 CIMObject getObject()const;
263 String toString()const;
|
264 vijay.eli 1.7 void applyContext(const QueryContext& _ctx,
265 const CQLChainedIdentifier& inCid);
|
266 kumpf 1.16
|
267 humberto 1.4 static String valueTypeToString(const CQLValue::CQLValueType parmType);
|
268 kumpf 1.16 friend class CQLFactory;
|
269 chuck 1.2 friend class CQLValue;
270 private:
|
271 karl 1.11 Boolean _areClassesInline(const CIMClass& c1,const CIMClass& c2,
272 QueryContext& in);
|
273 chuck 1.2 void _validate(const CQLValueRep& x);
274 void _resolveSymbolicConstant(const QueryContext& inQueryCtx);
275 void _setValue(CIMValue cv, Sint64 Index = -1);
|
276 karl 1.11 void _process_value(CIMProperty& propObj,CQLIdentifier& _id,
277 const QueryContext& inQueryContext);
|
278 chuck 1.2 Boolean _compareObjects(CIMObject& _in1, CIMObject& _in2);
279 Boolean _compareArray(const CQLValueRep& _in);
|
280 venkat.puvvada 1.13 CQLValue::CQLValueType _getCQLType(const CIMType &type) const;
|
281 chuck 1.2 CIMValue _theValue;
282
283 CQLChainedIdentifier _CQLChainId;
284
285 Boolean _isResolved;
286
287 CQLValue::CQLValueType _valueType;
288
289 String _ArrayType;
290 };
291
292 /*
293 #ifndef PEGASUS_ARRAY_T
294 #define PEGASUS_ARRAY_T CQLValueRep
295 #include <Pegasus/Common/ArrayInter.h>
296 #undef PEGASUS_ARRAY_T
297 #endif
298 */
299
300 PEGASUS_NAMESPACE_END
301
302 chuck 1.2 #endif /* CQLVALUEREP_H */
|