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

Diff for /pegasus/src/Pegasus/Common/CIMMethodRep.cpp between version 1.8 and 1.23

version 1.8, 2001/05/20 20:33:59 version 1.23, 2002/05/15 12:28:21
Line 1 
Line 1 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a  // Permission is hereby granted, free of charge, to any person obtaining a copy
 // copy of this software and associated documentation files (the "Software"),  // of this software and associated documentation files (the "Software"), to
 // to deal in the Software without restriction, including without limitation  // deal in the Software without restriction, including without limitation the
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,  // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // and/or sell copies of the Software, and to permit persons to whom the  // sell copies of the Software, and to permit persons to whom the Software is
 // Software is furnished to do so, subject to the following conditions:  // furnished to do so, subject to the following conditions:
 // //
 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL  // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 // DEALINGS IN THE SOFTWARE.  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // //
 //============================================================================== //==============================================================================
 // //
Line 25 
Line 26 
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
   #include <Pegasus/Common/Config.h>
 #include <cassert> #include <cassert>
 #include "CIMMethod.h" #include "CIMMethod.h"
   #include "CIMMethodRep.h"
 #include "Indentor.h" #include "Indentor.h"
 #include "CIMName.h" #include "CIMName.h"
 #include "CIMScope.h" #include "CIMScope.h"
 #include "XmlWriter.h" #include "XmlWriter.h"
   #include "MofWriter.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 75 
Line 79 
  
 void CIMMethodRep::addParameter(const CIMParameter& x) void CIMMethodRep::addParameter(const CIMParameter& x)
 { {
     if (!x)      if (x.isNull())
         throw UnitializedHandle();          throw UninitializedHandle();
  
     if (findParameter(x.getName()) != Uint32(-1))      if (findParameter(x.getName()) != PEG_NOT_FOUND)
         throw AlreadyExists();         throw AlreadyExists();
  
     _parameters.append(x);     _parameters.append(x);
 } }
  
 Uint32 CIMMethodRep::findParameter(const String& name)  Uint32 CIMMethodRep::findParameter(const String& name) const
 { {
     for (Uint32 i = 0, n = _parameters.size(); i < n; i++)     for (Uint32 i = 0, n = _parameters.size(); i < n; i++)
     {     {
Line 92 
Line 96 
             return i;             return i;
     }     }
  
     return Uint32(-1);      return PEG_NOT_FOUND;
 } }
  
 CIMParameter CIMMethodRep::getParameter(Uint32 pos) CIMParameter CIMMethodRep::getParameter(Uint32 pos)
Line 118 
Line 122 
  
     // Check for type mismatch between return types.     // Check for type mismatch between return types.
  
     assert (inheritedMethod);      assert (!inheritedMethod.isNull());
  
     // Validate the qualifiers of the method (according to     // Validate the qualifiers of the method (according to
     // superClass's method with the same name). This method     // superClass's method with the same name). This method
Line 129 
Line 133 
         nameSpace,         nameSpace,
         CIMScope::METHOD,         CIMScope::METHOD,
         false,         false,
         inheritedMethod._rep->_qualifiers);          inheritedMethod._rep->_qualifiers,
           true);
  
     // Validate each of the parameters:     // Validate each of the parameters:
  
Line 152 
Line 157 
         nameSpace,         nameSpace,
         CIMScope::METHOD,         CIMScope::METHOD,
         false,         false,
         dummy);          dummy,
           true);
  
     // Validate each of the parameters:     // Validate each of the parameters:
  
Line 171 
Line 177 
  
     out << " NAME=\"" << _name << "\"";     out << " NAME=\"" << _name << "\"";
  
     out << " TYPE=\"" << TypeToString(_type) << "\"";      out << " TYPE=\"" << _type.toString() << "\"";
  
     if (_classOrigin.size())     if (_classOrigin.size())
         out << " CLASSORIGIN=\"" << _classOrigin << "\"";         out << " CLASSORIGIN=\"" << _classOrigin << "\"";
Line 184 
Line 190 
     _qualifiers.toXml(out);     _qualifiers.toXml(out);
  
     for (Uint32 i = 0, n = _parameters.size(); i < n; i++)     for (Uint32 i = 0, n = _parameters.size(); i < n; i++)
         _parameters[i].toXml(out);          XmlWriter::appendParameterElement(out, _parameters[i]);
  
     out << "</METHOD>\n";     out << "</METHOD>\n";
 } }
  
 void CIMMethodRep::print(PEGASUS_STD(ostream) &os) const  /**
       The BNF for this is;
       methodDeclaration   =  [ qualifierList ] dataType methodName
                              "(" [ parameterList ] ")" ";"
   
       parameterList       =  parameter *( "," parameter )
       Format with qualifiers on one line and declaration on another. Start
       with newline but none at the end.
   */
   void CIMMethodRep::toMof(Array<Sint8>& out) const   //ATTNKS:
   {
       // Output the qualifier list starting on new line
       if (_qualifiers.getCount())
           out << "\n";
   
       _qualifiers.toMof(out);
   
       // output the type, MethodName and ParmeterList left enclosure
       out << "\n" << _type.toString() << " " << _name << "(";
   
       // output the param list separated by commas.
   
       for (Uint32 i = 0, n = _parameters.size(); i < n; i++)
 { {
     Array<Sint8> tmp;          // If not first, output comma separator
     toXml(tmp);          if (i)
     tmp.append('\0');              out << ", ";
     os << tmp.getData() << PEGASUS_STD(endl);  
           MofWriter::appendParameterElement(out, _parameters[i]);
 } }
  
       // output the parameterlist and method terminator
       out << ");";
   }
   
   
 CIMMethodRep::CIMMethodRep() CIMMethodRep::CIMMethodRep()
 { {
  
Line 217 
Line 251 
         _parameters.append(x._parameters[i].clone());         _parameters.append(x._parameters[i].clone());
 } }
  
 CIMMethodRep& CIMMethodRep::operator=(const CIMMethodRep& x)  
 {  
     return *this;  
 }  
   
 Boolean CIMMethodRep::identical(const CIMMethodRep* x) const Boolean CIMMethodRep::identical(const CIMMethodRep* x) const
 { {
     if (_name != x->_name)     if (_name != x->_name)


Legend:
Removed from v.1.8  
changed lines
  Added in v.1.23

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2