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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2