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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2