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

  1 karl  1.20 //%2005////////////////////////////////////////////////////////////////////////
  2 mike  1.2  //
  3 karl  1.18 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.17 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.18 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.20 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 mike  1.2  //
 12            // Permission is hereby granted, free of charge, to any person obtaining a copy
 13 kumpf 1.13 // of this software and associated documentation files (the "Software"), to
 14            // deal in the Software without restriction, including without limitation the
 15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16 mike  1.2  // sell copies of the Software, and to permit persons to whom the Software is
 17            // furnished to do so, subject to the following conditions:
 18 chip  1.22 //
 19 kumpf 1.13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20 mike  1.2  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22 kumpf 1.13 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25 mike  1.2  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27            //
 28            //==============================================================================
 29            //
 30            // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
 31            //
 32 kumpf 1.4  // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 33 kumpf 1.14 //              Carol Ann Krug Graves, Hewlett-Packard Company
 34 david.dillard 1.19 //                  (carolann_graves@hp.com)
 35                    //              David Dillard, VERITAS Software Corp.
 36                    //                  (david.dillard@veritas.com)
 37 mike          1.2  //
 38                    //%/////////////////////////////////////////////////////////////////////////////
 39                    
 40 sage          1.3  #include <Pegasus/Common/Config.h>
 41 mike          1.2  #include <cstdio>
 42 kumpf         1.4  #include "XmlWriter.h"
 43 kumpf         1.8  #include "CIMParamValueRep.h"
 44 mike          1.24 #include "StrLit.h"
 45 mike          1.2  
 46                    PEGASUS_NAMESPACE_BEGIN
 47                    
 48                    CIMParamValueRep::CIMParamValueRep(
 49 kumpf         1.6      String parameterName,
 50                        CIMValue value,
 51                        Boolean isTyped)
 52                        : _parameterName(parameterName), _value(value), _isTyped(isTyped)
 53 mike          1.2  {
 54 chip          1.22     // ensure parameterName is not null
 55                        if(parameterName.size() == 0)
 56                        {
 57                            throw UninitializedObjectException();
 58                        }
 59 mike          1.2  }
 60                    
 61                    CIMParamValueRep::~CIMParamValueRep()
 62                    {
 63                    }
 64                    
 65 kumpf         1.4  //------------------------------------------------------------------------------
 66                    //
 67                    //     <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?>
 68                    //     <!ATTLIST PARAMVALUE
 69                    //         %CIMName;
 70 dave.sudlik   1.21 //         %EmbeddedObject; #IMPLIED
 71 kumpf         1.4  //         %ParamType;>
 72                    //
 73                    //------------------------------------------------------------------------------
 74 mike          1.23 void CIMParamValueRep::toXml(Buffer& out) const
 75 mike          1.2  {
 76 mike          1.24     out << STRLIT("<PARAMVALUE NAME=\"") << _parameterName;
 77                        out.append('"');
 78 mike          1.2  
 79 kumpf         1.4      CIMType type = _value.getType();
 80 mike          1.2  
 81 kumpf         1.15     if (_isTyped)
 82 mike          1.2      {
 83 chip          1.22         // If the property type is CIMObject, then
 84 dave.sudlik   1.21         //   encode the property in CIM-XML as a string with the EMBEDDEDOBJECT attribute
 85                            //   (there is not currently a CIM-XML "object" datatype)
 86                            // else
 87                            //   output the real type
 88                            if (type == CIMTYPE_OBJECT)
 89                            {
 90 mike          1.24             out << STRLIT(" PARAMTYPE=\"string\" EMBEDDEDOBJECT=\"object\"");
 91 dave.sudlik   1.21         }
 92                            else
 93                            {
 94 mike          1.24             out << STRLIT(" PARAMTYPE=\"") << cimTypeToString (type);
 95                    	    out.append('"');
 96 dave.sudlik   1.21         }
 97 mike          1.2      }
 98                    
 99 mike          1.24     out << STRLIT(">\n");
100 kumpf         1.11     XmlWriter::appendValueElement(out, _value);
101 mike          1.2  
102 mike          1.24     out << STRLIT("</PARAMVALUE>\n");
103 mike          1.2  }
104                    
105                    CIMParamValueRep::CIMParamValueRep()
106                    {
107                    }
108                    
109                    CIMParamValueRep::CIMParamValueRep(const CIMParamValueRep& x) :
110                        Sharable(),
111 kumpf         1.6      _parameterName(x._parameterName),
112                        _value(x._value),
113                        _isTyped(x._isTyped)
114 mike          1.2  {
115                    }
116                    
117 kumpf         1.6  void CIMParamValueRep::setParameterName(String& parameterName)
118 chip          1.22 {
119                        // ensure parameterName is not null
120                        if(parameterName.size() == 0)
121                        {
122                            throw UninitializedObjectException();
123                        }
124                    
125 kumpf         1.6      _parameterName = parameterName;
126 mike          1.2  }
127                    
128 kumpf         1.5  void CIMParamValueRep::setValue(CIMValue& value)
129 chip          1.22 {
130 mike          1.2      _value = value;
131 kumpf         1.6  }
132                    
133                    void CIMParamValueRep::setIsTyped(Boolean isTyped)
134 chip          1.22 {
135 kumpf         1.6      _isTyped = isTyped;
136 mike          1.2  }
137                    
138                    PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2