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

Diff for /pegasus/src/Pegasus/Common/CIMParameterRep.cpp between version 1.34 and 1.36.2.2

version 1.34, 2005/01/16 02:34:59 version 1.36.2.2, 2005/09/30 20:35:55
Line 1 
Line 1 
 //%2004////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 6 
Line 6 
 // IBM Corp.; EMC Corporation, The Open Group. // IBM Corp.; EMC Corporation, The Open Group.
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 45 
Line 47 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   CIMParameterRep::CIMParameterRep()
   {
   }
   
   CIMParameterRep::CIMParameterRep(const CIMParameterRep& x) :
       Sharable(),
       _name(x._name),
       _type(x._type),
       _isArray(x._isArray),
       _arraySize(x._arraySize),
       _referenceClassName(x._referenceClassName)
   {
       x._qualifiers.cloneTo(_qualifiers);
   }
   
 CIMParameterRep::CIMParameterRep( CIMParameterRep::CIMParameterRep(
     const CIMName& name,     const CIMName& name,
     CIMType type,     CIMType type,
Line 55 
Line 72 
     _isArray(isArray), _arraySize(arraySize),     _isArray(isArray), _arraySize(arraySize),
     _referenceClassName(referenceClassName)     _referenceClassName(referenceClassName)
 { {
     if (_arraySize && !_isArray)      // ensure name is not null
       if(name.isNull())
       {
           throw UninitializedObjectException();
       }
   
       if((_arraySize != 0) && !_isArray)
       {
         throw TypeMismatchException();         throw TypeMismatchException();
       }
  
     if (!referenceClassName.isNull())     if (!referenceClassName.isNull())
     {     {
Line 68 
Line 93 
     else     else
     {     {
         if (_type == CIMTYPE_REFERENCE)         if (_type == CIMTYPE_REFERENCE)
           {
             throw TypeMismatchException();             throw TypeMismatchException();
     }     }
 } }
   }
  
 CIMParameterRep::~CIMParameterRep() CIMParameterRep::~CIMParameterRep()
 { {
   
 } }
  
 void CIMParameterRep::setName(const CIMName& name) void CIMParameterRep::setName(const CIMName& name)
 { {
       // ensure name is not null
       if(name.isNull())
       {
           throw UninitializedObjectException();
       }
   
     _name = name;     _name = name;
 } }
  
Line 109 
Line 141 
         true);         true);
 } }
  
 void CIMParameterRep::toXml(Array<char>& out) const  void CIMParameterRep::toXml(Buffer& out) const
 { {
     if (_isArray)     if (_isArray)
     {     {
         if (_type == CIMTYPE_REFERENCE)         if (_type == CIMTYPE_REFERENCE)
         {         {
             out << "<PARAMETER.REFARRAY";              out << LIT("<PARAMETER.REFARRAY");
             out << " NAME=\"" << _name << "\"";              out << LIT(" NAME=\"") << _name;
               out.append('"');
  
             if (!_referenceClassName.isNull())             if (!_referenceClassName.isNull())
             {             {
                 out << " REFERENCECLASS=\"" << _referenceClassName.getString()                  out << LIT(" REFERENCECLASS=\"");
                     << "\"";                  out << _referenceClassName.getString();
                   out.append('"');
             }             }
  
                         if (_arraySize)                         if (_arraySize)
             {             {
                 char buffer[32];                 char buffer[32];
                 sprintf(buffer, "%d", _arraySize);                 sprintf(buffer, "%d", _arraySize);
                 out << " ARRAYSIZE=\"" << buffer << "\"";                  out << LIT(" ARRAYSIZE=\"") << buffer;
                   out.append('"');
             }             }
  
             out << ">\n";              out << LIT(">\n");
  
             _qualifiers.toXml(out);             _qualifiers.toXml(out);
  
             out << "</PARAMETER.REFARRAY>\n";              out << LIT("</PARAMETER.REFARRAY>\n");
         }         }
         else         else
         {         {
             out << "<PARAMETER.ARRAY";              out << LIT("<PARAMETER.ARRAY");
             out << " NAME=\"" << _name << "\" ";              out << LIT(" NAME=\"") << _name << LIT("\" ");
             out << " TYPE=\"" << cimTypeToString (_type) << "\"";              out << LIT(" TYPE=\"") << cimTypeToString (_type);
               out.append('"');
  
             if (_arraySize)             if (_arraySize)
             {             {
                 char buffer[32];                 char buffer[32];
                 sprintf(buffer, "%d", _arraySize);                 sprintf(buffer, "%d", _arraySize);
                 out << " ARRAYSIZE=\"" << buffer << "\"";                  out << LIT(" ARRAYSIZE=\"") << buffer;
                   out.append('"');
             }             }
  
             out << ">\n";              out << LIT(">\n");
  
             _qualifiers.toXml(out);             _qualifiers.toXml(out);
  
             out << "</PARAMETER.ARRAY>\n";              out << LIT("</PARAMETER.ARRAY>\n");
         }         }
     }     }
     else if (_type == CIMTYPE_REFERENCE)     else if (_type == CIMTYPE_REFERENCE)
     {     {
         out << "<PARAMETER.REFERENCE";          out << LIT("<PARAMETER.REFERENCE");
         out << " NAME=\"" << _name << "\"";          out << LIT(" NAME=\"") << _name;
           out.append('"');
   
         if (!_referenceClassName.isNull())         if (!_referenceClassName.isNull())
         {         {
             out << " REFERENCECLASS=\"" << _referenceClassName.getString() <<              out << LIT(" REFERENCECLASS=\"");
                    "\"";              out << _referenceClassName.getString();
               out.append('"');
         }         }
         out << ">\n";          out << LIT(">\n");
  
         _qualifiers.toXml(out);         _qualifiers.toXml(out);
  
         out << "</PARAMETER.REFERENCE>\n";          out << LIT("</PARAMETER.REFERENCE>\n");
     }     }
     else     else
     {     {
         out << "<PARAMETER";          out << LIT("<PARAMETER");
         out << " NAME=\"" << _name << "\" ";          out << LIT(" NAME=\"") << _name << LIT("\" ");
         out << " TYPE=\"" << cimTypeToString (_type) << "\"";          out << LIT(" TYPE=\"") << cimTypeToString (_type);
         out << ">\n";          out.append('"');
           out << LIT(">\n");
  
         _qualifiers.toXml(out);         _qualifiers.toXml(out);
  
         out << "</PARAMETER>\n";          out << LIT("</PARAMETER>\n");
     }     }
 } }
  
Line 199 
Line 240 
  
     Format on a single line.     Format on a single line.
     */     */
 void CIMParameterRep::toMof(Array<char>& out) const  void CIMParameterRep::toMof(Buffer& out) const
 { {
     // Output the qualifiers for the parameter     // Output the qualifiers for the parameter
     _qualifiers.toMof(out);     _qualifiers.toMof(out);
  
     if (_qualifiers.getCount())     if (_qualifiers.getCount())
         out << " ";          out.append(' ');
  
     // Output the data type and name     // Output the data type and name
     out << cimTypeToString (_type) << " " <<  _name;      out << cimTypeToString (_type);
       out.append(' ');
       out << _name;
  
     if (_isArray)     if (_isArray)
     {     {
Line 220 
Line 263 
             out << buffer;             out << buffer;
         }         }
         else         else
             out << "[]";              out << LIT("[]");
     }     }
 } }
  
Line 242 
Line 285 
     return true;     return true;
 } }
  
 CIMParameterRep::CIMParameterRep()  
 {  
   
 }  
   
 CIMParameterRep::CIMParameterRep(const CIMParameterRep& x) :  
     Sharable(),  
     _name(x._name),  
     _type(x._type),  
     _isArray(x._isArray),  
     _arraySize(x._arraySize),  
     _referenceClassName(x._referenceClassName)  
 {  
     x._qualifiers.cloneTo(_qualifiers);  
 }  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.34  
changed lines
  Added in v.1.36.2.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2