(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.33 and 1.46

version 1.33, 2004/10/17 20:39:16 version 1.46, 2008/03/05 21:31:45
Line 1 
Line 1 
 //%2004////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // 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.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec 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 25 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  
 //  
 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company  
 //                (carolann_graves@hp.com)  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <cstdio> #include <cstdio>
 #include "CIMParameter.h" #include "CIMParameter.h"
 #include "CIMParameterRep.h" #include "CIMParameterRep.h"
 #include "Indentor.h"  
 #include "CIMName.h" #include "CIMName.h"
 #include "CIMScope.h" #include "CIMScope.h"
 #include "XmlWriter.h"  #include "StrLit.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   CIMParameterRep::CIMParameterRep(const CIMParameterRep& x) :
       Sharable(),
       _name(x._name),
       _type(x._type),
       _isArray(x._isArray),
       _arraySize(x._arraySize),
       _referenceClassName(x._referenceClassName),
       _ownerCount(0)
   {
       x._qualifiers.cloneTo(_qualifiers);
       // Set the CIM name tag.
       _nameTag = generateCIMNameTag(_name);
   }
   
 CIMParameterRep::CIMParameterRep( CIMParameterRep::CIMParameterRep(
     const CIMName& name,     const CIMName& name,
     CIMType type,     CIMType type,
Line 51 
Line 63 
     const CIMName& referenceClassName)     const CIMName& referenceClassName)
     : _name(name), _type(type),     : _name(name), _type(type),
     _isArray(isArray), _arraySize(arraySize),     _isArray(isArray), _arraySize(arraySize),
     _referenceClassName(referenceClassName)      _referenceClassName(referenceClassName),
       _ownerCount(0)
   {
       // ensure name is not null
       if (name.isNull())
       {
           throw UninitializedObjectException();
       }
       // Set the CIM name tag.
       _nameTag = generateCIMNameTag(_name);
   
       if ((_arraySize != 0) && !_isArray)
 { {
     if (_arraySize && !_isArray)  
         throw TypeMismatchException();         throw TypeMismatchException();
       }
  
     if (!referenceClassName.isNull())     if (!referenceClassName.isNull())
     {     {
Line 66 
Line 89 
     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();
       }
       if (_ownerCount != 0 && _name != name)
       {
           MessageLoaderParms parms(
               "Common.CIMParameterRep.CONTAINED_PARAMETER_NAMECHANGEDEXCEPTION",
               "Attempted to change the name of a parameter"
                   " already in a container.");
           throw Exception(parms);
       }
     _name = name;     _name = name;
       // Set the CIM name tag.
       _nameTag = generateCIMNameTag(_name);
 } }
  
 void CIMParameterRep::removeQualifier(Uint32 index) void CIMParameterRep::removeQualifier(Uint32 index)
Line 107 
Line 146 
         true);         true);
 } }
  
 void CIMParameterRep::toXml(Array<Sint8>& out) const  Boolean CIMParameterRep::identical(const CIMParameterRep* x) const
 {  
     if (_isArray)  
     {  
         if (_type == CIMTYPE_REFERENCE)  
         {  
             out << "<PARAMETER.REFARRAY";  
             out << " NAME=\"" << _name << "\"";  
   
             if (!_referenceClassName.isNull())  
             {  
                 out << " REFERENCECLASS=\"" << _referenceClassName.getString()  
                     << "\"";  
             }  
   
                         if (_arraySize)  
             {  
                 char buffer[32];  
                 sprintf(buffer, "%d", _arraySize);  
                 out << " ARRAYSIZE=\"" << buffer << "\"";  
             }  
   
             out << ">\n";  
   
             _qualifiers.toXml(out);  
   
             out << "</PARAMETER.REFARRAY>\n";  
         }  
         else  
         {  
             out << "<PARAMETER.ARRAY";  
             out << " NAME=\"" << _name << "\" ";  
             out << " TYPE=\"" << cimTypeToString (_type) << "\"";  
   
             if (_arraySize)  
             {  
                 char buffer[32];  
                 sprintf(buffer, "%d", _arraySize);  
                 out << " ARRAYSIZE=\"" << buffer << "\"";  
             }  
   
             out << ">\n";  
   
             _qualifiers.toXml(out);  
   
             out << "</PARAMETER.ARRAY>\n";  
         }  
     }  
     else if (_type == CIMTYPE_REFERENCE)  
     {  
         out << "<PARAMETER.REFERENCE";  
         out << " NAME=\"" << _name << "\"";  
         if (!_referenceClassName.isNull())  
         {  
             out << " REFERENCECLASS=\"" << _referenceClassName.getString() <<  
                    "\"";  
         }  
         out << ">\n";  
   
         _qualifiers.toXml(out);  
   
         out << "</PARAMETER.REFERENCE>\n";  
     }  
     else  
     {  
         out << "<PARAMETER";  
         out << " NAME=\"" << _name << "\" ";  
         out << " TYPE=\"" << cimTypeToString (_type) << "\"";  
         out << ">\n";  
   
         _qualifiers.toXml(out);  
   
         out << "</PARAMETER>\n";  
     }  
 }  
   
 /** toMof - puts the Mof representation of teh Parameter 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 CIMParameterRep::toMof(Array<Sint8>& out) const  
 {  
     // Output the qualifiers for the parameter  
     _qualifiers.toMof(out);  
   
     if (_qualifiers.getCount())  
         out << " ";  
   
     // Output the data type and name  
     out << cimTypeToString (_type) << " " <<  _name;  
   
     if (_isArray)  
     {     {
         //Output the array indicator "[ [arraysize] ]"      // If the pointers are the same, the objects must be identical
         if (_arraySize)      if (this == x)
         {         {
             char buffer[32];          return true;
             sprintf(buffer, "[%d]", _arraySize);  
             out << buffer;  
         }  
         else  
             out << "[]";  
     }  
 } }
  
   
 Boolean CIMParameterRep::identical(const CIMParameterRep* x) const  
 {  
     if (!_name.equal (x->_name))     if (!_name.equal (x->_name))
         return false;         return false;
  
Line 240 
Line 169 
     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.33  
changed lines
  Added in v.1.46

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2