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

Diff for /pegasus/src/Pegasus/CQL/CQLValueRep.cpp between version 1.1.2.22 and 1.1.2.23

version 1.1.2.22, 2004/10/31 16:02:00 version 1.1.2.23, 2004/11/08 15:30:03
Line 56 
Line 56 
 CQLValueRep::CQLValueRep() CQLValueRep::CQLValueRep()
   :_valueType(CQLValue::Null_type)   :_valueType(CQLValue::Null_type)
 { {
   _theValue._S = NULL;  
 } }
   
 CQLValueRep::~CQLValueRep() CQLValueRep::~CQLValueRep()
 { {
    switch(_valueType)  
    {  
       case CQLValue::String_type:  
       {  
          if(_theValue._S != NULL){  
             delete _theValue._S;  
         }  
          _theValue._S = NULL;  
          break;  
       }  
       case CQLValue::CIMDateTime_type:  
        {  
          if(_theValue._DT != NULL)  
             delete _theValue._DT;  
          _theValue._DT = NULL;  
          break;  
       }  
       case CQLValue::CIMReference_type:  
       {  
          if(_theValue._OP != NULL)  
             delete _theValue._OP;  
          _theValue._OP = NULL;  
          break;  
       }  
       case CQLValue::CIMInstance_type:  
       {  
          if(_theValue._IN != NULL)  
             delete _theValue._IN;  
          _theValue._IN = NULL;  
          break;  
       }  
       case CQLValue::CIMClass_type:  
       {  
          if(_theValue._CL != NULL)  
             delete _theValue._CL;  
          _theValue._CL = NULL;  
          break;  
       }  
       default:  
          break;  
    }  
 } }
  
  
 CQLValueRep::CQLValueRep(const CQLValueRep& val) CQLValueRep::CQLValueRep(const CQLValueRep& val)
 { {
    switch(val._valueType)    _theValue = val._theValue;
    {  
       case CQLValue::Boolean_type:  
       {  
          _theValue._B = val._theValue._B;  
          break;  
       }  
       case CQLValue::Sint64_type:  
       {  
          _theValue._S64 = val._theValue._S64;  
          break;  
       }  
       case CQLValue::Uint64_type:  
       {  
          _theValue._U64 = val._theValue._U64;  
          break;  
       }  
       case CQLValue::Real_type:  
       {  
          _theValue._R64 = val._theValue._R64;  
          break;  
       }  
       case CQLValue::String_type:  
       {  
          _theValue._S = new String(*val._theValue._S);  
          break;  
       }  
       case CQLValue::CIMDateTime_type:  
       {  
          _theValue._DT = new CIMDateTime(*val._theValue._DT);  
          break;  
       }  
       case CQLValue::CIMReference_type:  
       {  
          _theValue._OP = new CIMObjectPath(*val._theValue._OP);  
          break;  
       }  
       case CQLValue::CIMInstance_type:  
       {  
          _theValue._IN = new CIMInstance(val._theValue._IN->clone());  
          break;  
       }  
       case CQLValue::CIMClass_type:  
       {  
          _theValue._CL = new CIMClass(val._theValue._CL->clone());  
          break;  
       }  
       default:  
          break;  
    }  
  
    _CQLChainId = val._CQLChainId;    _CQLChainId = val._CQLChainId;
  
Line 166 
Line 77 
  
 CQLValueRep::CQLValueRep(const CQLValueRep* val) CQLValueRep::CQLValueRep(const CQLValueRep* val)
 { {
    switch(val->_valueType)    _theValue =  val->_theValue;
    {  
       case CQLValue::Boolean_type:  
       {  
          _theValue._B = val->_theValue._B;  
          break;  
       }  
       case CQLValue::Sint64_type:  
       {  
          _theValue._S64 = val->_theValue._S64;  
          break;  
       }  
       case CQLValue::Uint64_type:  
       {  
          _theValue._U64 = val->_theValue._U64;  
          break;  
       }  
       case CQLValue::Real_type:  
       {  
          _theValue._R64 = val->_theValue._R64;  
          break;  
       }  
       case CQLValue::String_type:  
       {  
          _theValue._S = new String(*val->_theValue._S);  
          break;  
       }  
       case CQLValue::CIMDateTime_type:  
       {  
          _theValue._DT = new CIMDateTime(*val->_theValue._DT);  
          break;  
       }  
       case CQLValue::CIMReference_type:  
       {  
          _theValue._OP = new CIMObjectPath(*val->_theValue._OP);  
          break;  
       }  
       case CQLValue::CIMInstance_type:  
       {  
          _theValue._IN = new CIMInstance(val->_theValue._IN->clone());  
          break;  
       }  
       case CQLValue::CIMClass_type:  
       {  
          _theValue._CL = new CIMClass(val->_theValue._CL->clone());  
          break;  
       }  
       default:  
          break;  
    }  
  
    _CQLChainId = val->_CQLChainId;    _CQLChainId = val->_CQLChainId;
  
Line 234 
Line 96 
       case CQLValue::Hex:       case CQLValue::Hex:
          if(inSign)          if(inSign)
          {          {
             _theValue._U64 = strtoul((const char*)cStr,&endP,16);              _theValue.set((Uint64)strtoul((const char*)cStr,&endP,16));
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
          }          }
          else          else
          {          {
             _theValue._S64 = strtol((const char *)cStr,&endP,16);              _theValue.set((Sint64)strtol((const char *)cStr,&endP,16));
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
          }          }
  
Line 247 
Line 109 
       case CQLValue::Binary:       case CQLValue::Binary:
          if(inSign)          if(inSign)
          {          {
             _theValue._U64 = strtoul((const char *)cStr,&endP,2);              _theValue.set((Uint64)strtoul((const char *)cStr,&endP,2));
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
          }          }
          else          else
          {          {
             _theValue._S64 = strtol((const char *)cStr,&endP,2);              _theValue.set((Sint64)strtol((const char *)cStr,&endP,2));
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
          }          }
          break;          break;
       case CQLValue::Decimal:       case CQLValue::Decimal:
          if(inSign)          if(inSign)
          {          {
             _theValue._U64 = strtoul((const char *)cStr,&endP,10);              _theValue.set((Uint64)strtoul((const char *)cStr,&endP,10));
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
          }          }
          else          else
          {          {
             _theValue._S64 = strtol((const char *)cStr,&endP,10);              _theValue.set((Sint64)strtol((const char *)cStr,&endP,10));
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
          }          }
          break;          break;
       case CQLValue::Real:       case CQLValue::Real:
          if(inSign)          if(inSign)
          {          {
             _theValue._R64 = strtod((const char *)cStr,&endP);              _theValue.set((Real64)strtod((const char *)cStr,&endP));
             _valueType = CQLValue::Real_type;             _valueType = CQLValue::Real_type;
          }          }
          else          else
          {          {
             _theValue._R64 = strtod((const char *)cStr,&endP);              _theValue.set((Real64)strtod((const char *)cStr,&endP));
             _valueType = CQLValue::Real_type;             _valueType = CQLValue::Real_type;
          }          }
          break;          break;
Line 301 
Line 163 
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::String_type)     _valueType(CQLValue::String_type)
 { {
    _theValue._S = new String(inString);     _theValue.set(inString);
 } }
  
 CQLValueRep::CQLValueRep(const CIMInstance& inInstance) CQLValueRep::CQLValueRep(const CIMInstance& inInstance)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::CIMInstance_type)      _valueType(CQLValue::CIMObject_type)
 { {
    _theValue._IN = new CIMInstance(inInstance.clone());    // TODO:  _theValue.set((CIMObject)inInstance);
 } }
  
 CQLValueRep::CQLValueRep(const CIMClass& inClass) CQLValueRep::CQLValueRep(const CIMClass& inClass)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::CIMClass_type)      _valueType(CQLValue::CIMObject_type)
 { {
    _theValue._CL = new CIMClass(inClass.clone());    // TODO:  _theValue.set((CIMObject)inClass);
 } }
  
 CQLValueRep::CQLValueRep(const CIMObjectPath& inObjPath) CQLValueRep::CQLValueRep(const CIMObjectPath& inObjPath)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::CIMReference_type)     _valueType(CQLValue::CIMReference_type)
 { {
    _theValue._OP = new CIMObjectPath(inObjPath);     _theValue.set(inObjPath);
 } }
  
 CQLValueRep::CQLValueRep(const CIMDateTime& inDateTime) CQLValueRep::CQLValueRep(const CIMDateTime& inDateTime)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::CIMDateTime_type)     _valueType(CQLValue::CIMDateTime_type)
 { {
    _theValue._DT = new CIMDateTime(inDateTime);     _theValue.set(inDateTime);
 } }
  
 CQLValueRep::CQLValueRep(Uint64 inUint) CQLValueRep::CQLValueRep(Uint64 inUint)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::Uint64_type)     _valueType(CQLValue::Uint64_type)
 { {
    _theValue._U64 = inUint;     _theValue.set(inUint);
 } }
  
 CQLValueRep::CQLValueRep(Boolean inBool) CQLValueRep::CQLValueRep(Boolean inBool)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::Boolean_type)     _valueType(CQLValue::Boolean_type)
 { {
    _theValue._B = inBool;     _theValue.set(inBool);
 } }
  
 CQLValueRep::CQLValueRep(Sint64 inSint) CQLValueRep::CQLValueRep(Sint64 inSint)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::Sint64_type)     _valueType(CQLValue::Sint64_type)
 { {
    _theValue._S64 = inSint;     _theValue.set(inSint);
 } }
  
 CQLValueRep::CQLValueRep(Real64 inReal) CQLValueRep::CQLValueRep(Real64 inReal)
   : _isResolved(true),   : _isResolved(true),
     _valueType(CQLValue::Real_type)     _valueType(CQLValue::Real_type)
 { {
    _theValue._R64 = inReal;     _theValue.set(inReal);
 } }
  
 void CQLValueRep::resolve(const CIMInstance& CI, const  QueryContext& inQueryCtx) void CQLValueRep::resolve(const CIMInstance& CI, const  QueryContext& inQueryCtx)
Line 378 
Line 240 
     {     {
       // A class was passed in with no property indicated.       // A class was passed in with no property indicated.
       // Set the instance passed in, as a primitive.       // Set the instance passed in, as a primitive.
       _theValue._IN = (CIMInstance *) new CIMInstance(CI.clone());        // TODO: _theValue.set((CIMObject)CI);
       _valueType = CQLValue::CIMInstance_type;        _valueType = CQLValue::CIMObject_type;
       _isResolved = true;       _isResolved = true;
       return; // Done.       return; // Done.
     }     }
Line 450 
Line 312 
       CIMObject cimObj;       CIMObject cimObj;
       //propObj.getValue(cimObj);       //propObj.getValue(cimObj);
  
       if(cimObj.isInstance())        // TODO: _theValue.set(cimObj);
         {  
           _theValue._IN = new CIMInstance(cimObj.clone());  
         }  
       else if(cimObj.isClass())  
         {  
           _theValue._CL = new CIMClass(cimObj.clone());  
         }  
   
     }     }
   else // Primitive   else // Primitive
     {     {
Line 486 
Line 340 
     }     }
 } }
  
 CQLValueRep& CQLValueRep::operator=(const CQLValueRep& rhs){  CQLValueRep& CQLValueRep::operator=(const CQLValueRep& rhs)
   {
  
         if(&rhs != this){    if(&rhs != this)
       {
                 _valueType = rhs._valueType;                 _valueType = rhs._valueType;
                 _theValue = rhs._theValue;                 _theValue = rhs._theValue;
                 switch(_valueType){  
                         case CQLValue::String_type:  
                                 _theValue._S = new String(rhs.getString());  
                                 break;  
                         case CQLValue::CIMDateTime_type:  
                                 _theValue._DT = new CIMDateTime(rhs.getDateTime());  
                                 break;  
                         case CQLValue::CIMReference_type:  
                                 _theValue._OP = new CIMObjectPath(rhs.getReference());  
                                 break;  
                         case CQLValue::CIMInstance_type:  
                                 _theValue._IN = new CIMInstance(rhs.getInstance().clone());  
                                 break;  
                         case CQLValue::CIMClass_type:  
                                 _theValue._CL = new CIMClass(rhs.getClass().clone());  
                                 break;  
                         case CQLValue::Boolean_type:  
                         case CQLValue::Sint64_type:  
                         case CQLValue::Uint64_type:  
                         case CQLValue::Real_type:  
                         case CQLValue::Null_type:  
                         case CQLValue::CQLIdentifier_type:  
   
                         default:  
                                 break;  
                 }  
                 _CQLChainId = rhs._CQLChainId;                 _CQLChainId = rhs._CQLChainId;
                 _isResolved = rhs._isResolved;                 _isResolved = rhs._isResolved;
         }         }
Line 526 
Line 356 
 { {
   _validate(x);   _validate(x);
  
     if((_theValue.getType() == x._theValue.getType()) &&
        (_valueType != CQLValue::CIMObject_type) &&
        (_valueType != CQLValue::CQLIdentifier_type) &&
        (!_theValue.isArray()))
       {
   
         return _theValue == x._theValue;
       }
     else
       {
         Uint64 tmpU64;
         Sint64 tmpS64;
         Real64 tmpR64;
   
    switch(_valueType)    switch(_valueType)
    {    {
    case CQLValue::Null_type:    case CQLValue::Null_type:
Line 536 
Line 380 
          }          }
      }      }
      break;      break;
    case CQLValue::Boolean_type:  
      {  
        if(x._valueType == CQLValue::Boolean_type)  
          {  
            if(_theValue._B == x._theValue._B)  
              {  
                return true;  
              }  
          }  
        break;  
      }  
    case CQLValue::Sint64_type:    case CQLValue::Sint64_type:
      {      {
        if(x._valueType == CQLValue::Sint64_type)              _theValue.get(tmpS64);
          {              if(x._valueType == CQLValue::Uint64_type)
            if(_theValue._S64 == x._theValue._S64)  
              {  
                return true;  
              }  
          }  
        else if(x._valueType == CQLValue::Uint64_type)  
          {          {
            if(x._theValue._U64 > (Uint64)PEGASUS_SINT64_MIN)                  x._theValue.get(tmpU64);
   
                   if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
              {              {
                return false;                return false;
              }              }
            if(_theValue._S64 == (Sint64)x._theValue._U64)                  else
              {              {
                return true;                      return (Sint64)tmpU64 == tmpS64;
              }              }
          }          }
        else if(x._valueType == CQLValue::Real_type)              else
          {  
            if(_theValue._S64 == x._theValue._R64)  
              {              {
                return true;                  x._theValue.get(tmpR64);
              }  
                   return tmpR64 == tmpS64;
          }          }
        break;        break;
      }      }
    case CQLValue::Uint64_type:    case CQLValue::Uint64_type:
             {
               _theValue.get(tmpU64);
      if(x._valueType == CQLValue::Sint64_type)      if(x._valueType == CQLValue::Sint64_type)
        {        {
          if(_theValue._U64 > (Uint64)PEGASUS_SINT64_MIN)                  x._theValue.get(tmpS64);
   
                   if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
            {            {
              return false;              return false;
            }            }
          if((Sint64)_theValue._U64 == x._theValue._S64)                  else
            {            {
              return true;                      return (Sint64)tmpU64 == tmpS64;
            }            }
        }        }
      else if(x._valueType == CQLValue::Uint64_type)              else
        {        {
          if(_theValue._U64 == x._theValue._U64)                  x._theValue.get(tmpR64);
                   if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
            {            {
              return true;                      return false;
            }  
        }        }
      else if(x._valueType == CQLValue::Real_type)                  else
        {  
          Real64 temp;  
          memcpy(&temp, &_theValue._U64, sizeof(temp));  
          if(temp == x._theValue._R64)  
            {            {
              return true;                      return tmpR64 == (Sint64)tmpU64;
            }            }
        }        }
      break;      break;
             }
    case CQLValue::Real_type:    case CQLValue::Real_type:
      if(x._valueType == CQLValue::Sint64_type)  
        {        {
          if(_theValue._R64 == x._theValue._S64)              _theValue.get(tmpR64);
               if(x._valueType == CQLValue::Uint64_type)
            {            {
              return true;                  x._theValue.get(tmpU64);
            }  
        }                  if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
      else if(x._valueType == CQLValue::Uint64_type)  
        {  
          Real64 temp;  
          memcpy(&temp, &x._theValue._U64, sizeof(temp));  
             if(_theValue._R64 == temp)  
               {               {
                 return true;                      return false;
               }  
        }        }
      else if(x._valueType == CQLValue::Real_type)                  else
        {  
          if(_theValue._R64 == x._theValue._R64)  
             {             {
               return true;                      return (Sint64)tmpU64 == tmpR64;
             }             }
        }        }
      break;              else
    case CQLValue::String_type:  
      if(*_theValue._S == *x._theValue._S)  
        {  
             return true;  
        }  
      break;  
    case CQLValue::CIMDateTime_type:  
      if(*_theValue._DT == *x._theValue._DT)  
        {        {
          return true;                  x._theValue.get(tmpS64);
   
                   return tmpR64 == tmpS64;
         }         }
      break;      break;
    case CQLValue::CIMReference_type:  
      if(_theValue._OP->identical(*x._theValue._OP))  
        {  
          return true;  
        }        }
      break;          case CQLValue::CIMObject_type:
    case CQLValue::CIMInstance_type:  // TODO: need to define Instance comparison  
      return true; // _compareInstance(*_theValue._IN, *x._theValue._IN)  
      break;  
    case CQLValue::CIMClass_type:  
      if(_theValue._CL->identical(*x._theValue._CL))  
          {          {
            return true;              CIMObject objBase;
               CIMObject objParm;
               // TODO: _theValue.get(objBase);
               // TODO: x._theValue.get(objParm);
   
               _compareObjects(objBase,objParm);
          }          }
      break;      break;
    case CQLValue::CQLIdentifier_type:    case CQLValue::CQLIdentifier_type:
Line 667 
Line 479 
    }    }
    return false;    return false;
 } }
   }
  
 //##ModelId=40FBFF9502BB  
 Boolean CQLValueRep::operator!=(const CQLValueRep& x) Boolean CQLValueRep::operator!=(const CQLValueRep& x)
 { {
   _validate(x);  
   
   return !(this->operator==(x));   return !(this->operator==(x));
 } }
  
  
 Boolean CQLValueRep::operator<=(const CQLValueRep& x) Boolean CQLValueRep::operator<=(const CQLValueRep& x)
 { {
   _validate(x);  
   
   if (this->operator<(x) || this->operator==(x))   if (this->operator<(x) || this->operator==(x))
     {     {
       return true;       return true;
Line 700 
Line 508 
  
 Boolean CQLValueRep::operator<(const CQLValueRep& x) Boolean CQLValueRep::operator<(const CQLValueRep& x)
 { {
   _validate(x);  
         Uint64 tmpU64;
         Sint64 tmpS64;
         Real64 tmpR64;
  
   switch(_valueType)   switch(_valueType)
     {     {
     case CQLValue::Null_type:     case CQLValue::Null_type:
       {       {
         if(x._valueType == CQLValue::Null_type)              return false;
           {  
             return true;  
           }  
       }  
       break;  
     case CQLValue::Boolean_type:  
       {  
         if(x._valueType == CQLValue::Boolean_type)  
           {  
             if(_theValue._B < x._theValue._B)  
               {  
                 return true;  
               }  
           }           }
         break;         break;
       }  
     case CQLValue::Sint64_type:     case CQLValue::Sint64_type:
       if(x._valueType == CQLValue::Sint64_type)  
         {         {
           if(_theValue._S64 < x._theValue._S64)         _theValue.get(tmpS64);
          if(x._valueType == CQLValue::Sint64_type)
             {             {
               return true;             Sint64 right;
             }             x._theValue.get(right);
   
              return tmpS64 < right;
         }         }
       else if(x._valueType == CQLValue::Uint64_type)       else if(x._valueType == CQLValue::Uint64_type)
         {         {
           if(x._theValue._U64 > (Uint64)PEGASUS_SINT64_MIN)             x._theValue.get(tmpU64);
   
              if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
              {              {
                return true;                return true;
              }              }
           if(_theValue._S64 < (Sint64)x._theValue._U64)             else
             {             {
               return true;                 return tmpS64 < (Sint64)tmpU64;
             }             }
         }         }
       else if(x._valueType == CQLValue::Real_type)         else
         {  
           if(_theValue._S64 < x._theValue._R64)  
             {             {
               return true;             x._theValue.get(tmpR64);
             }  
              return tmpS64 < tmpR64;
         }         }
       break;       break;
        }
     case CQLValue::Uint64_type:     case CQLValue::Uint64_type:
       if(x._valueType == CQLValue::Sint64_type)  
         {         {
           if(_theValue._U64 > (Uint64)PEGASUS_SINT64_MIN)         _theValue.get(tmpU64);
          if(x._valueType == CQLValue::Uint64_type)
            {
              Uint64 right;
              x._theValue.get(right);
   
              return tmpU64 < right;
            }
          else if(x._valueType == CQLValue::Sint64_type)
            {
              x._theValue.get(tmpS64);
   
              if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
             {             {
               return false;               return false;
             }             }
           if((Sint64)_theValue._U64 < x._theValue._S64)             else
             {             {
               return true;                 return (Sint64)tmpU64 < tmpS64;
             }             }
         }         }
       else if(x._valueType == CQLValue::Uint64_type)         else
         {         {
           if(_theValue._U64 < x._theValue._U64)             x._theValue.get(tmpR64);
              if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
             {             {
               return true;                 return false;
             }  
         }         }
       else if(x._valueType == CQLValue::Real_type)             else
         {  
           Real64 temp;  
           memcpy(&temp, &_theValue._U64, sizeof(temp));  
           if(temp < x._theValue._R64)  
             {             {
               return true;                 return (Sint64)tmpU64 < tmpR64;
             }             }
         }         }
       break;       break;
        }
     case CQLValue::Real_type:     case CQLValue::Real_type:
       if(x._valueType == CQLValue::Sint64_type)  
         {         {
           if(_theValue._R64 < x._theValue._S64)         _theValue.get(tmpR64);
          if(x._valueType == CQLValue::Real_type)
             {             {
               return true;             Real64 right;
             }             x._theValue.get(right);
   
              return tmpR64 < right;
         }         }
       else if(x._valueType == CQLValue::Uint64_type)       else if(x._valueType == CQLValue::Uint64_type)
         {         {
           Real64 temp;             x._theValue.get(tmpU64);
           memcpy(&temp, &x._theValue._U64, sizeof(temp));  
           if(_theValue._R64 < temp)             if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)
             {             {
               return true;               return true;
             }             }
         }             else
       else if(x._valueType == CQLValue::Real_type)  
         {  
           if(_theValue._R64 < x._theValue._R64)  
             {             {
               return true;                 return tmpR64 < (Sint64)tmpU64;
             }             }
         }         }
          else
            {
              x._theValue.get(tmpS64);
   
              return tmpR64 < tmpS64;
            }
       break;       break;
        }
     case CQLValue::String_type:     case CQLValue::String_type:
       if(*_theValue._S < *x._theValue._S)  
         {         {
           return true;              String tmpS1;
               String tmpS2;
               _theValue.get(tmpS1);
               x._theValue.get(tmpS2);
               return tmpS1 < tmpS2;
         }         }
       break;          case CQLValue::CIMObject_type:
     case CQLValue::CIMDateTime_type:       throw Exception(String("CQLValueRep::operator=="));
       throw(Exception(String("CQLValueRep::operator<")));  
       break;  
     case CQLValue::CIMReference_type:  
       throw(Exception(String("CQLValueRep::operator<")));  
       break;  
     case CQLValue::CIMInstance_type:  
       throw(Exception(String("CQLValueRep::operator<")));  
       break;  
     case CQLValue::CIMClass_type:  
       throw(Exception(String("CQLValueRep::operator<")));  
       break;       break;
     case CQLValue::CQLIdentifier_type:     case CQLValue::CQLIdentifier_type:
       throw(Exception(String("CQLValueRep::operator<")));       throw Exception(String("CQLValueRep::operator=="));
       break;       break;
  
     default:     default:
       throw(Exception(String("CQLValueRep::operator<")));          throw Exception(String("CQLValueRep::operator=="));
       break;       break;
     }     }
   return false;   return false;
Line 851 
Line 660 
    _validate(x);    _validate(x);
  
    switch(_valueType)    switch(_valueType)
      {       {/*
      case CQLValue::Null_type:      case CQLValue::Null_type:
        throw(Exception(String("CQLValueRep::operator+")));        throw(Exception(String("CQLValueRep::operator+")));
        break;        break;
Line 904 
Line 713 
            return CQLValueRep(_theValue._R64 + x._theValue._R64);            return CQLValueRep(_theValue._R64 + x._theValue._R64);
          }          }
        break;        break;
         */
      case CQLValue::String_type:      case CQLValue::String_type:
        return CQLValueRep(*_theValue._S + *x._theValue._S);         {
            String tmpS1;
            String tmpS2;
            _theValue.get(tmpS1);
            x._theValue.get(tmpS2);
            return CQLValueRep(tmpS1 + tmpS2);
          }
        break;        break;
      case CQLValue::CIMDateTime_type:      case CQLValue::CIMDateTime_type:
        throw(Exception(String("CQLValueRep::operator+")));        throw(Exception(String("CQLValueRep::operator+")));
Line 913 
Line 729 
      case CQLValue::CIMReference_type:      case CQLValue::CIMReference_type:
        throw(Exception(String("CQLValueRep::operator+")));        throw(Exception(String("CQLValueRep::operator+")));
        break;        break;
      case CQLValue::CIMInstance_type:       case CQLValue::CIMObject_type:
        throw(Exception(String("CQLValueRep::operator+")));  
        break;  
      case CQLValue::CIMClass_type:  
        throw(Exception(String("CQLValueRep::operator+")));        throw(Exception(String("CQLValueRep::operator+")));
        break;        break;
      case CQLValue::CQLIdentifier_type:      case CQLValue::CQLIdentifier_type:
Line 1233 
Line 1046 
 Boolean CQLValueRep::isa(const CQLChainedIdentifier& inID,QueryContext& QueryCtx) Boolean CQLValueRep::isa(const CQLChainedIdentifier& inID,QueryContext& QueryCtx)
 { {
    if(!_isResolved ||    if(!_isResolved ||
       (_valueType != CQLValue::CIMClass_type &&        (_valueType != CQLValue::CIMObject_type))
        _valueType != CQLValue::CIMInstance_type))  
      {      {
        throw(Exception(String("CQLValueRep::isa")));        throw(Exception(String("CQLValueRep::isa")));
      }      }
  
    CIMName className;    CIMName className;
      CIMObject obj;
  
    if(_valueType == CQLValue::CIMInstance_type)     // TODO: _theValue.get(obj);
      {  
        className = _theValue._IN->getClassName();     className = obj.getClassName();
      }  
    if(_valueType == CQLValue::CIMClass_type)  
      {  
        className = _theValue._CL->getClassName();  
      }  
  
    Array<CIMName> cimNames = QueryCtx.enumerateClassNames(inID[0].getName());    Array<CIMName> cimNames = QueryCtx.enumerateClassNames(inID[0].getName());
  
Line 1272 
Line 1080 
       throw(Exception(String("CQLValueRep::like")));       throw(Exception(String("CQLValueRep::like")));
    }    }
  
    String leftside(*_theValue._S);     String leftside;
    String rightside(*inVal._theValue._S);     _theValue.get(leftside);
   
      String rightside;
      inVal._theValue.get(rightside);
  
    CQLRegularExpression re;    CQLRegularExpression re;
    return re.match(leftside,rightside);    return re.match(leftside,rightside);
   
 } }
  
 /* /*
Line 1309 
Line 1121 
    {    {
       throw(Exception(String("CQLValueRep::getUint")));       throw(Exception(String("CQLValueRep::getUint")));
    }    }
    return _theValue._U64;     Uint64 tmp;
      _theValue.get(tmp);
      return tmp;
 } }
  
 Boolean CQLValueRep::getBool()const Boolean CQLValueRep::getBool()const
Line 1318 
Line 1132 
    {    {
       throw(Exception(String("CQLValueRep::getBool")));       throw(Exception(String("CQLValueRep::getBool")));
    }    }
    return _theValue._B;     Boolean tmp;
      _theValue.get(tmp);
      return tmp;
 } }
  
 Sint64 CQLValueRep::getSint()const Sint64 CQLValueRep::getSint()const
Line 1327 
Line 1143 
    {    {
       throw(Exception(String("CQLValueRep::getSint")));       throw(Exception(String("CQLValueRep::getSint")));
    }    }
    return _theValue._S64;     Sint64 tmp;
      _theValue.get(tmp);
      return tmp;
 } }
  
 Real64 CQLValueRep::getReal()const Real64 CQLValueRep::getReal()const
Line 1336 
Line 1154 
    {    {
       throw(Exception(String("CQLValueRep::getReal")));       throw(Exception(String("CQLValueRep::getReal")));
    }    }
    return _theValue._R64;     Real64 tmp;
      _theValue.get(tmp);
      return tmp;
 } }
  
 String CQLValueRep::getString()const String CQLValueRep::getString()const
Line 1345 
Line 1165 
    {    {
       throw(Exception(String("CQLValueRep::getString")));       throw(Exception(String("CQLValueRep::getString")));
    }    }
    return *_theValue._S;     String tmp;
      _theValue.get(tmp);
      return tmp;
 } }
  
 CIMDateTime CQLValueRep::getDateTime()const CIMDateTime CQLValueRep::getDateTime()const
Line 1354 
Line 1176 
    {    {
       throw(Exception(String("CQLValueRep::getDateTime")));       throw(Exception(String("CQLValueRep::getDateTime")));
    }    }
      CIMDateTime tmp;
    return *_theValue._DT;     _theValue.get(tmp);
      return tmp;
 } }
  
 CIMObjectPath CQLValueRep::getReference()const CIMObjectPath CQLValueRep::getReference()const
Line 1364 
Line 1187 
    {    {
       throw(Exception(String("CQLValueRep::getReference")));       throw(Exception(String("CQLValueRep::getReference")));
    }    }
    return *_theValue._OP;     CIMObjectPath tmp;
      _theValue.get(tmp);
      return tmp;
 } }
  
 CIMInstance CQLValueRep::getInstance()const  CIMObject CQLValueRep::getObject()const
 { {
    if(_valueType != CQLValue::CIMInstance_type)     if(_valueType != CQLValue::CIMObject_type)
    {    {
       throw(Exception(String("CQLValueRep::getInstance")));       throw(Exception(String("CQLValueRep::getInstance")));
    }    }
    return _theValue._IN->clone();     CIMObject tmp;
 }     // TODO: _theValue.get(tmp);
      return tmp.clone();
 CIMClass CQLValueRep::getClass()const  
 {  
    if(_valueType != CQLValue::CIMClass_type)  
    {  
       throw(Exception(String("CQLValueRep::getClass")));  
    }  
   
    return _theValue._CL->clone();  
 } }
  
 String CQLValueRep::toString()const String CQLValueRep::toString()const
 { {
    switch(_valueType)    if(_valueType == CQLValue::CQLIdentifier_type)
    {    {
       case CQLValue::Boolean_type:        return _CQLChainId.toString();
       {  
          return (_theValue._B ? String("TRUE") : String("FALSE"));  
          break;  
       }  
       case CQLValue::Sint64_type:  
       {  
          char buffer[32];  // Should need 21 chars max  
          sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "d", _theValue._S64);  
          return String(buffer);  
          break;  
       }  
       case CQLValue::Uint64_type:  
       {  
          char buffer[32];  // Should need 21 chars max  
          sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", _theValue._U64);  
          return String(buffer);  
          break;  
       }       }
       case CQLValue::Real_type:    else
       {       {
          char buffer[128];        return _theValue.toString();
          sprintf(buffer, "%.6e", _theValue._R64);  
          return String(buffer);  
          break;  
       }  
       case CQLValue::String_type:  
          return *_theValue._S;  
          break;  
       case CQLValue::CIMDateTime_type:  
          return _theValue._DT->toString();  
          break;  
       case CQLValue::CIMReference_type:  
          return _theValue._OP->toString();  
          break;  
       case CQLValue::CIMInstance_type:  
          return _theValue._IN->getPath().toString();  
          break;  
       case CQLValue::CIMClass_type:  
          return _theValue._CL->getPath().toString();  
          break;  
       case CQLValue::CQLIdentifier_type:  
              return _CQLChainId.toString();  
              break;  
       default:  
          break;  
    }    }
    return String();  
 } }
  
  
Line 1480 
Line 1255 
             throw TypeMismatchException(String("CQLValueRep::_validate"));             throw TypeMismatchException(String("CQLValueRep::_validate"));
          }          }
          break;          break;
       case CQLValue::CIMInstance_type:        case CQLValue::CIMObject_type:
          if(x._valueType != CQLValue::CIMInstance_type)           if(x._valueType != CQLValue::CIMObject_type)
          {          {
             throw TypeMismatchException(String("CQLValueRep::_validate"));             throw TypeMismatchException(String("CQLValueRep::_validate"));
          }          }
Line 1500 
Line 1275 
    return;    return;
 } }
  
 void CQLValueRep::_setValue(CIMValue cv,Uint64 index)  void CQLValueRep::_setValue(CIMValue cv,Sint64 index)
 { {
    CIMValue tmp;    CIMValue tmp;
    if(cv.isArray())    if(cv.isArray() && index != -1)
    {    {
       switch(cv.getType())       switch(cv.getType())
       {       {
Line 1511 
Line 1286 
          {          {
             Array<Boolean> _bool;             Array<Boolean> _bool;
             cv.get(_bool);             cv.get(_bool);
             _theValue._B = _bool[index];              _theValue.set(_bool[index]);
             _valueType = CQLValue::Boolean_type;             _valueType = CQLValue::Boolean_type;
             break;             break;
          }          }
Line 1519 
Line 1294 
          {          {
             Array<Uint8> _uint;             Array<Uint8> _uint;
             cv.get(_uint);             cv.get(_uint);
             _theValue._U64 = _uint[index];              _theValue.set((Uint64)_uint[index]);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
Line 1527 
Line 1302 
          {          {
             Array<Uint16> _uint;             Array<Uint16> _uint;
             cv.get(_uint);             cv.get(_uint);
             _theValue._U64 = _uint[index];              _theValue.set((Uint64)_uint[index]);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
Line 1535 
Line 1310 
          {          {
             Array<Uint32> _uint;             Array<Uint32> _uint;
             cv.get(_uint);             cv.get(_uint);
             _theValue._U64 = _uint[index];              _theValue.set((Uint64)_uint[index]);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
Line 1543 
Line 1318 
          {          {
             Array<Uint64> _uint;             Array<Uint64> _uint;
             cv.get(_uint);             cv.get(_uint);
             _theValue._U64 = _uint[index];              _theValue.set((Uint64)_uint[index]);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
Line 1551 
Line 1326 
          {          {
             Array<Sint8> _sint;             Array<Sint8> _sint;
             cv.get(_sint);             cv.get(_sint);
             _theValue._S64 = _sint[index];              _theValue.set((Sint64)_sint[index]);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
Line 1559 
Line 1334 
          {          {
             Array<Sint16> _sint;             Array<Sint16> _sint;
             cv.get(_sint);             cv.get(_sint);
             _theValue._S64 = _sint[index];              _theValue.set((Sint64)_sint[index]);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
Line 1567 
Line 1342 
          {          {
             Array<Sint32> _sint;             Array<Sint32> _sint;
             cv.get(_sint);             cv.get(_sint);
             _theValue._S64 = _sint[index];              _theValue.set((Sint64)_sint[index]);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
Line 1575 
Line 1350 
          {          {
             Array<Sint64> _sint;             Array<Sint64> _sint;
             cv.get(_sint);             cv.get(_sint);
             _theValue._S64 = _sint[index];              _theValue.set((Sint64)_sint[index]);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
Line 1584 
Line 1359 
          {          {
             Array<Real32> _real;             Array<Real32> _real;
             cv.get(_real);             cv.get(_real);
             _theValue._R64 = _real[index];              _theValue.set((Real64)_real[index]);
             _valueType = CQLValue::Real_type;             _valueType = CQLValue::Real_type;
             break;             break;
          }          }
Line 1592 
Line 1367 
          {          {
             Array<Real64> _real;             Array<Real64> _real;
             cv.get(_real);             cv.get(_real);
             _theValue._R64 = _real[index];              _theValue.set((Real64)_real[index]);
             _valueType = CQLValue::Real_type;             _valueType = CQLValue::Real_type;
             break;             break;
          }          }
Line 1600 
Line 1375 
          {          {
             Array<Char16> _str;             Array<Char16> _str;
             cv.get(_str);             cv.get(_str);
             _theValue._S = new String(&_str[index]);              _theValue.set(String(&_str[index]));
             _valueType = CQLValue::String_type;             _valueType = CQLValue::String_type;
             break;             break;
          }          }
Line 1608 
Line 1383 
          {          {
             Array<String> _str;             Array<String> _str;
             cv.get(_str);             cv.get(_str);
             _theValue._S = new String(_str[index]);              _theValue.set(_str[index]);
             _valueType = CQLValue::String_type;             _valueType = CQLValue::String_type;
             break;             break;
          }          }
Line 1616 
Line 1391 
          {          {
             Array<CIMDateTime> _date;             Array<CIMDateTime> _date;
             cv.get(_date);             cv.get(_date);
             _theValue._DT = new CIMDateTime(_date[index]);              _theValue.set(_date[index]);
             _valueType = CQLValue::CIMDateTime_type;             _valueType = CQLValue::CIMDateTime_type;
             break;             break;
          }          }
Line 1624 
Line 1399 
          {          {
             Array<CIMObjectPath> _path;             Array<CIMObjectPath> _path;
             cv.get(_path);             cv.get(_path);
             _theValue._OP = new CIMObjectPath(_path[index]);              _theValue.set(_path[index]);
             _valueType = CQLValue::CIMReference_type;             _valueType = CQLValue::CIMReference_type;
             break;             break;
          }          }
           case CIMTYPE_EMBEDDED:
             {
               Array<CIMObject> _obj;
               // TODO: cv.get(_obj);
               // TODO: _theValue.set(_obj[index]);
               _valueType = CQLValue::CIMObject_type;
               break;
             }
          default:          default:
             throw(Exception(String("CQLValueRep::_setValue")));             throw(Exception(String("CQLValueRep::_setValue")));
       } // switch statement       } // switch statement
   
    }    }
    else    else
    {    {
Line 1639 
Line 1421 
       {       {
          case CIMTYPE_BOOLEAN:          case CIMTYPE_BOOLEAN:
          {          {
             Boolean _bool;              _theValue = cv;
             cv.get(_bool);  
             _theValue._B = _bool;  
             _valueType = CQLValue::Boolean_type;             _valueType = CQLValue::Boolean_type;
             break;             break;
          }          }
          case CIMTYPE_UINT8:          case CIMTYPE_UINT8:
          {          {
             Uint8 _uint;              Uint8 _tmp;
             cv.get(_uint);              cv.get(_tmp);
             _theValue._U64 = _uint;              _theValue = CIMValue((Uint64)_tmp);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
          case CIMTYPE_UINT16:          case CIMTYPE_UINT16:
          {          {
             Uint16 _uint;              Uint16 _tmp;
             cv.get(_uint);              cv.get(_tmp);
             _theValue._U64 = _uint;              _theValue = CIMValue((Uint64)_tmp);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
          case CIMTYPE_UINT32:          case CIMTYPE_UINT32:
          {          {
             Uint32 _uint;              Uint32 _tmp;
             cv.get(_uint);              cv.get(_tmp);
             _theValue._U64 = _uint;              _theValue = CIMValue((Uint64)_tmp);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
          case CIMTYPE_UINT64:          case CIMTYPE_UINT64:
          {          {
             Uint64 _uint;              Uint64 _tmp;
             cv.get(_uint);              cv.get(_tmp);
             _theValue._U64 = _uint;              _theValue = CIMValue((Uint64)_tmp);
             _valueType = CQLValue::Uint64_type;             _valueType = CQLValue::Uint64_type;
             break;             break;
          }          }
          case CIMTYPE_SINT8:          case CIMTYPE_SINT8:
          {          {
             Sint8 _sint;              Sint8 _tmp;
             cv.get(_sint);              cv.get(_tmp);
             _theValue._S64 = _sint;              _theValue = CIMValue((Sint64)_tmp);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
          case CIMTYPE_SINT16:          case CIMTYPE_SINT16:
          {          {
             Sint16 _sint;              Sint16 _tmp;
             cv.get(_sint);              cv.get(_tmp);
             _theValue._S64 = _sint;              _theValue = CIMValue((Sint64)_tmp);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
          case CIMTYPE_SINT32:          case CIMTYPE_SINT32:
   
          {          {
             Sint32 _sint;              Sint32 _tmp;
             cv.get(_sint);              cv.get(_tmp);
             _theValue._S64 = _sint;              _theValue = CIMValue((Sint64)_tmp);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
          case CIMTYPE_SINT64:          case CIMTYPE_SINT64:
          {          {
             Sint64 _sint;              Sint64 _tmp;
             cv.get(_sint);              cv.get(_tmp);
             _theValue._S64 = _sint;              _theValue = CIMValue((Sint64)_tmp);
             _valueType = CQLValue::Sint64_type;             _valueType = CQLValue::Sint64_type;
             break;             break;
          }          }
          case CIMTYPE_REAL32:          case CIMTYPE_REAL32:
          {          {
             Real32 _real;              Real64 _tmp;
             cv.get(_real);              cv.get(_tmp);
             _theValue._R64 = _real;              _theValue = CIMValue((Real64)_tmp);
             _valueType = CQLValue::Real_type;             _valueType = CQLValue::Real_type;
             break;             break;
          }          }
          case CIMTYPE_REAL64:          case CIMTYPE_REAL64:
          {          {
             Real64 _real;              Real64 _tmp;
             cv.get(_real);              cv.get(_tmp);
             _theValue._R64 = _real;              _theValue = CIMValue((Real64)_tmp);
             _valueType = CQLValue::Real_type;             _valueType = CQLValue::Real_type;
             break;             break;
          }          }
          case CIMTYPE_CHAR16:          case CIMTYPE_CHAR16:
          {          {
             Char16 _str;              Char16 _tmp;
             cv.get(_str);              cv.get(_tmp);
             _theValue._S = new String(&_str);              _theValue = CIMValue(String(&_tmp));
             _valueType = CQLValue::String_type;             _valueType = CQLValue::String_type;
             break;             break;
          }          }
          case CIMTYPE_STRING:          case CIMTYPE_STRING:
          {          {
             String _str;              _theValue = cv;
             cv.get(_str);  
             _theValue._S = new String(_str);  
             _valueType = CQLValue::String_type;             _valueType = CQLValue::String_type;
             break;             break;
          }          }
          case CIMTYPE_DATETIME:          case CIMTYPE_DATETIME:
          {          {
             CIMDateTime _date;              _theValue = cv;
             cv.get(_date);  
             _theValue._DT = new CIMDateTime(_date);  
             _valueType = CQLValue::CIMDateTime_type;             _valueType = CQLValue::CIMDateTime_type;
             break;             break;
          }          }
          case CIMTYPE_REFERENCE:          case CIMTYPE_REFERENCE:
          {          {
             CIMObjectPath _path;              _theValue = cv;
             cv.get(_path);  
             _theValue._OP = new CIMObjectPath(_path);  
             _valueType = CQLValue::CIMReference_type;             _valueType = CQLValue::CIMReference_type;
             break;             break;
          }          }
           case CIMTYPE_EMBEDDED:
             {
               _theValue = cv;
               _valueType = CQLValue::CIMObject_type;
               break;
             }
          default:          default:
             throw(Exception(String("CQLValueRep::setValue")));            throw(Exception(String("CQLValueRep::_setValue")));
       } // switch statement  
    }    }
   
       }
   
    _isResolved = true;    _isResolved = true;
    return;    return;
 } }
Line 1929 
Line 1710 
      }      }
 } }
  
 Boolean CQLValueRep::_compareInstance(CIMInstance& _in1, CIMInstance& _in2)  Boolean CQLValueRep::_compareObjects(CIMObject& _in1, CIMObject& _in2)
 { {
   return true;   return true;
 } }


Legend:
Removed from v.1.1.2.22  
changed lines
  Added in v.1.1.2.23

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2