1 chuck 1.1.2.4 //%2003////////////////////////////////////////////////////////////////////////
|
2 david 1.1.2.1 //
|
3 chuck 1.1.2.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 david 1.1.2.1 // IBM Corp.; EMC Corporation, The Open Group.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Author: Dave Rosckes (rosckes@us.ibm.com)
27 david 1.1.2.1 //
28 // Modified By:
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <cstdlib>
33 #include <iostream>
34
|
35 david 1.1.2.15 #include <Pegasus/CQL/CQLValue.h>
|
36 david 1.1.2.1 #include <Pegasus/CQL/CQLValueRep.h>
37 #include <Pegasus/Repository/NameSpaceManager.h>
38 #include <Pegasus/Common/CIMClass.h>
39 #include <Pegasus/CQL/CQLIdentifier.h>
40
41 #include <Pegasus/CQL/CQLFactory.h>
42
43
44
45 PEGASUS_NAMESPACE_BEGIN
46 PEGASUS_USING_STD;
47
48 #define PEGASUS_ARRAY_T CQLValueRep
49 #include <Pegasus/Common/ArrayImpl.h>
50 #undef PEGASUS_ARRAY_T
51
52
53 #define CIMTYPE_EMBEDDED 15 //temporary
|
54 humberto 1.1.2.3
55 CQLValueRep::CQLValueRep()
56 {
|
57 david 1.1.2.15 _valueType = CQLValue::Null_type;
|
58 humberto 1.1.2.3 _theValue._S = NULL;
59 }
|
60 david 1.1.2.1 CQLValueRep::~CQLValueRep()
61 {
62 switch(_valueType)
63 {
|
64 david 1.1.2.15 case CQLValue::String_type:
|
65 david 1.1.2.1 {
|
66 humberto 1.1.2.3 if(_theValue._S != NULL){
|
67 david 1.1.2.1 delete _theValue._S;
|
68 humberto 1.1.2.3 }
|
69 david 1.1.2.1 _theValue._S = NULL;
70 break;
71 }
|
72 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
73 david 1.1.2.1 {
74 if(_theValue._DT != NULL)
75 delete _theValue._DT;
76 _theValue._DT = NULL;
77 break;
78 }
|
79 david 1.1.2.15 case CQLValue::CIMReference_type:
|
80 david 1.1.2.1 {
81 if(_theValue._OP != NULL)
82 delete _theValue._OP;
83 _theValue._OP = NULL;
84 break;
85 }
|
86 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
87 david 1.1.2.1 {
88 if(_theValue._IN != NULL)
89 delete _theValue._IN;
90 _theValue._IN = NULL;
91 break;
92 }
|
93 david 1.1.2.15 case CQLValue::CIMClass_type:
|
94 david 1.1.2.1 {
95 if(_theValue._CL != NULL)
96 delete _theValue._CL;
97 _theValue._CL = NULL;
98 break;
99 }
100 default:
101 break;
102 }
103 }
104
105 CQLValueRep::CQLValueRep(const CQLValueRep* val)
106 {
107 switch(val->_valueType)
108 {
|
109 david 1.1.2.15 case CQLValue::Boolean_type:
|
110 david 1.1.2.1 {
111 _theValue._B = val->_theValue._B;
112 break;
113 }
|
114 david 1.1.2.15 case CQLValue::Sint64_type:
|
115 david 1.1.2.1 {
116 _theValue._S64 = val->_theValue._S64;
117 break;
118 }
|
119 david 1.1.2.15 case CQLValue::Uint64_type:
|
120 david 1.1.2.1 {
121 _theValue._U64 = val->_theValue._U64;
122 break;
123 }
|
124 david 1.1.2.15 case CQLValue::Real_type:
|
125 david 1.1.2.1 {
126 _theValue._R64 = val->_theValue._R64;
127 break;
128 }
|
129 david 1.1.2.15 case CQLValue::String_type:
|
130 david 1.1.2.1 {
131 _theValue._S = new String(*val->_theValue._S);
132 break;
133 }
|
134 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
135 david 1.1.2.1 {
136 _theValue._DT = new CIMDateTime(*val->_theValue._DT);
137 break;
138 }
|
139 david 1.1.2.15 case CQLValue::CIMReference_type:
|
140 david 1.1.2.1 {
141 _theValue._OP = new CIMObjectPath(*val->_theValue._OP);
142 break;
143 }
|
144 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
145 david 1.1.2.1 {
|
146 david 1.1.2.16 _theValue._IN = new CIMInstance(val->_theValue._IN->clone());
|
147 david 1.1.2.1 break;
148 }
|
149 david 1.1.2.15 case CQLValue::CIMClass_type:
|
150 david 1.1.2.1 {
|
151 david 1.1.2.16 _theValue._CL = new CIMClass(val->_theValue._CL->clone());
|
152 david 1.1.2.1 break;
153 }
154 default:
155 break;
156 }
157
158 _CQLChainId = val->_CQLChainId;
159
160 _isResolved = val->_isResolved;
161
162 Num_Type = val->Num_Type;
163
164 _valueType = val->_valueType;
165 }
166
|
167 david 1.1.2.15 CQLValueRep::CQLValueRep(const String& inString, CQLValue::NumericType inValueType, Boolean inSign)
|
168 david 1.1.2.1 {
169 CString cStr = inString.getCString();
170 char *endP;
171
172 switch(inValueType)
173 {
|
174 david 1.1.2.15 case CQLValue::Hex:
|
175 david 1.1.2.1 if(inSign)
176 {
177 _theValue._U64 = strtoul((const char*)cStr,&endP,16);
|
178 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
179 david 1.1.2.1 }
180 else
181 {
182 _theValue._S64 = strtol((const char *)cStr,&endP,16);
|
183 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
184 david 1.1.2.1 }
185
186 break;
|
187 david 1.1.2.15 case CQLValue::Binary:
|
188 david 1.1.2.1 if(inSign)
189 {
190 _theValue._U64 = strtoul((const char *)cStr,&endP,2);
|
191 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
192 david 1.1.2.1 }
193 else
194 {
195 _theValue._S64 = strtol((const char *)cStr,&endP,2);
|
196 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
197 david 1.1.2.1 }
198 break;
|
199 david 1.1.2.15 case CQLValue::Decimal:
|
200 david 1.1.2.1 if(inSign)
201 {
202 _theValue._U64 = strtoul((const char *)cStr,&endP,10);
|
203 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
204 david 1.1.2.1 }
205 else
206 {
207 _theValue._S64 = strtol((const char *)cStr,&endP,10);
|
208 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
209 david 1.1.2.1 }
210 break;
|
211 david 1.1.2.15 case CQLValue::Real:
|
212 david 1.1.2.1 if(inSign)
213 {
214 _theValue._R64 = strtod((const char *)cStr,&endP);
|
215 david 1.1.2.15 _valueType = CQLValue::Real_type;
|
216 david 1.1.2.1 }
217 else
218 {
219 _theValue._R64 = strtod((const char *)cStr,&endP);
|
220 david 1.1.2.15 _valueType = CQLValue::Real_type;
|
221 david 1.1.2.1 }
222 break;
223 default:
|
224 david 1.1.2.12 throw(Exception(String("CQLValueRep::CQLValueRep")));
|
225 david 1.1.2.1 break;
226 }
227 _isResolved = true;
228 }
229
230
|
231 david 1.1.2.15 CQLValueRep::CQLValueRep(const CQLChainedIdentifier& inCQLIdent)
|
232 david 1.1.2.1 {
233 _CQLChainId = inCQLIdent;
|
234 david 1.1.2.15 _valueType = CQLValue::CQLIdentifier_type;
|
235 david 1.1.2.1 _isResolved = false;
236 }
237
238
|
239 david 1.1.2.15 CQLValueRep::CQLValueRep(const String& inString)
|
240 david 1.1.2.1 {
241 _theValue._S = new String(inString);
|
242 david 1.1.2.15 _valueType = CQLValue::String_type;
|
243 david 1.1.2.1 _isResolved = true;
244 }
245
|
246 david 1.1.2.15 CQLValueRep::CQLValueRep(const CIMInstance& inInstance)
|
247 david 1.1.2.1 {
|
248 david 1.1.2.16 _theValue._IN = new CIMInstance(inInstance.clone());
|
249 david 1.1.2.15 _valueType = CQLValue::CIMInstance_type;
|
250 david 1.1.2.1 _isResolved = true;
251 }
252
|
253 david 1.1.2.15 CQLValueRep::CQLValueRep(const CIMClass& inClass)
|
254 david 1.1.2.1 {
|
255 david 1.1.2.16 _theValue._CL = new CIMClass(inClass.clone());
|
256 david 1.1.2.15 _valueType = CQLValue::CIMClass_type;
|
257 david 1.1.2.1 _isResolved = true;
258 }
259
|
260 david 1.1.2.15 CQLValueRep::CQLValueRep(const CIMObjectPath& inObjPath)
|
261 david 1.1.2.1 {
262 _theValue._OP = new CIMObjectPath(inObjPath);
|
263 david 1.1.2.15 _valueType = CQLValue::CIMReference_type;
|
264 david 1.1.2.1 _isResolved = true;
265 }
266
|
267 david 1.1.2.15 CQLValueRep::CQLValueRep(const CIMDateTime& inDateTime)
|
268 david 1.1.2.1 {
269 _theValue._DT = new CIMDateTime(inDateTime);
|
270 david 1.1.2.15 _valueType = CQLValue::CIMDateTime_type;
|
271 david 1.1.2.1 _isResolved = true;
272 }
273
274 CQLValueRep::CQLValueRep(Uint64 inUint)
275 {
276 _theValue._U64 = inUint;
|
277 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
278 david 1.1.2.1 _isResolved = true;
279 }
280
281 CQLValueRep::CQLValueRep(Boolean inBool)
282 {
283 _theValue._B = inBool;
|
284 david 1.1.2.15 _valueType = CQLValue::Boolean_type;
|
285 david 1.1.2.1 _isResolved = true;
286 }
287
288 CQLValueRep::CQLValueRep(Sint64 inSint)
289 {
290 _theValue._S64 = inSint;
|
291 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
292 david 1.1.2.1 _isResolved = true;
293 }
294
295 CQLValueRep::CQLValueRep(Real64 inReal)
296 {
297 _theValue._R64 = inReal;
|
298 david 1.1.2.15 _valueType = CQLValue::Real_type;
|
299 david 1.1.2.1 _isResolved = true;
300 }
301
|
302 david 1.1.2.17 void CQLValueRep::resolve(const CIMInstance& CI, const QueryContext& inQueryCtx)
|
303 david 1.1.2.1 {
|
304 david 1.1.2.16 if(_CQLChainId.size() == 0)
|
305 david 1.1.2.1 {
306 return;
307 }
308
309 CQLIdentifier classNameID; // Determine if we have Alias/Class/Property
310 String className; // Alias/Class Name
311 Array<CQLIdentifier> Idstrings =
312 _CQLChainId.getSubIdentifiers(); // Array of Identifiers to process
313
314 Uint32 index = 0; // Counter for looping through Identifiers
315
316 CIMClass ScopeClass; // CIMClass for the scope of Identifier
317 CIMClass QueryClass; // CIMClass for the current query
318
319 CIMProperty queryPropObj; // Property object used for verification
320
321 Uint32 qualIndex; // Counter for looping through qualifiers
322 CIMValue valueMap; // CIMValue for Value Map Qualifiers
323 CIMValue values; // CIMValue for Values Qualifiers
324 Boolean matchFound = false; // Indicator for match Qualifier
325 Uint32 matchIndex; // Placeholder for matched Qualifier
326 david 1.1.2.1 Array<String> valueMapArray; // Value Map Qualifier for property
327 Array<String> valuesArray; // Values Qualifier for property
328
329 Boolean isEmbedded = false; // Embedded indicator
330
331 // We need to determine if the first Identifier is an Alias, Class, or Property.
332 // If it is a Alias or a Class the CQLIdentifier return will be the
333 // Class name. If the first Identifier is a property, the return CQLIdentifier
334 // will be empty.
335
336 classNameID = inQueryCtx.findClass(Idstrings[index].getName().getString());
337
338 className = classNameID.getName().getString();
339
340 if(className.size() == 0)
341 {
342 // classname is an empty string, the first Identifier must be a property.
343 // A class is needed to proceed. We will get a class from the FromList.
344 // NOTE: for basic CQL support only one class will be in the FromList.
345
346 Array<CQLIdentifier> classList;
347 david 1.1.2.1
348 classList = inQueryCtx.getFromList();
349
350 if(classList.size() != 1)
351 {
|
352 david 1.1.2.12 throw(Exception(String("CQLValueRep::resolve")));
|
353 david 1.1.2.1 }
354
355 className = classList[0].getName().getString();
356
357 }
358 else if(Idstrings.size() == 1)
359 {
360 // A class was passed in with no property indicated.
361 // Set the instance passed in, as a primitive.
|
362 david 1.1.2.16 _theValue._IN = (CIMInstance *) new CIMInstance(CI.clone());
|
363 david 1.1.2.15 _valueType = CQLValue::CIMInstance_type;
|
364 david 1.1.2.1 _isResolved = true;
365 return; // Done.
366 }
367 else
368 {
369 // Need to increment index since the first Identifier is a class,
370 // and additional identifiers need processing.
371 ++index;
372 }
|
373 david 1.1.2.9
374 // Symbolic Constant processing
375 if(_CQLChainId.getLastIdentifier().isSymbolicConstant())
376 {
377 _resolveSymbolicConstant(inQueryCtx);
378 return;
379 }
|
380 david 1.1.2.1
381 // Now we will loop through the remaining CQLIdentifiers,
382 // and process each one.
383 for(;index < Idstrings.size(); ++index)
384 {
385 // We will get the current class from the repository.
386 // We must do this for each loop since the class being
387 // processed may change with each iteration.
388 QueryClass = inQueryCtx.getClass(className);
389
390 // We need to do special processing on property if the
391 // property is scoped.
|
392 david 1.1.2.6 // TODO: We should be able to delete this code.
393 /*
|
394 david 1.1.2.1 if(Idstrings[index].isScoped())
395 {
396 // This property is scoped.
397 // We need to get the scoped class from the repository; to verify
398 // that the property is in the scope and the scope and QueryClass
399 // have a parent child relationship.
400 ScopeClass = inQueryCtx.getClass(Idstrings[index].getScope());
401
402 // Verifing property is in Scope.
403 if(ScopeClass.findProperty(Idstrings[index].getName()) ==
404 PEG_NOT_FOUND)
405 {
406 // Set the Ignore_type
407 _valueType = CQLIgnore_type;
408 _isResolved = true;
409 return;
410 }
411 // Verifying the QueryClass and the ScopeClass have a
412 // parent child relationship
413 else if(!_areClassesInline(ScopeClass,QueryClass,inQueryCtx))
414 {
415 david 1.1.2.1 throw(1);
416 }
|
417 david 1.1.2.6
|
418 david 1.1.2.1 }
419 // Verifing that embedded properties are scoped.
420 else if(isEmbedded)
421 { // all embedded properties must be scoped.
422
423 throw(1);
424 }
|
425 david 1.1.2.6 */
|
426 david 1.1.2.1 // This is a short cut for wildcard special charactor.
427 // Since no further processing is necessary for this case.
428 if(Idstrings[index].isWildcard())
429 {
|
430 david 1.1.2.16 _theValue._IN = new CIMInstance(CI.clone());
|
431 david 1.1.2.15 _valueType = CQLValue::CIMInstance_type;
|
432 david 1.1.2.1 _isResolved = true;
433 return;
434 }
435
436 // Now we need to verify that the property is in the class.
437 Uint32 propertyIndex = QueryClass.findProperty(Idstrings[index].getName());
438
439 if(propertyIndex == PEG_NOT_FOUND)
440 {
|
441 david 1.1.2.12 throw(Exception(String("CQLValueRep::resolve -- Property not Found")));
|
442 david 1.1.2.1 }
443
444 // We will check the property type to determine what processing
445 // needs to be done.
446 queryPropObj = QueryClass.getProperty(propertyIndex);
447
448 if(queryPropObj.getType() == CIMTYPE_EMBEDDED)
449 {
450 // Do embedded code here.
451
452 isEmbedded = true;
453 continue;
454 }
455 else // Primitive
456 {
457 // We will retrieve the property from the instance,
458 // that will be used to set the primitive later in processing.
459 propertyIndex = CI.findProperty(Idstrings[index].getName());
|
460 david 1.1.2.17 CIMConstProperty propObj = CI.getProperty(propertyIndex);
|
461 david 1.1.2.1
|
462 david 1.1.2.9 if(Idstrings[index].isArray())
|
463 david 1.1.2.1 {
464 // We have an array property. All we need to do
465 // Is get the index defined by CQLIdentifier.
466 // NOTE: Basic CQL support only allows one index.
467 _setValue(propObj.getValue(),
468 Idstrings[index].getSubRanges()[0].start);
469 return;
470 }
471 else
472 {
473 // The property has no special charactors.
474 CIMValue cimVal = propObj.getValue();
475 _setValue(cimVal);
476 return;
477 }
478 } // else body
479 } // loop
480 } // end of function
481
482 CQLValueRep& CQLValueRep::operator=(const CQLValueRep& rhs){
483
484 david 1.1.2.1 if(&rhs != this){
485 _valueType = rhs._valueType;
486 _theValue = rhs._theValue;
487 switch(_valueType){
|
488 david 1.1.2.15 case CQLValue::String_type:
|
489 david 1.1.2.1 _theValue._S = new String(rhs.getString());
490 break;
|
491 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
492 david 1.1.2.1 _theValue._DT = new CIMDateTime(rhs.getDateTime());
493 break;
|
494 david 1.1.2.15 case CQLValue::CIMReference_type:
|
495 david 1.1.2.1 _theValue._OP = new CIMObjectPath(rhs.getReference());
496 break;
|
497 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
498 david 1.1.2.16 _theValue._IN = new CIMInstance(rhs.getInstance().clone());
|
499 david 1.1.2.1 break;
|
500 david 1.1.2.15 case CQLValue::CIMClass_type:
|
501 david 1.1.2.16 _theValue._CL = new CIMClass(rhs.getClass().clone());
|
502 david 1.1.2.1 break;
|
503 david 1.1.2.15 case CQLValue::Boolean_type:
504 case CQLValue::Sint64_type:
505 case CQLValue::Uint64_type:
506 case CQLValue::Real_type:
507 case CQLValue::Null_type:
508 case CQLValue::CQLIdentifier_type:
509
|
510 david 1.1.2.1 default:
511 break;
512 }
513 _CQLChainId = rhs._CQLChainId;
514 _isResolved = rhs._isResolved;
515 Num_Type = rhs.Num_Type;
516 }
517 return *this;
518 }
519 Boolean CQLValueRep::operator==(const CQLValueRep& x)
520 {
521 if(!_validate(x))
522 {
|
523 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator==")));
|
524 david 1.1.2.6 }
525
|
526 david 1.1.2.15 if(x._valueType == CQLValue::Null_type ||
527 _valueType == CQLValue::Null_type)
|
528 david 1.1.2.6 {
|
529 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator==")));
|
530 david 1.1.2.6 }
|
531 david 1.1.2.1
532 switch(_valueType)
533 {
|
534 david 1.1.2.15 case CQLValue::Boolean_type:
|
535 david 1.1.2.1 {
|
536 david 1.1.2.15 if(x._valueType == CQLValue::Boolean_type)
|
537 david 1.1.2.1 {
538 if(_theValue._B == x._theValue._B)
539 {
540 return true;
541 }
542 }
543 break;
544 }
|
545 david 1.1.2.15 case CQLValue::Sint64_type:
|
546 david 1.1.2.1 {
|
547 david 1.1.2.15 if(x._valueType == CQLValue::Sint64_type)
|
548 david 1.1.2.1 {
549 if(_theValue._S64 == x._theValue._S64)
550 {
551 return true;
552 }
553 }
|
554 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
555 david 1.1.2.1 {
556 if(_theValue._S64 == (Sint64)x._theValue._U64)
557 {
558 return true;
559 }
560 }
|
561 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
562 david 1.1.2.1 {
563 if(_theValue._S64 == x._theValue._R64)
564 {
565 return true;
566 }
567 }
568 break;
569 }
|
570 david 1.1.2.15 case CQLValue::Uint64_type:
571 if(x._valueType == CQLValue::Sint64_type)
|
572 david 1.1.2.1 {
573 if((Sint64)_theValue._U64 == x._theValue._S64)
574 {
575 return true;
576 }
577 }
|
578 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
579 david 1.1.2.1 {
580 if(_theValue._U64 == x._theValue._U64)
581 {
582 return true;
583 }
584 }
|
585 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
586 david 1.1.2.1 {
|
587 lucier 1.1.2.13 Real64 temp;
588 memcpy(&temp, &_theValue._U64, sizeof(temp));
589 if(temp == x._theValue._R64)
|
590 david 1.1.2.1 {
591 return true;
592 }
593 }
594 break;
|
595 david 1.1.2.15 case CQLValue::Real_type:
596 if(x._valueType == CQLValue::Sint64_type)
|
597 david 1.1.2.1 {
598 if(_theValue._R64 == x._theValue._S64)
599 {
600 return true;
601 }
602 }
|
603 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
604 david 1.1.2.1 {
|
605 lucier 1.1.2.13 Real64 temp;
606 memcpy(&temp, &x._theValue._U64, sizeof(temp));
607 if(_theValue._R64 == temp)
|
608 david 1.1.2.1 {
609 return true;
610 }
611 }
|
612 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
613 david 1.1.2.1 {
614 if(_theValue._R64 == x._theValue._R64)
615 {
616 return true;
617 }
618 }
619 break;
|
620 david 1.1.2.15 case CQLValue::String_type:
|
621 david 1.1.2.1 if(*_theValue._S == *x._theValue._S)
622 {
623 return true;
624 }
625 break;
|
626 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
627 david 1.1.2.1 if(*_theValue._DT == *x._theValue._DT)
628 {
629 return true;
630 }
631 break;
|
632 david 1.1.2.15 case CQLValue::CIMReference_type:
|
633 david 1.1.2.1 if(*_theValue._OP == *x._theValue._OP)
634 {
635 return true;
636 }
637 break;
|
638 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
639 david 1.1.2.1 if((*_theValue._IN).getPath() == (*x._theValue._IN).getPath())
640 {
641 return true;
642 }
643 break;
|
644 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
|
645 david 1.1.2.11 throw(Exception(String("")));
|
646 david 1.1.2.1 break;
647
648 default:
|
649 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator==")));
|
650 david 1.1.2.1 break;
651 }
652 return false;
653 }
654
655 //##ModelId=40FBFF9502BB
656 Boolean CQLValueRep::operator!=(const CQLValueRep& x)
657 {
658 if(!_validate(x))
659 {
|
660 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator!=")));
|
661 david 1.1.2.1 }
662
663 return !(this->operator==(x));
664 }
665
666
667 Boolean CQLValueRep::operator<=(const CQLValueRep& x)
668 {
|
669 david 1.1.2.6 if(!_validate(x))
|
670 david 1.1.2.1 {
|
671 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<=")));
|
672 david 1.1.2.1 }
|
673 lucier 1.1.2.13
674 if (this->operator<(x) || this->operator==(x))
675 return true;
|
676 david 1.1.2.1 return false;
677 }
678
679
680 Boolean CQLValueRep::operator>=(const CQLValueRep& x)
681 {
|
682 david 1.1.2.6 if(!_validate(x))
|
683 david 1.1.2.1 {
|
684 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator>=")));
|
685 david 1.1.2.6 }
|
686 lucier 1.1.2.13 return !(this->operator<(x));
|
687 david 1.1.2.1 }
688
689
690 Boolean CQLValueRep::operator<(const CQLValueRep& x)
691 {
692 if(!_validate(x))
693 {
|
694 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<")));
|
695 david 1.1.2.1 }
696
|
697 david 1.1.2.15 if(x._valueType == CQLValue::Null_type ||
698 _valueType == CQLValue::Null_type)
|
699 david 1.1.2.6 {
|
700 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<")));
|
701 david 1.1.2.6 }
702
|
703 david 1.1.2.1 switch(_valueType)
704 {
|
705 david 1.1.2.15 case CQLValue::Boolean_type:
|
706 david 1.1.2.1 {
|
707 david 1.1.2.15 if(x._valueType == CQLValue::Boolean_type)
|
708 david 1.1.2.1 {
709 if(_theValue._B < x._theValue._B)
710 {
711 return true;
712 }
713 }
714 break;
715 }
|
716 david 1.1.2.15 case CQLValue::Sint64_type:
717 if(x._valueType == CQLValue::Sint64_type)
|
718 david 1.1.2.1 {
719 if(_theValue._S64 < x._theValue._S64)
720 {
721 return true;
722 }
723 }
|
724 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
725 david 1.1.2.1 {
726 if(_theValue._S64 < (Sint64)x._theValue._U64)
727 {
728 return true;
729 }
730 }
|
731 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
732 david 1.1.2.1 {
733 if(_theValue._S64 < x._theValue._R64)
734 {
735 return true;
736 }
737 }
738 break;
|
739 david 1.1.2.15 case CQLValue::Uint64_type:
740 if(x._valueType == CQLValue::Sint64_type)
|
741 david 1.1.2.1 {
742 if((Sint64)_theValue._U64 < x._theValue._S64)
743 {
744 return true;
745 }
746 }
|
747 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
748 david 1.1.2.1 {
749 if(_theValue._U64 < x._theValue._U64)
750 {
751 return true;
752 }
753 }
|
754 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
755 david 1.1.2.1 {
|
756 lucier 1.1.2.13 Real64 temp;
757 memcpy(&temp, &_theValue._U64, sizeof(temp));
758 if(temp < x._theValue._R64)
|
759 david 1.1.2.1 {
760 return true;
761 }
762 }
763 break;
|
764 david 1.1.2.15 case CQLValue::Real_type:
765 if(x._valueType == CQLValue::Sint64_type)
|
766 david 1.1.2.1 {
767 if(_theValue._R64 < x._theValue._S64)
768 {
769 return true;
770 }
771 }
|
772 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
773 david 1.1.2.1 {
|
774 lucier 1.1.2.13 Real64 temp;
775 memcpy(&temp, &x._theValue._U64, sizeof(temp));
776 if(_theValue._R64 < temp)
|
777 david 1.1.2.1 {
778 return true;
779 }
780 }
|
781 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
782 david 1.1.2.1 {
783 if(_theValue._R64 < x._theValue._R64)
784 {
785 return true;
786 }
787 }
788 break;
|
789 david 1.1.2.15 case CQLValue::String_type:
|
790 david 1.1.2.1 if(*_theValue._S < *x._theValue._S)
791 {
792 return true;
793 }
794 break;
|
795 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
796 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<")));
|
797 david 1.1.2.1 break;
|
798 david 1.1.2.15 case CQLValue::CIMReference_type:
|
799 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<")));
|
800 david 1.1.2.1 break;
|
801 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
802 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<")));
|
803 david 1.1.2.1 break;
|
804 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
|
805 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<")));
|
806 david 1.1.2.1 break;
807
808 default:
|
809 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator<")));
|
810 david 1.1.2.1 break;
811 }
812 return false;
813 }
814
815
816 Boolean CQLValueRep::operator>(const CQLValueRep& x)
817 {
818 if(!_validate(x))
819 {
|
820 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator>")));
|
821 david 1.1.2.1 }
|
822 lucier 1.1.2.13 if (this->operator<(x) || this->operator==(x))
823 return false;
824 return true;
|
825 david 1.1.2.1 }
826
|
827 david 1.1.2.17
|
828 david 1.1.2.1 CQLValueRep CQLValueRep::operator+(const CQLValueRep x)
829 {
830
831 if(!_validate(x))
832 {
|
833 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator+")));
|
834 david 1.1.2.1 }
835
|
836 david 1.1.2.15 if(x._valueType == CQLValue::Null_type ||
837 _valueType == CQLValue::Null_type)
|
838 david 1.1.2.6 {
839 return CQLValueRep();
840 }
841
|
842 david 1.1.2.1 switch(_valueType)
843 {
|
844 david 1.1.2.15 case CQLValue::Boolean_type:
|
845 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator+")));
|
846 david 1.1.2.1 break;
|
847 david 1.1.2.15 case CQLValue::Sint64_type:
848 if(x._valueType == CQLValue::Sint64_type)
|
849 david 1.1.2.1 {
850 return CQLValueRep(_theValue._S64 + x._theValue._S64);
851 }
|
852 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
853 david 1.1.2.1 {
854 return CQLValueRep(_theValue._S64 + x._theValue._U64);
855 }
|
856 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
857 david 1.1.2.1 {
858 return CQLValueRep(_theValue._S64 + x._theValue._R64);
859 }
860 break;
|
861 david 1.1.2.15 case CQLValue::Uint64_type:
862 if(x._valueType == CQLValue::Sint64_type)
|
863 david 1.1.2.1 {
864 return CQLValueRep(_theValue._U64 + x._theValue._S64);
865 }
|
866 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
867 david 1.1.2.1 {
868 return CQLValueRep(_theValue._U64 + x._theValue._U64);
869 }
|
870 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
871 david 1.1.2.1 {
|
872 lucier 1.1.2.13 Real64 temp;
873 memcpy(&temp, &_theValue._U64, sizeof(temp));
874 return CQLValueRep(temp + x._theValue._R64);
|
875 david 1.1.2.1 }
876 break;
|
877 david 1.1.2.15 case CQLValue::Real_type:
878 if(x._valueType == CQLValue::Sint64_type)
|
879 david 1.1.2.1 {
880 return CQLValueRep(_theValue._R64 + x._theValue._S64);
881 }
|
882 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
883 david 1.1.2.1 {
|
884 lucier 1.1.2.13 Real64 temp;
885 memcpy(&temp, &x._theValue._U64, sizeof(temp));
886 return CQLValueRep(_theValue._R64 + temp);
|
887 david 1.1.2.1 }
|
888 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
889 david 1.1.2.1 {
890 return CQLValueRep(_theValue._R64 + x._theValue._R64);
891 }
892 break;
|
893 david 1.1.2.15 case CQLValue::String_type:
|
894 david 1.1.2.1 return CQLValueRep(*_theValue._S + *x._theValue._S);
895 break;
|
896 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
897 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator+")));
|
898 david 1.1.2.1 break;
|
899 david 1.1.2.15 case CQLValue::CIMReference_type:
|
900 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator+")));
|
901 david 1.1.2.1 break;
|
902 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
903 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator+")));
|
904 david 1.1.2.1 break;
|
905 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
|
906 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator+")));
|
907 david 1.1.2.1 break;
908
909 default:
|
910 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator+")));
|
911 david 1.1.2.1 break;
912 }
913
914 return x;
915 }
916
|
917 david 1.1.2.17 /*
|
918 david 1.1.2.1 CQLValueRep CQLValueRep::operator-(const CQLValueRep& x)
919 {
920 if(!_validate(x))
921 {
|
922 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
923 david 1.1.2.1 }
|
924 david 1.1.2.15 if(x._valueType == CQLValue::Null_type ||
925 _valueType == CQLValue::Null_type)
|
926 david 1.1.2.6 {
927 return CQLValueRep();
928 }
|
929 david 1.1.2.1
930 switch(_valueType)
931 {
|
932 david 1.1.2.15 case CQLValue::Boolean_type:
|
933 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
934 david 1.1.2.1 break;
|
935 david 1.1.2.15 case CQLValue::Sint64_type:
936 if(x._valueType == CQLValue::Sint64_type)
|
937 david 1.1.2.1 {
938 return CQLValueRep(_theValue._S64 - x._theValue._S64);
939 }
|
940 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
941 david 1.1.2.1 {
942 return CQLValueRep(_theValue._S64 - x._theValue._U64);
943 }
|
944 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
945 david 1.1.2.1 {
946 return CQLValueRep(_theValue._S64 - x._theValue._R64);
947 }
948 break;
|
949 david 1.1.2.15 case CQLValue::Uint64_type:
950 if(x._valueType == CQLValue::Sint64_type)
|
951 david 1.1.2.1 {
952 return CQLValueRep(_theValue._U64 - x._theValue._S64);
953 }
|
954 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
955 david 1.1.2.1 {
956 return CQLValueRep(_theValue._U64 - x._theValue._U64);
957 }
|
958 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
959 david 1.1.2.1 {
|
960 lucier 1.1.2.13 Real64 temp;
961 memcpy(&temp, &_theValue._U64, sizeof(temp));
962 return CQLValueRep(temp - x._theValue._R64);
|
963 david 1.1.2.1 }
964 break;
|
965 david 1.1.2.15 case CQLValue::Real_type:
966 if(x._valueType == CQLValue::Sint64_type)
|
967 david 1.1.2.1 {
968 return CQLValueRep(_theValue._R64 - x._theValue._S64);
969 }
|
970 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
971 david 1.1.2.1 {
|
972 lucier 1.1.2.13 Real64 temp;
973 memcpy(&temp, &x._theValue._U64, sizeof(temp));
974 return CQLValueRep(_theValue._R64 - temp);
|
975 david 1.1.2.1 }
|
976 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
977 david 1.1.2.1 {
978 return CQLValueRep(_theValue._R64 - x._theValue._R64);
979 }
980 break;
|
981 david 1.1.2.15 case CQLValue::String_type:
|
982 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
983 david 1.1.2.1 break;
|
984 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
985 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
986 david 1.1.2.1 break;
|
987 david 1.1.2.15 case CQLValue::CIMReference_type:
|
988 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
989 david 1.1.2.1 break;
|
990 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
991 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
992 david 1.1.2.1 break;
|
993 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
|
994 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
995 david 1.1.2.1 break;
996
997 default:
|
998 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator-")));
|
999 david 1.1.2.1 break;
1000 }
|
1001 david 1.1.2.16
|
1002 david 1.1.2.1 return x;
1003 }
1004
1005
1006 CQLValueRep CQLValueRep::operator*(const CQLValueRep& x)
1007 {
1008
1009 if(!_validate(x))
1010 {
|
1011 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1012 david 1.1.2.1 }
1013
|
1014 david 1.1.2.15 if(x._valueType == CQLValue::Null_type ||
1015 _valueType == CQLValue::Null_type)
|
1016 david 1.1.2.6 {
1017 return CQLValueRep();
1018 }
|
1019 david 1.1.2.1
1020 switch(_valueType)
1021 {
|
1022 david 1.1.2.15 case CQLValue::Boolean_type:
|
1023 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1024 david 1.1.2.1 break;
|
1025 david 1.1.2.15 case CQLValue::Sint64_type:
1026 if(x._valueType == CQLValue::Sint64_type)
|
1027 david 1.1.2.1 {
1028 return CQLValueRep(_theValue._S64 * x._theValue._S64);
1029 }
|
1030 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
1031 david 1.1.2.1 {
1032 return CQLValueRep(_theValue._S64 * x._theValue._U64);
1033 }
|
1034 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
1035 david 1.1.2.1 {
1036 return CQLValueRep(_theValue._S64 * x._theValue._R64);
1037 }
1038 break;
|
1039 david 1.1.2.15 case CQLValue::Uint64_type:
1040 if(x._valueType == CQLValue::Sint64_type)
|
1041 david 1.1.2.1 {
1042 return CQLValueRep(_theValue._U64 * x._theValue._S64);
1043 }
|
1044 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
1045 david 1.1.2.1 {
1046 return CQLValueRep(_theValue._U64 * x._theValue._U64);
1047 }
|
1048 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
1049 david 1.1.2.1 {
|
1050 lucier 1.1.2.13 Real64 temp;
1051 memcpy(&temp, &_theValue._U64, sizeof(temp));
1052 return CQLValueRep(temp * x._theValue._R64);
|
1053 david 1.1.2.1 }
1054 break;
|
1055 david 1.1.2.15 case CQLValue::Real_type:
1056 if(x._valueType == CQLValue::Sint64_type)
|
1057 david 1.1.2.1 {
1058 return CQLValueRep(_theValue._R64 * x._theValue._S64);
1059 }
|
1060 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
1061 david 1.1.2.1 {
|
1062 lucier 1.1.2.13 Real64 temp;
1063 memcpy(&temp, &x._theValue._U64, sizeof(temp));
1064 return CQLValueRep(_theValue._R64 * temp);
|
1065 david 1.1.2.1 }
|
1066 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
1067 david 1.1.2.1 {
1068 return CQLValueRep(_theValue._R64 * x._theValue._R64);
1069 }
1070 break;
|
1071 david 1.1.2.15 case CQLValue::String_type:
|
1072 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1073 david 1.1.2.1 break;
|
1074 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
1075 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1076 david 1.1.2.1 break;
|
1077 david 1.1.2.15 case CQLValue::CIMReference_type:
|
1078 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1079 david 1.1.2.1 break;
|
1080 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
1081 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1082 david 1.1.2.1 break;
|
1083 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
|
1084 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1085 david 1.1.2.1 break;
1086
1087 default:
|
1088 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator*")));
|
1089 david 1.1.2.1 break;
1090 }
|
1091 david 1.1.2.16
|
1092 david 1.1.2.1 return x;
1093 }
1094
1095
1096 CQLValueRep CQLValueRep::operator/(const CQLValueRep& x)
1097 {
1098 if(!_validate(x) ||
1099 x._theValue._U64 == 0)
1100 {
|
1101 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1102 david 1.1.2.1 }
|
1103 david 1.1.2.6
|
1104 david 1.1.2.15 if(x._valueType == CQLValue::Null_type ||
1105 _valueType == CQLValue::Null_type)
|
1106 david 1.1.2.6 {
1107 return CQLValueRep();
1108 }
1109
|
1110 david 1.1.2.1 switch(_valueType)
1111 {
|
1112 david 1.1.2.15 case CQLValue::Boolean_type:
|
1113 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1114 david 1.1.2.1 break;
|
1115 david 1.1.2.15 case CQLValue::Sint64_type:
1116 if(x._valueType == CQLValue::Sint64_type)
|
1117 david 1.1.2.1 {
1118 return CQLValueRep(_theValue._S64 / x._theValue._S64);
1119 }
|
1120 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
1121 david 1.1.2.1 {
1122 return CQLValueRep(_theValue._S64 / x._theValue._U64);
1123 }
|
1124 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
1125 david 1.1.2.1 {
1126 return CQLValueRep(_theValue._S64 / x._theValue._R64);
1127 }
1128 break;
|
1129 david 1.1.2.15 case CQLValue::Uint64_type:
1130 if(x._valueType == CQLValue::Sint64_type)
|
1131 david 1.1.2.1 {
1132 return CQLValueRep(_theValue._U64 / x._theValue._S64);
1133 }
|
1134 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
1135 david 1.1.2.1 {
1136 return CQLValueRep(_theValue._U64 / x._theValue._U64);
1137 }
|
1138 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
1139 david 1.1.2.1 {
|
1140 lucier 1.1.2.13 Real64 temp;
1141 memcpy(&temp, &_theValue._U64, sizeof(temp));
1142 return CQLValueRep(temp / x._theValue._R64);
|
1143 david 1.1.2.1 }
1144 break;
|
1145 david 1.1.2.15 case CQLValue::Real_type:
1146 if(x._valueType == CQLValue::Sint64_type)
|
1147 david 1.1.2.1 {
1148 return CQLValueRep(_theValue._R64 / x._theValue._S64);
1149 }
|
1150 david 1.1.2.15 else if(x._valueType == CQLValue::Uint64_type)
|
1151 david 1.1.2.1 {
|
1152 lucier 1.1.2.13 Real64 temp;
1153 memcpy(&temp, &x._theValue._U64, sizeof(temp));
1154 return CQLValueRep(_theValue._R64 / temp);
|
1155 david 1.1.2.1 }
|
1156 david 1.1.2.15 else if(x._valueType == CQLValue::Real_type)
|
1157 david 1.1.2.1 {
1158 return CQLValueRep(_theValue._R64 / x._theValue._R64);
1159 }
1160 break;
|
1161 david 1.1.2.15 case CQLValue::String_type:
|
1162 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1163 david 1.1.2.1 break;
|
1164 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
1165 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1166 david 1.1.2.1 break;
|
1167 david 1.1.2.15 case CQLValue::CIMReference_type:
|
1168 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1169 david 1.1.2.1 break;
|
1170 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
1171 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1172 david 1.1.2.1 break;
|
1173 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
|
1174 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1175 david 1.1.2.1 break;
1176
1177 default:
|
1178 david 1.1.2.12 throw(Exception(String("CQLValueRep::operator/")));
|
1179 david 1.1.2.1 break;
1180 }
|
1181 david 1.1.2.16
|
1182 david 1.1.2.1 return x;
1183 }
|
1184 david 1.1.2.16 */
|
1185 david 1.1.2.1 //##ModelId=40FC3F6F0302
|
1186 david 1.1.2.15 CQLValue::CQLValueType CQLValueRep::getValueType()
|
1187 david 1.1.2.1 {
1188 return _valueType;
1189 }
1190
1191
1192 void CQLValueRep::setNull()
1193 {
|
1194 david 1.1.2.15 _valueType = CQLValue::Null_type;
|
1195 david 1.1.2.1 _isResolved = true;
1196 }
1197
1198
1199 Boolean CQLValueRep::isResolved()
1200 {
1201 return _isResolved;
1202 }
1203
1204
1205 Boolean CQLValueRep::isNull()
1206 {
|
1207 david 1.1.2.15 if(_valueType == CQLValue::Null_type)
|
1208 david 1.1.2.1 {
1209 return true;
1210 }
1211 return false;
1212 }
1213
1214
1215 Boolean CQLValueRep::isa(const CQLValueRep& inVal, QueryContext& QueryCtx)
1216 {
1217 if(!_isResolved ||
1218 !inVal._isResolved ||
|
1219 david 1.1.2.15 _valueType != CQLValue::CIMInstance_type ||
1220 inVal._valueType != CQLValue::String_type)
|
1221 david 1.1.2.1 {
|
1222 david 1.1.2.12 throw(Exception(String("CQLValueRep::isa")));
|
1223 david 1.1.2.1 }
1224
1225 CIMName className;
1226 CIMClass classObj;
1227
1228 className = this->_theValue._IN->getClassName();
1229
1230 while(!className.isNull())
1231 {
1232 if(className == CIMName(*inVal._theValue._S))
1233 {
1234 return true;
1235 }
1236
1237 classObj = QueryCtx.getClass(className);
1238 className = classObj.getSuperClassName();
1239 }
1240
1241 return false;
1242 }
1243
1244 david 1.1.2.1
1245 Boolean CQLValueRep::like(const CQLValueRep& inVal)
1246 {
|
1247 david 1.1.2.15 if( _valueType != CQLValue::String_type ||
1248 inVal._valueType != CQLValue::String_type)
|
1249 david 1.1.2.1 {
|
1250 david 1.1.2.12 throw(Exception(String("CQLValueRep::like")));
|
1251 david 1.1.2.1 }
1252
1253 // Poughkepsie is doing this, Dan Gorey.
1254 return false;
1255 }
1256
1257 void CQLValueRep::invert()
1258 {
1259 switch(_valueType)
1260 {
|
1261 david 1.1.2.15 case CQLValue::Sint64_type:
|
1262 david 1.1.2.1 _theValue._S64 = -1 * _theValue._S64;
1263 break;
|
1264 david 1.1.2.15 case CQLValue::Real_type:
|
1265 david 1.1.2.1 _theValue._R64 = -1 * _theValue._R64;
1266 break;
|
1267 david 1.1.2.15 case CQLValue::Boolean_type:
|
1268 david 1.1.2.1 _theValue._B = !_theValue._B;
1269 break;
1270 default:
1271 break;
1272 }
1273 }
1274
1275 CQLChainedIdentifier CQLValueRep::getChainedIdentifier()const
1276 {
1277 return _CQLChainId;
1278 }
1279
1280 Uint64 CQLValueRep::getUint()const
1281 {
|
1282 david 1.1.2.15 if(_valueType != CQLValue::Uint64_type)
|
1283 david 1.1.2.1 {
|
1284 david 1.1.2.12 throw(Exception(String("CQLValueRep::getUint")));
|
1285 david 1.1.2.1 }
1286 return _theValue._U64;
1287 }
1288
1289 Boolean CQLValueRep::getBool()const
1290 {
|
1291 david 1.1.2.15 if(_valueType != CQLValue::Boolean_type)
|
1292 david 1.1.2.1 {
|
1293 david 1.1.2.12 throw(Exception(String("CQLValueRep::getBool")));
|
1294 david 1.1.2.1 }
1295 return _theValue._B;
1296 }
1297
1298 Sint64 CQLValueRep::getSint()const
1299 {
|
1300 david 1.1.2.15 if(_valueType != CQLValue::Sint64_type)
|
1301 david 1.1.2.1 {
|
1302 david 1.1.2.12 throw(Exception(String("CQLValueRep::getSint")));
|
1303 david 1.1.2.1 }
1304 return _theValue._S64;
1305 }
1306
1307 Real64 CQLValueRep::getReal()const
1308 {
|
1309 david 1.1.2.15 if(_valueType != CQLValue::Real_type)
|
1310 david 1.1.2.1 {
|
1311 david 1.1.2.12 throw(Exception(String("CQLValueRep::getReal")));
|
1312 david 1.1.2.1 }
1313 return _theValue._R64;
1314 }
1315
1316 String CQLValueRep::getString()const
1317 {
|
1318 david 1.1.2.15 if(_valueType != CQLValue::String_type)
|
1319 david 1.1.2.1 {
|
1320 david 1.1.2.12 throw(Exception(String("CQLValueRep::getString")));
|
1321 david 1.1.2.1 }
1322 return *_theValue._S;
1323 }
1324
1325 CIMDateTime CQLValueRep::getDateTime()const
1326 {
|
1327 david 1.1.2.15 if(_valueType != CQLValue::CIMDateTime_type)
|
1328 david 1.1.2.1 {
|
1329 david 1.1.2.12 throw(Exception(String("CQLValueRep::getDateTime")));
|
1330 david 1.1.2.1 }
1331
1332 return *_theValue._DT;
1333 }
1334
1335 CIMObjectPath CQLValueRep::getReference()const
1336 {
|
1337 david 1.1.2.15 if(_valueType != CQLValue::CIMReference_type)
|
1338 david 1.1.2.1 {
|
1339 david 1.1.2.12 throw(Exception(String("CQLValueRep::getReference")));
|
1340 david 1.1.2.1 }
1341 return *_theValue._OP;
1342 }
1343
1344 CIMInstance CQLValueRep::getInstance()const
1345 {
|
1346 david 1.1.2.15 if(_valueType != CQLValue::CIMInstance_type)
|
1347 david 1.1.2.1 {
|
1348 david 1.1.2.12 throw(Exception(String("CQLValueRep::getInstance")));
|
1349 david 1.1.2.1 }
1350 return *_theValue._IN;
1351 }
1352
1353 CIMClass CQLValueRep::getClass()const
1354 {
|
1355 david 1.1.2.15 if(_valueType != CQLValue::CIMClass_type)
|
1356 david 1.1.2.1 {
|
1357 david 1.1.2.12 throw(Exception(String("CQLValueRep::getClass")));
|
1358 david 1.1.2.1 }
1359
1360 return *_theValue._CL;
1361 }
1362
1363 String CQLValueRep::toString()const
1364 {
1365 switch(_valueType)
1366 {
|
1367 david 1.1.2.15 case CQLValue::Boolean_type:
|
1368 david 1.1.2.1 {
1369 return (_theValue._B ? String("TRUE") : String("FALSE"));
1370 break;
1371 }
|
1372 david 1.1.2.15 case CQLValue::Sint64_type:
|
1373 david 1.1.2.1 {
1374 char buffer[32]; // Should need 21 chars max
1375 sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "d", _theValue._S64);
1376 return String(buffer);
1377 break;
1378 }
|
1379 david 1.1.2.15 case CQLValue::Uint64_type:
|
1380 david 1.1.2.1 {
1381 char buffer[32]; // Should need 21 chars max
1382 sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", _theValue._U64);
1383 return String(buffer);
1384 break;
1385 }
|
1386 david 1.1.2.15 case CQLValue::Real_type:
|
1387 david 1.1.2.1 {
1388 char buffer[128];
1389 sprintf(buffer, "%.6e", _theValue._R64);
1390 return String(buffer);
1391 break;
1392 }
|
1393 david 1.1.2.15 case CQLValue::String_type:
|
1394 david 1.1.2.1 return *_theValue._S;
1395 break;
|
1396 david 1.1.2.15 case CQLValue::CIMDateTime_type:
|
1397 david 1.1.2.1 return _theValue._DT->toString();
1398 break;
|
1399 david 1.1.2.15 case CQLValue::CIMReference_type:
|
1400 david 1.1.2.1 return _theValue._OP->toString();
1401 break;
|
1402 david 1.1.2.15 case CQLValue::CIMInstance_type:
|
1403 david 1.1.2.1 return _theValue._IN->getPath().toString();
1404 break;
|
1405 david 1.1.2.15 case CQLValue::CIMClass_type:
|
1406 david 1.1.2.1 return _theValue._CL->getPath().toString();
1407 break;
|
1408 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
|
1409 david 1.1.2.1 return _CQLChainId.toString();
1410 break;
1411 default:
1412 break;
1413 }
1414 return String();
1415 }
1416
1417
1418
1419 Boolean CQLValueRep::_validate(const CQLValueRep& x)
1420 {
1421 switch(_valueType)
1422 {
|
1423 david 1.1.2.15 case CQLValue::Boolean_type:
1424 if(x._valueType != CQLValue::Boolean_type)
|
1425 david 1.1.2.1 {
1426 return false;
1427 }
1428 break;
|
1429 david 1.1.2.15 case CQLValue::Sint64_type:
1430 case CQLValue::Uint64_type:
1431 case CQLValue::Real_type:
1432 if(x._valueType != CQLValue::Sint64_type &&
1433 x._valueType != CQLValue::Uint64_type &&
1434 x._valueType != CQLValue::Real_type)
|
1435 david 1.1.2.1 {
1436 return false;
1437 }
1438 break;
|
1439 david 1.1.2.15 case CQLValue::String_type:
1440 if(x._valueType != CQLValue::String_type)
|
1441 david 1.1.2.1 {
1442 return false;
1443 }
1444 break;
|
1445 david 1.1.2.15 case CQLValue::CIMDateTime_type:
1446 if(x._valueType != CQLValue::CIMDateTime_type)
|
1447 david 1.1.2.1 {
1448 return false;
1449 }
1450 break;
|
1451 david 1.1.2.15 case CQLValue::CIMReference_type:
1452 if(x._valueType != CQLValue::CIMReference_type)
|
1453 david 1.1.2.1 {
1454 return false;
1455 }
1456 break;
|
1457 david 1.1.2.15 case CQLValue::CIMInstance_type:
1458 if(x._valueType != CQLValue::CIMInstance_type)
|
1459 david 1.1.2.1 {
1460 return false;
1461 }
1462 break;
|
1463 david 1.1.2.15 case CQLValue::CQLIdentifier_type:
1464 if(x._valueType != CQLValue::CQLIdentifier_type)
|
1465 david 1.1.2.1 {
1466 return false;
1467 }
1468 break;
1469
1470 default:
|
1471 david 1.1.2.12 throw(Exception(String("CQLValueRep::_validate")));
|
1472 david 1.1.2.1 break;
1473 }
1474 return true;
1475 }
1476
|
1477 david 1.1.2.15 Boolean CQLValueRep::_areClassesInline(const CIMClass& c1,const CIMClass& c2,QueryContext& QC)
|
1478 david 1.1.2.1 {
1479 CIMName superClass;
1480 CIMName prevClass;
1481
1482 superClass = c1.getClassName();
1483 while(!(superClass == prevClass))
1484 {
1485 prevClass = superClass;
1486 if(superClass == c2.getClassName())
1487 {
1488 return true;
1489 }
1490 superClass = c1.getSuperClassName();
1491 }
1492 prevClass = CIMName();
1493 superClass = c2.getClassName();
1494 while(!(superClass == prevClass))
1495 {
1496 prevClass = superClass;
1497 if(superClass == c1.getClassName())
1498 {
1499 david 1.1.2.1 return true;
1500 }
1501 superClass = c2.getSuperClassName();
1502 }
1503
1504 return false;
1505 }
1506
1507 void CQLValueRep::_setValue(CIMValue cv,Uint64 index)
1508 {
1509 CIMValue tmp;
1510 if(cv.isArray())
1511 {
1512 switch(cv.getType())
1513 {
1514 case CIMTYPE_BOOLEAN:
1515 {
1516 Array<Boolean> _bool;
1517 cv.get(_bool);
1518 _theValue._B = _bool[index];
|
1519 david 1.1.2.15 _valueType = CQLValue::Boolean_type;
|
1520 david 1.1.2.1 break;
1521 }
1522 case CIMTYPE_UINT8:
1523 {
1524 Array<Uint8> _uint;
1525 cv.get(_uint);
1526 _theValue._U64 = _uint[index];
|
1527 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1528 david 1.1.2.1 break;
1529 }
1530 case CIMTYPE_UINT16:
1531 {
1532 Array<Uint16> _uint;
1533 cv.get(_uint);
1534 _theValue._U64 = _uint[index];
|
1535 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1536 david 1.1.2.1 break;
1537 }
1538 case CIMTYPE_UINT32:
1539 {
1540 Array<Uint32> _uint;
1541 cv.get(_uint);
1542 _theValue._U64 = _uint[index];
|
1543 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1544 david 1.1.2.1 break;
1545 }
1546 case CIMTYPE_UINT64:
1547 {
1548 Array<Uint64> _uint;
1549 cv.get(_uint);
1550 _theValue._U64 = _uint[index];
|
1551 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1552 david 1.1.2.1 break;
1553 }
1554 case CIMTYPE_SINT8:
1555 {
1556 Array<Sint8> _sint;
1557 cv.get(_sint);
1558 _theValue._S64 = _sint[index];
|
1559 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1560 david 1.1.2.1 break;
1561 }
1562 case CIMTYPE_SINT16:
1563 {
1564 Array<Sint16> _sint;
1565 cv.get(_sint);
1566 _theValue._S64 = _sint[index];
|
1567 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1568 david 1.1.2.1 break;
1569 }
1570 case CIMTYPE_SINT32:
1571 {
1572 Array<Sint32> _sint;
1573 cv.get(_sint);
1574 _theValue._S64 = _sint[index];
|
1575 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1576 david 1.1.2.1 break;
1577 }
1578 case CIMTYPE_SINT64:
1579 {
1580 Array<Sint64> _sint;
1581 cv.get(_sint);
1582 _theValue._S64 = _sint[index];
|
1583 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1584 david 1.1.2.1 break;
1585 }
1586
1587 case CIMTYPE_REAL32:
1588 {
1589 Array<Real32> _real;
1590 cv.get(_real);
1591 _theValue._R64 = _real[index];
|
1592 david 1.1.2.15 _valueType = CQLValue::Real_type;
|
1593 david 1.1.2.1 break;
1594 }
1595 case CIMTYPE_REAL64:
1596 {
1597 Array<Real64> _real;
1598 cv.get(_real);
1599 _theValue._R64 = _real[index];
|
1600 david 1.1.2.15 _valueType = CQLValue::Real_type;
|
1601 david 1.1.2.1 break;
1602 }
1603 case CIMTYPE_CHAR16:
1604 {
1605 Array<Char16> _str;
1606 cv.get(_str);
1607 _theValue._S = new String(&_str[index]);
|
1608 david 1.1.2.15 _valueType = CQLValue::String_type;
|
1609 david 1.1.2.1 break;
1610 }
1611 case CIMTYPE_STRING:
1612 {
1613 Array<String> _str;
1614 cv.get(_str);
1615 _theValue._S = new String(_str[index]);
|
1616 david 1.1.2.15 _valueType = CQLValue::String_type;
|
1617 david 1.1.2.1 break;
1618 }
1619 case CIMTYPE_DATETIME:
1620 {
1621 Array<CIMDateTime> _date;
1622 cv.get(_date);
1623 _theValue._DT = new CIMDateTime(_date[index]);
|
1624 david 1.1.2.15 _valueType = CQLValue::CIMDateTime_type;
|
1625 david 1.1.2.1 break;
1626 }
1627 case CIMTYPE_REFERENCE:
1628 {
1629 Array<CIMObjectPath> _path;
1630 cv.get(_path);
1631 _theValue._OP = new CIMObjectPath(_path[index]);
|
1632 david 1.1.2.15 _valueType = CQLValue::CIMReference_type;
|
1633 david 1.1.2.1 break;
1634 }
1635 default:
|
1636 david 1.1.2.12 throw(Exception(String("CQLValueRep::_setValue")));
|
1637 david 1.1.2.1 } // switch statement
1638
1639 }
1640 else
1641 {
1642 switch(cv.getType())
1643 {
1644 case CIMTYPE_BOOLEAN:
1645 {
1646 Boolean _bool;
1647 cv.get(_bool);
1648 _theValue._B = _bool;
|
1649 david 1.1.2.15 _valueType = CQLValue::Boolean_type;
|
1650 david 1.1.2.1 break;
1651 }
1652 case CIMTYPE_UINT8:
1653 {
1654 Uint8 _uint;
1655 cv.get(_uint);
1656 _theValue._U64 = _uint;
|
1657 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1658 david 1.1.2.1 break;
1659 }
1660 case CIMTYPE_UINT16:
1661 {
1662 Uint16 _uint;
1663 cv.get(_uint);
1664 _theValue._U64 = _uint;
|
1665 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1666 david 1.1.2.1 break;
1667 }
1668 case CIMTYPE_UINT32:
1669 {
1670 Uint32 _uint;
1671 cv.get(_uint);
1672 _theValue._U64 = _uint;
|
1673 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1674 david 1.1.2.1 break;
1675 }
1676 case CIMTYPE_UINT64:
1677 {
1678 Uint64 _uint;
1679 cv.get(_uint);
1680 _theValue._U64 = _uint;
|
1681 david 1.1.2.15 _valueType = CQLValue::Uint64_type;
|
1682 david 1.1.2.1 break;
1683 }
1684 case CIMTYPE_SINT8:
1685 {
1686 Sint8 _sint;
1687 cv.get(_sint);
1688 _theValue._S64 = _sint;
|
1689 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1690 david 1.1.2.1 break;
1691 }
1692 case CIMTYPE_SINT16:
1693 {
1694 Sint16 _sint;
1695 cv.get(_sint);
1696 _theValue._S64 = _sint;
|
1697 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1698 david 1.1.2.1 break;
1699 }
1700 case CIMTYPE_SINT32:
1701
1702 {
1703 Sint32 _sint;
1704 cv.get(_sint);
1705 _theValue._S64 = _sint;
|
1706 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1707 david 1.1.2.1 break;
1708 }
1709 case CIMTYPE_SINT64:
1710 {
1711 Sint64 _sint;
1712 cv.get(_sint);
1713 _theValue._S64 = _sint;
|
1714 david 1.1.2.15 _valueType = CQLValue::Sint64_type;
|
1715 david 1.1.2.1 break;
1716 }
1717 case CIMTYPE_REAL32:
1718 {
1719 Real32 _real;
1720 cv.get(_real);
1721 _theValue._R64 = _real;
|
1722 david 1.1.2.15 _valueType = CQLValue::Real_type;
|
1723 david 1.1.2.1 break;
1724 }
1725 case CIMTYPE_REAL64:
1726 {
1727 Real64 _real;
1728 cv.get(_real);
1729 _theValue._R64 = _real;
|
1730 david 1.1.2.15 _valueType = CQLValue::Real_type;
|
1731 david 1.1.2.1 break;
1732 }
1733 case CIMTYPE_CHAR16:
1734 {
1735 Char16 _str;
1736 cv.get(_str);
1737 _theValue._S = new String(&_str);
|
1738 david 1.1.2.15 _valueType = CQLValue::String_type;
|
1739 david 1.1.2.1 break;
1740 }
1741 case CIMTYPE_STRING:
1742 {
1743 String _str;
1744 cv.get(_str);
1745 _theValue._S = new String(_str);
|
1746 david 1.1.2.15 _valueType = CQLValue::String_type;
|
1747 david 1.1.2.1 break;
1748 }
1749 case CIMTYPE_DATETIME:
1750 {
1751 CIMDateTime _date;
1752 cv.get(_date);
1753 _theValue._DT = new CIMDateTime(_date);
|
1754 david 1.1.2.15 _valueType = CQLValue::CIMDateTime_type;
|
1755 david 1.1.2.1 break;
1756 }
1757 case CIMTYPE_REFERENCE:
1758 {
1759 CIMObjectPath _path;
1760 cv.get(_path);
1761 _theValue._OP = new CIMObjectPath(_path);
|
1762 david 1.1.2.15 _valueType = CQLValue::CIMReference_type;
|
1763 david 1.1.2.1 break;
1764 }
1765 default:
|
1766 david 1.1.2.12 throw(Exception(String("CQLValueRep::setValue")));
|
1767 david 1.1.2.1 } // switch statement
1768 }
1769 _isResolved = true;
1770 return;
1771 }
1772
|
1773 david 1.1.2.8 void CQLValueRep::applyContext(QueryContext& _ctx,
1774 CQLChainedIdentifier& inCid)
|
1775 lucier 1.1.2.13 {
|
1776 david 1.1.2.8 if(inCid.size() != 0 && _CQLChainId.size() == 1)
1777 {
|
1778 david 1.1.2.12
|
1779 david 1.1.2.8 _CQLChainId[0].setName(inCid[inCid.size()-1].getName());
|
1780 david 1.1.2.12 _CQLChainId[0].applyScope(inCid[inCid.size()-1].getScope());
1781
|
1782 david 1.1.2.8 for(Sint32 i = inCid.size()-2; i >= 0; --i)
1783 {
1784 _CQLChainId.prepend(inCid[i]);
1785 }
|
1786 david 1.1.2.15
1787 CIMInstance temp;
1788 resolve(temp,_ctx);
|
1789 david 1.1.2.8 }
1790 else
1791 {
|
1792 david 1.1.2.12 _CQLChainId.applyContext(_ctx);
|
1793 david 1.1.2.8 }
|
1794 humberto 1.1.2.2 }
1795
|
1796 david 1.1.2.17 void CQLValueRep::_resolveSymbolicConstant(const QueryContext& inQueryCtx)
|
1797 david 1.1.2.9 {
1798 Array<String> valueMapArray; // Value Map Qualifier for property
1799 Array<String> valuesArray; // Values Qualifier for property
1800 CIMName className;
1801 CQLIdentifier lid = _CQLChainId.getLastIdentifier();
1802 CIMClass QueryClass;
1803 CIMValue valueMap; // CIMValue for Value Map Qualifiers
1804 CIMValue values; // CIMValue for Values Qualifiers
1805 Boolean matchFound = false; // Indicator for match Qualifier
1806 Uint32 matchIndex; // Placeholder for matched Qualifier
1807
1808 if(lid.isScoped())
1809 {
1810 className = lid.getScope();
1811 }
1812 else
1813 {
1814 className = _CQLChainId[0].getName();
1815 }
1816
1817 QueryClass = inQueryCtx.getClass(className);
1818 david 1.1.2.9
1819 Uint32 propertyIndex =
1820 QueryClass.findProperty(lid.getName());
1821
1822 if(propertyIndex == PEG_NOT_FOUND)
1823 {
|
1824 david 1.1.2.12 throw(Exception(String("CQLValueRep::_resolveSymbolicConstant")));
|
1825 david 1.1.2.9 }
1826
1827 CIMProperty queryPropObj = QueryClass.getProperty(propertyIndex);
1828
1829 // We have a symbolic constant (ex. propName#OK)
1830 // We need to retrieve the ValueMap and Values Qualifiers for
1831 // the property if the exist.
1832 Uint32 qualIndex = queryPropObj.findQualifier(CIMName("ValueMap"));
1833
1834 if(qualIndex == PEG_NOT_FOUND)
1835 {
1836 // This property can not be processed with a symbolic constant.
|
1837 david 1.1.2.12 throw(Exception(String("CQLValueRep::_resolveSymbolicConstant")));
|
1838 david 1.1.2.9 }
1839
1840 valueMap = queryPropObj.getQualifier(qualIndex).getValue();
1841 qualIndex = queryPropObj.findQualifier(CIMName("Values"));
1842
1843 if(qualIndex == PEG_NOT_FOUND)
1844 {
1845 // This property does not have a Values Qualifier,
1846 // therefore the valueMap must be the list of symbolic constants.
1847
1848 valueMap.get(valueMapArray);
1849
1850 // We will loop through the list of Symbolic constants to
1851 // determine if we have a match with the Symbolic constant
1852 // defined in the CQLIdentifier.
1853 for(Uint32 i = 0; i < valueMapArray.size(); ++i)
1854 {
1855 if(valueMapArray[i] ==
1856 lid.getSymbolicConstantName())
1857 {
1858 matchFound = true;
1859 david 1.1.2.9 matchIndex = i;
1860 break;
1861 }
1862 }
1863 if(matchFound == false)
1864 {
1865 // The symbolic constant provided is not valid
1866 // for this property.
|
1867 david 1.1.2.12 throw(Exception(String("CQLValueRep::_resolveSymbolicConstant")));
|
1868 david 1.1.2.9 }
1869
1870 // The symbolic constant defined in the CQLIdentifier is
1871 // valid for this property. Now we need to set the value.
1872 // Set primitive
1873 _setValue(CIMValue(lid.getSymbolicConstantName()));
1874 return;
1875 }
1876 else
1877 {
1878 // The qualifier Values is defined for the property.
1879 // valueMap must be a list of #'s.
1880
1881 values = queryPropObj.getQualifier(qualIndex).getValue();
1882
1883 valueMap.get(valueMapArray);
1884 values.get(valuesArray);
1885
1886 // We will loop through the list of Symbolic constants to
1887 // determine if we have a match with the Symbolic constant
1888 // defined in the CQLIdentifier.
1889 david 1.1.2.9 for(Uint32 i = 0; i < valuesArray.size(); ++i)
1890 {
1891 if(valuesArray[i] == lid.getSymbolicConstantName())
1892 {
1893 matchFound = true;
1894 matchIndex = i;
1895 break;
1896 }
1897 }
1898 if(matchFound == false)
1899 {
1900 // The symbolic constant provided is not valid
1901 // for this property.
|
1902 david 1.1.2.12 throw(Exception(String("CQLValueRep::_resolveSymbolicConstant")));
|
1903 david 1.1.2.9 }
1904
1905 CString cStr = valueMapArray[matchIndex].getCString();
1906 char *endP;
1907
1908 // Set Primitive
1909 _setValue(CIMValue(Uint64(strtoul((const char*)cStr,&endP,10))));
1910 return;
1911 }
1912 }
1913
|
1914 david 1.1.2.1 PEGASUS_NAMESPACE_END
|