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

Diff for /pegasus/src/Pegasus/Common/CIMResponseData.cpp between version 1.5.2.2 and 1.5.2.3

version 1.5.2.2, 2011/01/21 02:25:43 version 1.5.2.3, 2011/10/11 18:18:08
Line 44 
Line 44 
 #define LOCAL_MIN(a, b) ((a < b) ? a : b) #define LOCAL_MIN(a, b) ((a < b) ? a : b)
 // C++ objects interface handling // C++ objects interface handling
  
   void CIMResponseData::SVALID()
   {
       PEGASUS_ASSERT(valid());
       if (_size > 100000)
       {
           PEG_TRACE((TRC_XML, Tracer::LEVEL4,
                      "CIMResponseData::SVALID() _size too big ",_size ));
           PEGASUS_ASSERT(false);
       }
       PEG_TRACE((TRC_XML, Tracer::LEVEL4,
           "CIMResponseData Size _size=%u", _size));
       Uint32 size = _size;
   }
 // Instance Names handling // Instance Names handling
 Array<CIMObjectPath>& CIMResponseData::getInstanceNames() Array<CIMObjectPath>& CIMResponseData::getInstanceNames()
 { {
       SVALID();
     PEGASUS_DEBUG_ASSERT(     PEGASUS_DEBUG_ASSERT(
     (_dataType==RESP_INSTNAMES || _dataType==RESP_OBJECTPATHS));     (_dataType==RESP_INSTNAMES || _dataType==RESP_OBJECTPATHS));
     _resolveToCIM();     _resolveToCIM();
Line 124 
Line 138 
 // set an array of SCMOInstances into the response data object // set an array of SCMOInstances into the response data object
 void CIMResponseData::setSCMO(const Array<SCMOInstance>& x) void CIMResponseData::setSCMO(const Array<SCMOInstance>& x)
 { {
       SVALID();
     _scmoInstances=x;     _scmoInstances=x;
     _encoding |= RESP_ENC_SCMO;     _encoding |= RESP_ENC_SCMO;
     _size += x.size();     _size += x.size();
Line 170 
Line 185 
  
 bool CIMResponseData::setXml(CIMBuffer& in) bool CIMResponseData::setXml(CIMBuffer& in)
 { {
       SVALID();
     switch (_dataType)     switch (_dataType)
     {     {
         case RESP_INSTANCE:         case RESP_INSTANCE:
Line 483 
Line 499 
  
 // Return the number of CIM objects in the CIM Response data object // Return the number of CIM objects in the CIM Response data object
 // //
   #define TEMPLOG PEG_TRACE((TRC_XML, Tracer::LEVEL4, \
    "rtnSize %u size %u", rtnSize, _size))
   
 Uint32 CIMResponseData::size() Uint32 CIMResponseData::size()
 { {
     PEG_METHOD_ENTER(TRC_XML,"CIMResponseData::size()");     PEG_METHOD_ENTER(TRC_XML,"CIMResponseData::size()");
       SVALID();
 // If debug mode, add up all the individual size components to // If debug mode, add up all the individual size components to
 // determine overall size of this object.  Then compare this with // determine overall size of this object.  Then compare this with
 // the _size variable.  this is a good check on the completeness of the // the _size variable.  this is a good check on the completeness of the
Line 497 
Line 516 
     PEGASUS_ASSERT(valid());            //KS_TEMP     PEGASUS_ASSERT(valid());            //KS_TEMP
  
     Uint32 rtnSize = 0;     Uint32 rtnSize = 0;
       TEMPLOG;
     if (RESP_ENC_XML == (_encoding & RESP_ENC_XML))     if (RESP_ENC_XML == (_encoding & RESP_ENC_XML))
     {     {
           TEMPLOG;
         switch (_dataType)         switch (_dataType)
         {         {
             case RESP_OBJECTPATHS:             case RESP_OBJECTPATHS:
Line 512 
Line 533 
                 rtnSize += _instanceData.size();                 rtnSize += _instanceData.size();
                 break;                 break;
         }         }
           SVALID();
           TEMPLOG;
     }     }
     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))
     {     {
           TEMPLOG;
         // KS_PULL_TODO         // KS_PULL_TODO
         // Cannot resolve this one without actually processing         // Cannot resolve this one without actually processing
         // the data since it is a stream.         // the data since it is a stream.
         rtnSize += 0;         rtnSize += 0;
         //PEGASUS_ASSERT(false);         //PEGASUS_ASSERT(false);
           TEMPLOG;
     }     }
  
     if (RESP_ENC_SCMO == (_encoding & RESP_ENC_SCMO))     if (RESP_ENC_SCMO == (_encoding & RESP_ENC_SCMO))
     {     {
           SVALID();
           TEMPLOG;
         rtnSize += _scmoInstances.size();         rtnSize += _scmoInstances.size();
           TEMPLOG;
     }     }
  
     if (RESP_ENC_CIM == (_encoding & RESP_ENC_CIM))     if (RESP_ENC_CIM == (_encoding & RESP_ENC_CIM))
     {     {
           SVALID();
           TEMPLOG;
         switch (_dataType)         switch (_dataType)
         {         {
             case RESP_OBJECTPATHS:             case RESP_OBJECTPATHS:
Line 543 
Line 573 
                 rtnSize += _objects.size();                 rtnSize += _objects.size();
                 break;                 break;
         }         }
           SVALID();
           TEMPLOG;
     }     }
     // Test of actual count against _size variable.     // Test of actual count against _size variable.
     if (rtnSize != _size)     if (rtnSize != _size)
     {     {
           SVALID();
           TEMPLOG;
         PEG_TRACE((TRC_XML, Tracer::LEVEL1,         PEG_TRACE((TRC_XML, Tracer::LEVEL1,
         "CIMResponseData::size ERROR. debug size mismatch."         "CIMResponseData::size ERROR. debug size mismatch."
             "Computed = %u. variable = %u",rtnSize, _size ));             "Computed = %u. variable = %u",rtnSize, _size ));
         // KS_TEMP         // KS_TEMP
         cout << "Size err " << rtnSize << " " << _size << endl;         cout << "Size err " << rtnSize << " " << _size << endl;
           TEMPLOG;
     }     }
     //PEGASUS_TEST_ASSERT(rtnSize == _size);     //PEGASUS_TEST_ASSERT(rtnSize == _size);
 #endif #endif
Line 602 
Line 637 
     PEG_METHOD_ENTER(TRC_DISPATCHER,     PEG_METHOD_ENTER(TRC_DISPATCHER,
         "CIMResponseData::encodeBinaryResponse");         "CIMResponseData::encodeBinaryResponse");
  
       SVALID();
   
     // Need to do a complete job here by transferring all contained data     // Need to do a complete job here by transferring all contained data
     // into binary format and handing it out in the CIMBuffer     // into binary format and handing it out in the CIMBuffer
     // KS_TODO     // KS_TODO
     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))
     {     {
           PEGASUS_ASSERT(false);   // KS_TEMP
         // Binary does NOT need a marker as it consists of C++ and SCMO         // Binary does NOT need a marker as it consists of C++ and SCMO
         const Array<Uint8>& data = _binaryData;         const Array<Uint8>& data = _binaryData;
         out.putBytes(data.getData(), data.size());         out.putBytes(data.getData(), data.size());
Line 694 
Line 732 
                         p.setNameSpace(nsName);                         p.setNameSpace(nsName);
                     }                     }
                 }                 }
                   break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
             {             {
Line 1006 
Line 1045 
             {             {
                 if (_instances.size() > 0)                 if (_instances.size() > 0)
                 {                 {
                     XmlWriter::appendInstanceElement(out, _instances[0]);                      XmlWriter::appendInstanceElement(
                           out,
                           _instances[0],
                           _includeQualifiers,
                           _includeClassOrigin,
                           _propertyList);
                 }                 }
                 break;                 break;
             }             }
Line 1017 
Line 1061 
                     if (isPullResponse)                     if (isPullResponse)
                     {                     {
                         XmlWriter::appendValueInstanceWithPathElement(                         XmlWriter::appendValueInstanceWithPathElement(
                             out, _instances[i]);                              out,
                               _instances[i],
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                     }                     }
                     else                     else
                     {                     {
                         XmlWriter::appendValueNamedInstanceElement(                         XmlWriter::appendValueNamedInstanceElement(
                             out, _instances[i]);                              out,
                               _instances[i],
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                     }                     }
   
                 }                 }
                 break;                 break;
             }             }
Line 1036 
Line 1089 
                     {                     {
                         CIMInstance x = (CIMInstance)_objects[i];                         CIMInstance x = (CIMInstance)_objects[i];
                         XmlWriter::appendValueInstanceWithPathElement(                         XmlWriter::appendValueInstanceWithPathElement(
                             out, x);                              out, x,
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                     }                     }
                     else                     else
                     {                     {
                         XmlWriter::appendValueObjectWithPathElement(                         XmlWriter::appendValueObjectWithPathElement(
                             out,_objects[i]);                              out,
                               _objects[i],
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                     }                     }
   
                 }                 }
                 break;                 break;
             }             }
Line 1087 
Line 1148 
                     SCMOXmlWriter::appendInstanceNameElement(                     SCMOXmlWriter::appendInstanceNameElement(
                         out,                         out,
                         _scmoInstances[i]);                         _scmoInstances[i]);
   
                 }                 }
                 break;                 break;
             }             }
Line 1094 
Line 1156 
             {             {
                 if (_scmoInstances.size() > 0)                 if (_scmoInstances.size() > 0)
                 {                 {
                     SCMOXmlWriter::appendInstanceElement(out,_scmoInstances[0]);                      if(_propertyList.isNull())
                       {
                           Array<Uint32> emptyNodes;
                           SCMOXmlWriter::appendInstanceElement(
                               out,
                               _scmoInstances[0],
                               false,
                               emptyNodes);
                       }
                       else
                       {
                           Array<propertyFilterNodesArray_t> propFilterNodesArrays;
                           // This searches for an already created array of nodes,
                           //if not found, creates it inside propFilterNodesArrays
                           const Array<Uint32> & nodes=
                               SCMOXmlWriter::getFilteredNodesArray(
                                   propFilterNodesArrays,
                                   _scmoInstances[0],
                                   _propertyList);
                           SCMOXmlWriter::appendInstanceElement(
                               out,
                               _scmoInstances[0],
                               true,
                               nodes);
                       }
                 }                 }
                 break;                 break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
             {             {
                 for (Uint32 i = 0, n = _scmoInstances.size(); i < n; i++)  
                 {  
                     if (isPullResponse)                     if (isPullResponse)
                     {                     {
                         SCMOXmlWriter::appendValueSCMOInstanceWithPathElement(                      SCMOXmlWriter::appendValueSCMOInstanceWithPathElements(
                             out, _scmoInstances[i]);                          out, _scmoInstances, _propertyList);
                     }                     }
                     else                     else
                     {                     {
                         SCMOXmlWriter::appendValueSCMOInstanceElement(                      SCMOXmlWriter::appendValueSCMOInstanceElements(
                             out, _scmoInstances[i]);                          out, _scmoInstances, _propertyList);
                     }  
                 }                 }
   
                 break;                 break;
             }             }
             case RESP_OBJECTS:             case RESP_OBJECTS:
             {             {
                 for (Uint32 i = 0; i < _scmoInstances.size(); i++)  
                 {  
                     if (isPullResponse)                     if (isPullResponse)
                     {                     {
                         SCMOXmlWriter::appendValueSCMOInstanceWithPathElement(                      SCMOXmlWriter::appendValueSCMOInstanceWithPathElements(
                             out,_scmoInstances[i]);                          out,_scmoInstances, _propertyList);
                     }                     }
                     else                     else
                     {                     {
                       // KS_TODO why is this one named element rather than
                       // elements
                         SCMOXmlWriter::appendValueObjectWithPathElement(                         SCMOXmlWriter::appendValueObjectWithPathElement(
                             out, _scmoInstances[i]);                          out, _scmoInstances, _propertyList);
                     }  
                 }                 }
   
                 break;                 break;
             }             }
             case RESP_OBJECTPATHS:             case RESP_OBJECTPATHS:
Line 1191 
Line 1275 
                 if (0 == _instances.size())                 if (0 == _instances.size())
                 {                 {
                     _instances.append(CIMInstance());                     _instances.append(CIMInstance());
                       CIMInternalXmlEncoder::_putXMLInstance(
                           out,
                           _instances[0]);
                       break;
                 }                 }
                 CIMInternalXmlEncoder::_putXMLInstance(out, _instances[0]);                  CIMInternalXmlEncoder::_putXMLInstance(
                       out,
                       _instances[0],
                       _includeQualifiers,
                       _includeClassOrigin,
                       _propertyList);
                 break;                 break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
Line 1204 
Line 1297 
                 {                 {
                     CIMInternalXmlEncoder::_putXMLNamedInstance(                     CIMInternalXmlEncoder::_putXMLNamedInstance(
                         out,                         out,
                         _instances[i]);                          _instances[i],
                           _includeQualifiers,
                           _includeClassOrigin,
                           _propertyList);
                 }                 }
                 break;                 break;
             }             }
Line 1215 
Line 1311 
                 out.putUint32(totalSize);                 out.putUint32(totalSize);
                 for (Uint32 i = 0; i < n; i++)                 for (Uint32 i = 0; i < n; i++)
                 {                 {
                     CIMInternalXmlEncoder::_putXMLObject(out, _objects[i]);                      CIMInternalXmlEncoder::_putXMLObject(
                           out,
                           _objects[i],
                           _includeQualifiers,
                           _includeClassOrigin,
                           _propertyList);
                 }                 }
                 break;                 break;
             }             }
Line 1239 
Line 1340 
                 {                 {
                     _scmoInstances.append(SCMOInstance());                     _scmoInstances.append(SCMOInstance());
                 }                 }
                 SCMOInternalXmlEncoder::_putXMLInstance(out, _scmoInstances[0]);                  SCMOInternalXmlEncoder::_putXMLInstance(
                       out,
                       _scmoInstances[0],
                       _propertyList);
                 break;                 break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
Line 1250 
Line 1354 
                 {                 {
                     out.putUint32(n);                     out.putUint32(n);
                 }                 }
                 for (Uint32 i = 0; i < n; i++)  
                 {  
                     SCMOInternalXmlEncoder::_putXMLNamedInstance(                     SCMOInternalXmlEncoder::_putXMLNamedInstance(
                             out,                             out,
                             _scmoInstances[i]);                      _scmoInstances,
                 }                      _propertyList);
                 break;                 break;
             }             }
             case RESP_OBJECTS:             case RESP_OBJECTS:
Line 1266 
Line 1368 
                 {                 {
                     out.putUint32(n);                     out.putUint32(n);
                 }                 }
                 for (Uint32 i = 0; i < n; i++)  
                 {  
                     SCMOInternalXmlEncoder::_putXMLObject(                     SCMOInternalXmlEncoder::_putXMLObject(
                         out,                         out,
                         _scmoInstances[i]);                      _scmoInstances,
                 }                      _propertyList);
                 break;                 break;
             }             }
             // internal xml encoding of instance names and object paths not             // internal xml encoding of instance names and object paths not
Line 1284 
Line 1384 
             }             }
         }         }
     }     }
   
 } }
  
 void CIMResponseData::_resolveToCIM() void CIMResponseData::_resolveToCIM()
Line 1777 
Line 1878 
     return _magic;     return _magic;
 } }
  
   void CIMResponseData::setRequestProperties(
       const Boolean includeQualifiers,
       const Boolean includeClassOrigin,
       const CIMPropertyList& propertyList)
   {
       _includeQualifiers = includeQualifiers;
       _includeClassOrigin = includeClassOrigin;
       _propertyList = propertyList;
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.5.2.2  
changed lines
  Added in v.1.5.2.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2