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

Diff for /pegasus/src/Pegasus/Common/CIMObject.cpp between version 1.25 and 1.48

version 1.25, 2002/08/09 20:55:21 version 1.48, 2011/02/17 14:23:34
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 //  
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  
 // The Open Group, Tivoli Systems  
 //  
 // Permission is hereby granted, free of charge, to any person obtaining a copy  
 // of this software and associated documentation files (the "Software"), to  
 // deal in the Software without restriction, including without limitation the  
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  
 // sell copies of the Software, and to permit persons to whom the Software is  
 // furnished to do so, subject to the following conditions:  
 //  
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
 // 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.  
 // //
 //==============================================================================  // Licensed to The Open Group (TOG) under one or more contributor license
   // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
   // this work for additional information regarding copyright ownership.
   // Each contributor licenses this file to you under the OpenPegasus Open
   // Source License; you may not use this file except in compliance with the
   // License.
   //
   // Permission is hereby granted, free of charge, to any person obtaining a
   // copy of this software and associated documentation files (the "Software"),
   // to deal in the Software without restriction, including without limitation
   // the rights to use, copy, modify, merge, publish, distribute, sublicense,
   // and/or sell copies of the Software, and to permit persons to whom the
   // Software is furnished to do so, subject to the following conditions:
   //
   // The above copyright notice and this permission notice shall be included
   // in all copies or substantial portions of the Software.
   //
   // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 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.
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  //////////////////////////////////////////////////////////////////////////
 //  
 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)  
 //              Carol Ann Krug Graves, Hewlett-Packard Company  
 //                  (carolann_graves@hp.com)  
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 56 
Line 56 
  
 CIMObject::CIMObject(const CIMObject& x) CIMObject::CIMObject(const CIMObject& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMObject::CIMObject(const CIMClass& x) CIMObject::CIMObject(const CIMClass& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMObject::CIMObject(const CIMInstance& x) CIMObject::CIMObject(const CIMInstance& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMObject::CIMObject(CIMObjectRep* rep) CIMObject::CIMObject(CIMObjectRep* rep)
Line 78 
Line 84 
 { {
     if (x._rep != _rep)     if (x._rep != _rep)
     {     {
         Dec(_rep);          if (_rep)
         Inc(_rep = x._rep);              _rep->Dec();
           _rep = x._rep;
           if (_rep)
               _rep->Inc();
     }     }
     return *this;     return *this;
 } }
  
 CIMObject::~CIMObject() CIMObject::~CIMObject()
 { {
     Dec(_rep);      if (_rep)
           _rep->Dec();
 } }
  
 const CIMName& CIMObject::getClassName() const const CIMName& CIMObject::getClassName() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getClassName();     return _rep->getClassName();
 } }
  
 const CIMObjectPath& CIMObject::getPath() const const CIMObjectPath& CIMObject::getPath() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getPath();     return _rep->getPath();
 } }
  
 void CIMObject::setPath (const CIMObjectPath & path) void CIMObject::setPath (const CIMObjectPath & path)
 { {
     _checkRep ();      CheckRep(_rep);
     _rep->setPath (path);     _rep->setPath (path);
 } }
  
 CIMObject& CIMObject::addQualifier(const CIMQualifier& qualifier) CIMObject& CIMObject::addQualifier(const CIMQualifier& qualifier)
 { {
     _checkRep();      CheckRep(_rep);
     _rep->addQualifier(qualifier);     _rep->addQualifier(qualifier);
     return *this;     return *this;
 } }
  
 Uint32 CIMObject::findQualifier(const CIMName& name) const Uint32 CIMObject::findQualifier(const CIMName& name) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->findQualifier(name);     return _rep->findQualifier(name);
 } }
  
 CIMQualifier CIMObject::getQualifier(Uint32 pos)  CIMQualifier CIMObject::getQualifier(Uint32 index)
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getQualifier(pos);      return _rep->getQualifier(index);
 } }
  
 CIMConstQualifier CIMObject::getQualifier(Uint32 pos) const  CIMConstQualifier CIMObject::getQualifier(Uint32 index) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getQualifier(pos);      return _rep->getQualifier(index);
 } }
  
 void CIMObject::removeQualifier(Uint32 pos)  void CIMObject::removeQualifier(Uint32 index)
 { {
     _checkRep();      CheckRep(_rep);
     _rep->removeQualifier(pos);      _rep->removeQualifier(index);
 } }
  
 Uint32 CIMObject::getQualifierCount() const Uint32 CIMObject::getQualifierCount() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getQualifierCount();     return _rep->getQualifierCount();
 } }
  
 CIMObject& CIMObject::addProperty(const CIMProperty& x) CIMObject& CIMObject::addProperty(const CIMProperty& x)
 { {
     _checkRep();      CheckRep(_rep);
     _rep->addProperty(x);     _rep->addProperty(x);
     return *this;     return *this;
 } }
  
 Uint32 CIMObject::findProperty(const CIMName& name) const Uint32 CIMObject::findProperty(const CIMName& name) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->findProperty(name);     return _rep->findProperty(name);
 } }
  
 CIMProperty CIMObject::getProperty(Uint32 pos)  CIMProperty CIMObject::getProperty(Uint32 index)
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getProperty(pos);      return _rep->getProperty(index);
 } }
  
 CIMConstProperty CIMObject::getProperty(Uint32 pos) const  CIMConstProperty CIMObject::getProperty(Uint32 index) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getProperty(pos);      return _rep->getProperty(index);
 } }
  
 void CIMObject::removeProperty(Uint32 pos)  void CIMObject::removeProperty(Uint32 index)
 { {
     _checkRep();      CheckRep(_rep);
     _rep->removeProperty(pos);      _rep->removeProperty(index);
 } }
  
 Uint32 CIMObject::getPropertyCount() const Uint32 CIMObject::getPropertyCount() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getPropertyCount();     return _rep->getPropertyCount();
 } }
  
 Boolean CIMObject::isUninitialized() const Boolean CIMObject::isUninitialized() const
 { {
     return (_rep == 0)? true : false;      return _rep == 0;
 } }
  
 Boolean CIMObject::isClass () const  String CIMObject::toString() const
 { {
     try      CheckRep(_rep);
     {      Buffer out;
         const CIMClass c (*this);  
         return true;      XmlWriter::appendObjectElement(out, *this);
   
       return out.getData();
     }     }
     catch (DynamicCastFailed)  
   Boolean CIMObject::isClass() const
     {     {
         return false;      return Boolean(dynamic_cast<CIMClassRep*>(this->_rep));
     }  
 } }
  
 Boolean CIMObject::isInstance () const Boolean CIMObject::isInstance () const
 { {
     try      return Boolean(dynamic_cast<CIMInstanceRep*>(this->_rep));
     {  
         const CIMInstance i (*this);  
         return true;  
     }  
     catch (DynamicCastFailed)  
     {  
         return false;  
     }  
 } }
  
 Boolean CIMObject::identical(const CIMConstObject& x) const Boolean CIMObject::identical(const CIMConstObject& x) const
 { {
     x._checkRep();      CheckRep(x._rep);
     _checkRep();      CheckRep(_rep);
     return _rep->identical(x._rep);     return _rep->identical(x._rep);
 } }
  
 CIMObject CIMObject::clone() const CIMObject CIMObject::clone() const
 { {
     _checkRep();      CheckRep(_rep);
     return CIMObject(_rep->clone());     return CIMObject(_rep->clone());
 } }
  
 void CIMObject::_checkRep() const  void CIMObject::instanceFilter(
       Boolean includeQualifiers,
       Boolean includeClassOrigin,
       const CIMPropertyList & propertyList)
 { {
     if (!_rep)      CheckRep(_rep);
         ThrowUninitializedObject();      _rep->instanceFilter(includeQualifiers, includeClassOrigin, propertyList);
 } }
  
   
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 // //
 // CIMConstObject // CIMConstObject
Line 244 
Line 252 
  
 CIMConstObject::CIMConstObject(const CIMConstObject& x) CIMConstObject::CIMConstObject(const CIMConstObject& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMConstObject::CIMConstObject(const CIMObject& x) CIMConstObject::CIMConstObject(const CIMObject& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMConstObject::CIMConstObject(const CIMClass& x) CIMConstObject::CIMConstObject(const CIMClass& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMConstObject::CIMConstObject(const CIMConstClass& x) CIMConstObject::CIMConstObject(const CIMConstClass& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMConstObject::CIMConstObject(const CIMInstance& x) CIMConstObject::CIMConstObject(const CIMInstance& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMConstObject::CIMConstObject(const CIMConstInstance& x) CIMConstObject::CIMConstObject(const CIMConstInstance& x)
 { {
     Inc(_rep = x._rep);      _rep = x._rep;
       if (_rep)
           _rep->Inc();
 } }
  
 CIMConstObject& CIMConstObject::operator=(const CIMConstObject& x) CIMConstObject& CIMConstObject::operator=(const CIMConstObject& x)
 { {
     if (x._rep != _rep)     if (x._rep != _rep)
     {     {
         Dec(_rep);          if (_rep)
         Inc(_rep = x._rep);              _rep->Dec();
           _rep = x._rep;
           if (_rep)
               _rep->Inc();
     }     }
     return *this;     return *this;
 } }
  
 CIMConstObject::~CIMConstObject() CIMConstObject::~CIMConstObject()
 { {
     Dec(_rep);      if (_rep)
           _rep->Dec();
 } }
  
 const CIMName& CIMConstObject::getClassName() const const CIMName& CIMConstObject::getClassName() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getClassName();     return _rep->getClassName();
 } }
  
 const CIMObjectPath& CIMConstObject::getPath() const const CIMObjectPath& CIMConstObject::getPath() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getPath();     return _rep->getPath();
 } }
  
 Uint32 CIMConstObject::findQualifier(const CIMName& name) const Uint32 CIMConstObject::findQualifier(const CIMName& name) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->findQualifier(name);     return _rep->findQualifier(name);
 } }
  
 CIMConstQualifier CIMConstObject::getQualifier(Uint32 pos) const  CIMConstQualifier CIMConstObject::getQualifier(Uint32 index) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getQualifier(pos);      return _rep->getQualifier(index);
 } }
  
 Uint32 CIMConstObject::getQualifierCount() const Uint32 CIMConstObject::getQualifierCount() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getQualifierCount();     return _rep->getQualifierCount();
 } }
  
 Uint32 CIMConstObject::findProperty(const CIMName& name) const Uint32 CIMConstObject::findProperty(const CIMName& name) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->findProperty(name);     return _rep->findProperty(name);
 } }
  
 CIMConstProperty CIMConstObject::getProperty(Uint32 pos) const  CIMConstProperty CIMConstObject::getProperty(Uint32 index) const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getProperty(pos);      return _rep->getProperty(index);
 } }
  
 Uint32 CIMConstObject::getPropertyCount() const Uint32 CIMConstObject::getPropertyCount() const
 { {
     _checkRep();      CheckRep(_rep);
     return _rep->getPropertyCount();     return _rep->getPropertyCount();
 } }
  
 Boolean CIMConstObject::isUninitialized() const Boolean CIMConstObject::isUninitialized() const
 { {
     return (_rep == 0)? true : false;      return _rep == 0;
   }
   
   String CIMConstObject::toString() const
   {
       CheckRep(_rep);
       Buffer out;
   
       XmlWriter::appendObjectElement(out, *this);
   
       return out.getData();
   }
   
   Boolean CIMConstObject::isClass() const
   {
       return Boolean(dynamic_cast<CIMClassRep*>(this->_rep));
   }
   
   Boolean CIMConstObject::isInstance() const
   {
       return Boolean(dynamic_cast<CIMInstanceRep*>(this->_rep));
 } }
  
 Boolean CIMConstObject::identical(const CIMConstObject& x) const Boolean CIMConstObject::identical(const CIMConstObject& x) const
 { {
     x._checkRep();      CheckRep(x._rep);
     _checkRep();      CheckRep(_rep);
     return _rep->identical(x._rep);     return _rep->identical(x._rep);
 } }
  
Line 352 
Line 396 
     return CIMObject(_rep->clone());     return CIMObject(_rep->clone());
 } }
  
 void CIMConstObject::_checkRep() const  
 {  
     if (!_rep)  
         ThrowUninitializedObject();  
 }  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.25  
changed lines
  Added in v.1.48

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2