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

  1 mike  1.4 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3           // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a copy
  6           // of this software and associated documentation files (the "Software"), to 
  7           // deal in the Software without restriction, including without limitation the 
  8           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9           // sell copies of the Software, and to permit persons to whom the Software is
 10           // furnished to do so, subject to the following conditions:
 11           // 
 12           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20           //
 21           //==============================================================================
 22 mike  1.4 //
 23           // Author: Mike Brasher (mbrasher@bmc.com)
 24           //
 25           // Modified By:
 26           //
 27           //%/////////////////////////////////////////////////////////////////////////////
 28           
 29           #include "CIMObject.h"
 30           #include "XmlWriter.h"
 31           
 32           PEGASUS_USING_STD;
 33           
 34           PEGASUS_NAMESPACE_BEGIN
 35           
 36           ////////////////////////////////////////////////////////////////////////////////
 37           //
 38           // CIMObject
 39           //
 40           ////////////////////////////////////////////////////////////////////////////////
 41           
 42           CIMClass CIMObject::getClass()
 43 mike  1.4 {
 44               if (!isClass())
 45           	throw TypeMismatch();
 46           
 47               return CIMClass((CIMClassRep*)_rep);
 48           }
 49           
 50           CIMConstClass CIMObject::getClass() const
 51           {
 52               if (!isInstance())
 53           	throw TypeMismatch();
 54           
 55               return CIMConstClass((CIMClassRep*)_rep);
 56           }
 57           
 58           CIMInstance CIMObject::getInstance()
 59           {
 60               if (!isInstance())
 61           	throw TypeMismatch();
 62           
 63               return CIMInstance((CIMInstanceRep*)_rep);
 64 mike  1.4 }
 65           
 66           CIMConstInstance CIMObject::getInstance() const
 67           {
 68               if (!isInstance())
 69           	throw TypeMismatch();
 70           
 71               return CIMConstInstance((CIMInstanceRep*)_rep);
 72           }
 73           
 74           void CIMObject::toXml(Array<Sint8>& out) const
 75           {
 76               if (!_rep)
 77           	throw NullPointer();
 78           
 79               if (isClass())
 80               {
 81           	CIMConstClass cimClass = getClass();
 82           	cimClass.toXml(out);
 83               }
 84               else
 85 mike  1.4     {
 86           	CIMConstInstance cimInstance = getInstance();
 87           	cimInstance.toXml(out);
 88               }
 89           }
 90           
 91           ////////////////////////////////////////////////////////////////////////////////
 92           //
 93           // CIMObjectWithPath
 94           //
 95           ////////////////////////////////////////////////////////////////////////////////
 96           
 97           CIMObjectWithPath::CIMObjectWithPath()
 98           {
 99           
100           }
101           
102           CIMObjectWithPath::CIMObjectWithPath(
103               const CIMReference& reference,
104               const CIMObject& object) 
105               : _reference(reference), _object(object)
106 mike  1.4 {
107           
108           }
109           
110           CIMObjectWithPath::CIMObjectWithPath(const CIMObjectWithPath& x)
111               : _reference(x._reference), _object(x._object)
112           {
113           
114           }
115           
116           CIMObjectWithPath::~CIMObjectWithPath()
117           {
118           
119           }
120           
121           CIMObjectWithPath& CIMObjectWithPath::operator=(const CIMObjectWithPath& x)
122           {
123               if (this != &x)
124               {
125           	_reference = x._reference;
126           	_object = x._object;
127 mike  1.4     }
128               return *this;
129           }
130           
131           void CIMObjectWithPath::set(
132               const CIMReference& reference, 
133               const CIMObject& object)
134           {
135               _reference = reference;
136               _object = object;
137           }
138           
139           //------------------------------------------------------------------------------
140           //
141           // <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))>
142           //
143           //------------------------------------------------------------------------------
144           
145           void CIMObjectWithPath::toXml(Array<Sint8>& out) const
146           {
147               out << "<VALUE.OBJECTWITHPATH>\n";
148 mike  1.4 
149               _reference.toXml(out, false);
150               _object.toXml(out);
151           
152               out << "</VALUE.OBJECTWITHPATH>\n";
153           }
154           
155           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2