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