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

Diff for /pegasus/src/Pegasus/Common/CIMParamValueRep.cpp between version 1.3 and 1.4

version 1.3, 2002/01/28 15:26:48 version 1.4, 2002/02/20 03:51:29
Line 23 
Line 23 
 // //
 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
 // //
 // Modified By:  // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <cstdio> #include <cstdio>
 #include "CIMParamValue.h"  
 #include "Indentor.h"  
 #include "CIMName.h"  
 #include "CIMScope.h"  
 #include "XmlWriter.h" #include "XmlWriter.h"
   #include "CIMParamValue.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 CIMParamValueRep::CIMParamValueRep( CIMParamValueRep::CIMParamValueRep(
     CIMParameter parameter,     CIMParameter parameter,
     CIMValue value,      CIMValue value)
     Boolean isArray,      : _parameter(parameter), _value(value)
     Uint32 arraySize,  
     const String& referenceClassName)  
     : _parameter(parameter), _value(value),  
     _isArray(isArray), _arraySize(arraySize),  
     _referenceClassName(referenceClassName)  
 {  
     if (_arraySize && !_isArray)  
         throw IncompatibleTypes();  
   
     if (referenceClassName.size())  
     {     {
         if (!CIMName::legal(referenceClassName))  
             throw IllegalName();  
     }  
 } }
  
 CIMParamValueRep::~CIMParamValueRep() CIMParamValueRep::~CIMParamValueRep()
Line 62 
Line 46 
  
 } }
  
 void CIMParamValueRep::resolve(  //------------------------------------------------------------------------------
     DeclContext* declContext,  //
     const String& nameSpace)  //     <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?>
 {  //     <!ATTLIST PARAMVALUE
     // Validate the qualifiers of the method (according to  //         %CIMName;
     // superClass's method with the same name). This method  //         %ParamType;>
     // will throw an exception if the validation fails.  //
   //------------------------------------------------------------------------------
     CIMQualifierList dummy;  
   
     _qualifiers.resolve(  
         declContext,  
         nameSpace,  
         CIMScope::PARAMETER,  
         false,  
         dummy);  
 }  
   
 void CIMParamValueRep::toXml(Array<Sint8>& out) const void CIMParamValueRep::toXml(Array<Sint8>& out) const
 { {
     if (_isArray)      out << "<PARAMVALUE NAME=\"" << _parameter.getName() << "\"";
     {  
         out << " ARGUMENT.ARRAY";  
   
         out << " PARAMETER_NAME=\"" << _parameter.getName() << "\"";  
  
         out << " PARAMETER_TYPE=\"" << TypeToString(_parameter.getType()) << "\"";      // ATTN-RK-P2-20010219: Should this type come from the Parameter or Value?
       CIMType type = _value.getType();
  
         out << " VALUE=\"";      if (type != CIMType::NONE)
         _value.toXml(out);  
         out << "\"";  
   
         if (_arraySize)  
         {         {
             char buffer[32];          out << " PARAMTYPE=\"" << TypeToString(type) << "\"";
             sprintf(buffer, "%d", _arraySize);  
             out << " ARRAYSIZE=\"" << buffer << "\"";  
         }         }
  
         out << ">\n";         out << ">\n";
  
         _qualifiers.toXml(out);  
   
         out << "</PARAMETER.ARRAY>\n";  
     }  
     else  
     {  
         out << " ARGUMENT";  
         out << " PARAMETER.NAME=\"" << _parameter.getName() << "\"";  
         out << " PARAMETER.TYPE=\"" << TypeToString(_parameter.getType()) << "\"";  
         out << " PARAMETER.VALUE=\"";  
         _value.toXml(out);  
         out << "\"";  
         out << ">\n";  
         _qualifiers.toXml(out);  
         out << "</ARGUMENT>\n";  
     }  
 }  
   
 /** toMof - puts the Mof representation of the ParamValue object to  
     the output parameter array  
     The BNF for this conversion is:  
     parameterList    =  parameter *( "," parameter )  
   
         parameter    =  [ qualifierList ] (dataType|objectRef) parameterName  
                                 [ array ]  
   
         parameterName=  IDENTIFIER  
   
         array        =  "[" [positiveDecimalValue] "]"  
   
     Format on a single line.  
     */  
 void CIMParamValueRep::toMof(Array<Sint8>& out) const  
 {  
     // Output the qualifiers for the parameter  
     _qualifiers.toMof(out);  
   
     if (_qualifiers.getCount())  
         out << " ";  
   
     // Output the data parameter and value  
     out << _parameter.getName()  
         << " " << TypeToString(_parameter.getType())  
         << " ";  
     _value.toXml(out);     _value.toXml(out);
  
     if (_isArray)      out << "</PARAMVALUE>\n";
     {  
         //Output the array indicator "[ [arraysize] ]"  
         if (_arraySize)  
         {  
             char buffer[32];  
             sprintf(buffer, "[%d]", _arraySize);  
             out << buffer;  
         }  
         else  
             out << "[]";  
     }  
 } }
  
 void CIMParamValueRep::print(PEGASUS_STD(ostream) &os) const void CIMParamValueRep::print(PEGASUS_STD(ostream) &os) const
Line 179 
Line 89 
     if (_value != x->_value)     if (_value != x->_value)
         return false;         return false;
  
     if (_referenceClassName != x->_referenceClassName)  
         return false;  
   
     if (!_qualifiers.identical(x->_qualifiers))  
         return false;  
   
     return true;     return true;
 } }
  
Line 196 
Line 100 
 CIMParamValueRep::CIMParamValueRep(const CIMParamValueRep& x) : CIMParamValueRep::CIMParamValueRep(const CIMParamValueRep& x) :
     Sharable(),     Sharable(),
     _parameter(x._parameter),     _parameter(x._parameter),
     _value(x._value),      _value(x._value)
     _isArray(x._isArray),  
     _arraySize(x._arraySize),  
     _referenceClassName(x._referenceClassName)  
 { {
     x._qualifiers.cloneTo(_qualifiers);  
 } }
  
   // ATTN-RK-P3-20010219: Is this correct?  (See also CIMMethodRep.cpp,
   // CIMParameterRep.cpp, CIMPropertyRep.cpp, CIMQualifierDeclRep.cpp,
   // CIMQualifierRep.cpp)
 CIMParamValueRep& CIMParamValueRep::operator=(const CIMParamValueRep& x) CIMParamValueRep& CIMParamValueRep::operator=(const CIMParamValueRep& x)
 { {
     return *this;     return *this;
Line 212 
Line 115 
 void CIMParamValueRep::setParameter(CIMParameter parameter) void CIMParamValueRep::setParameter(CIMParameter parameter)
 { {
     _parameter = parameter;     _parameter = parameter;
   
     if (_referenceClassName.size() == 0)  
     {  
         throw MissingReferenceClassName();  
     }  
 } }
  
 void CIMParamValueRep::setValue(CIMValue value) void CIMParamValueRep::setValue(CIMValue value)
 { {
     _value = value;     _value = value;
   
     if (_referenceClassName.size() == 0)  
     {  
         throw MissingReferenceClassName();  
     }  
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2