(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.8 and 1.38

version 1.8, 2002/04/30 18:03:11 version 1.38, 2006/11/07 21:30:36
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // 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 20 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  
 //  
 // Modified By:  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
   #include "CIMClassRep.h"
   #include "CIMInstanceRep.h"
   #include "CIMObjectRep.h"
 #include "CIMObject.h" #include "CIMObject.h"
 #include "CIMClass.h" #include "CIMClass.h"
 #include "CIMInstance.h" #include "CIMInstance.h"
Line 33 
Line 41 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   #define PEGASUS_ARRAY_T CIMObject
   # include "ArrayImpl.h"
   #undef PEGASUS_ARRAY_T
   
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 // //
 // CIMObject // CIMObject
 // //
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
   CIMObject::CIMObject()
       : _rep(0)
   {
   }
   
   CIMObject::CIMObject(const CIMObject& x)
   {
       Inc(_rep = x._rep);
   }
   
 CIMObject::CIMObject(const CIMClass& x) CIMObject::CIMObject(const CIMClass& x)
 { {
     Inc(_rep = x._rep);     Inc(_rep = x._rep);
Line 49 
Line 71 
     Inc(_rep = x._rep);     Inc(_rep = x._rep);
 } }
  
 CIMObject& CIMObject::operator=(const CIMClass& x)  CIMObject::CIMObject(CIMObjectRep* rep)
       : _rep(rep)
   {
   }
   
   CIMObject& CIMObject::operator=(const CIMObject& x)
 { {
     if (x._rep != _rep)     if (x._rep != _rep)
     {     {
         if (_rep)          Dec(_rep);
           Inc(_rep = x._rep);
       }
       return *this;
   }
   
   CIMObject::~CIMObject()
         {         {
             Dec(_rep);             Dec(_rep);
         }         }
         Inc(_rep = x._rep);  
   const CIMName& CIMObject::getClassName() const
   {
       _checkRep();
       return _rep->getClassName();
   }
   
   const CIMObjectPath& CIMObject::getPath() const
   {
       _checkRep();
       return _rep->getPath();
     }     }
   
   void CIMObject::setPath (const CIMObjectPath & path)
   {
       _checkRep ();
       _rep->setPath (path);
   }
   
   CIMObject& CIMObject::addQualifier(const CIMQualifier& qualifier)
   {
       _checkRep();
       _rep->addQualifier(qualifier);
     return *this;     return *this;
 } }
  
 CIMObject& CIMObject::operator=(const CIMInstance& x)  Uint32 CIMObject::findQualifier(const CIMName& name) const
 { {
     if (x._rep != _rep)      _checkRep();
       return _rep->findQualifier(name);
   }
   
   CIMQualifier CIMObject::getQualifier(Uint32 index)
     {     {
         if (_rep)      _checkRep();
       return _rep->getQualifier(index);
   }
   
   CIMConstQualifier CIMObject::getQualifier(Uint32 index) const
         {         {
             Dec(_rep);      _checkRep();
       return _rep->getQualifier(index);
         }         }
         Inc(_rep = x._rep);  
   void CIMObject::removeQualifier(Uint32 index)
   {
       _checkRep();
       _rep->removeQualifier(index);
     }     }
   
   Uint32 CIMObject::getQualifierCount() const
   {
       _checkRep();
       return _rep->getQualifierCount();
   }
   
   CIMObject& CIMObject::addProperty(const CIMProperty& x)
   {
       _checkRep();
       _rep->addProperty(x);
     return *this;     return *this;
 } }
  
   Uint32 CIMObject::findProperty(const CIMName& name) const
   {
       _checkRep();
       return _rep->findProperty(name);
   }
   
   CIMProperty CIMObject::getProperty(Uint32 index)
   {
       _checkRep();
       return _rep->getProperty(index);
   }
   
   CIMConstProperty CIMObject::getProperty(Uint32 index) const
   {
       _checkRep();
       return _rep->getProperty(index);
   }
   
   void CIMObject::removeProperty(Uint32 index)
   {
       _checkRep();
       _rep->removeProperty(index);
   }
   
   Uint32 CIMObject::getPropertyCount() const
   {
       _checkRep();
       return _rep->getPropertyCount();
   }
   
   Boolean CIMObject::isUninitialized() const
   {
       return (_rep == 0)? true : false;
   }
   
   String CIMObject::toString () const
   {
       Buffer out;
   
       _checkRep();
       _rep->toXml(out);
       out.append('\0');
   
       return out.getData();
   }
   
   Boolean CIMObject::isClass () const
   {
       try
       {
           const CIMClass c (*this);
           return true;
       }
       catch (DynamicCastFailedException&)
       {
           return false;
       }
   }
   
   Boolean CIMObject::isInstance () const
   {
       try
       {
           const CIMInstance i (*this);
           return true;
       }
       catch (DynamicCastFailedException&)
       {
           return false;
       }
   }
   
 Boolean CIMObject::identical(const CIMConstObject& x) const Boolean CIMObject::identical(const CIMConstObject& x) const
 { {
     x._checkRep();     x._checkRep();
Line 82 
Line 232 
     return _rep->identical(x._rep);     return _rep->identical(x._rep);
 } }
  
   CIMObject CIMObject::clone() const
   {
       _checkRep();
       return CIMObject(_rep->clone());
   }
   
   void CIMObject::_checkRep() const
   {
       if (!_rep)
           throw UninitializedObjectException();
   }
   
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 // //
 // CIMConstObject // CIMConstObject
 // //
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 CIMConstObject::CIMConstObject(const CIMClass& x)  CIMConstObject::CIMConstObject()
       : _rep(0)
 { {
     Inc(_rep = x._rep);  
 } }
  
 CIMConstObject::CIMConstObject(const CIMConstClass& x)  CIMConstObject::CIMConstObject(const CIMConstObject& x)
 { {
     Inc(_rep = x._rep);     Inc(_rep = x._rep);
 } }
  
 CIMConstObject::CIMConstObject(const CIMInstance& x)  CIMConstObject::CIMConstObject(const CIMObject& x)
 { {
     Inc(_rep = x._rep);     Inc(_rep = x._rep);
 } }
  
 CIMConstObject::CIMConstObject(const CIMConstInstance& x)  CIMConstObject::CIMConstObject(const CIMClass& x)
 { {
     Inc(_rep = x._rep);     Inc(_rep = x._rep);
 } }
  
 CIMConstObject& CIMConstObject::operator=(const CIMClass& x)  CIMConstObject::CIMConstObject(const CIMConstClass& x)
 {  
     if (x._rep != _rep)  
     {  
         if (_rep)  
         {         {
             Dec(_rep);  
         }  
         Inc(_rep = x._rep);         Inc(_rep = x._rep);
     }     }
     return *this;  
 }  
  
 CIMConstObject& CIMConstObject::operator=(const CIMInstance& x)  CIMConstObject::CIMConstObject(const CIMInstance& x)
 {  
     if (x._rep != _rep)  
     {  
         if (_rep)  
         {         {
             Dec(_rep);  
         }  
         Inc(_rep = x._rep);         Inc(_rep = x._rep);
     }     }
     return *this;  
   CIMConstObject::CIMConstObject(const CIMConstInstance& x)
   {
       Inc(_rep = x._rep);
 } }
  
 CIMConstObject& CIMConstObject::operator=(const CIMConstClass& x)  CIMConstObject& CIMConstObject::operator=(const CIMConstObject& x)
 { {
     if (x._rep != _rep)     if (x._rep != _rep)
     {     {
         if (_rep)  
         {  
             Dec(_rep);             Dec(_rep);
         }  
         Inc(_rep = x._rep);         Inc(_rep = x._rep);
     }     }
     return *this;     return *this;
 } }
  
 CIMConstObject& CIMConstObject::operator=(const CIMConstInstance& x)  CIMConstObject::~CIMConstObject()
 {  
     if (x._rep != _rep)  
     {  
         if (_rep)  
         {         {
             Dec(_rep);             Dec(_rep);
         }         }
         Inc(_rep = x._rep);  
   const CIMName& CIMConstObject::getClassName() const
   {
       _checkRep();
       return _rep->getClassName();
     }     }
     return *this;  
   const CIMObjectPath& CIMConstObject::getPath() const
   {
       _checkRep();
       return _rep->getPath();
 } }
  
 ////////////////////////////////////////////////////////////////////////////////  Uint32 CIMConstObject::findQualifier(const CIMName& name) const
 //  {
 // CIMObjectWithPath      _checkRep();
 //      return _rep->findQualifier(name);
 ////////////////////////////////////////////////////////////////////////////////  }
  
 CIMObjectWithPath::CIMObjectWithPath()  CIMConstQualifier CIMConstObject::getQualifier(Uint32 index) const
 { {
       _checkRep();
       return _rep->getQualifier(index);
   }
  
   Uint32 CIMConstObject::getQualifierCount() const
   {
       _checkRep();
       return _rep->getQualifierCount();
 } }
  
 CIMObjectWithPath::CIMObjectWithPath(  Uint32 CIMConstObject::findProperty(const CIMName& name) const
     const CIMReference& reference,  
     const CIMObject& object)  
     : _reference(reference), _object(object)  
 { {
       _checkRep();
       return _rep->findProperty(name);
   }
  
   CIMConstProperty CIMConstObject::getProperty(Uint32 index) const
   {
       _checkRep();
       return _rep->getProperty(index);
 } }
  
 CIMObjectWithPath::CIMObjectWithPath(const CIMObjectWithPath& x)  Uint32 CIMConstObject::getPropertyCount() const
     : _reference(x._reference), _object(x._object)  
 { {
       _checkRep();
       return _rep->getPropertyCount();
   }
  
   Boolean CIMConstObject::isUninitialized() const
   {
       return (_rep == 0)? true : false;
 } }
  
 CIMObjectWithPath::~CIMObjectWithPath()  String CIMConstObject::toString () const
 { {
       Buffer out;
  
       _checkRep();
       _rep->toXml(out);
       out.append('\0');
   
       return out.getData();
 } }
  
 CIMObjectWithPath& CIMObjectWithPath::operator=(const CIMObjectWithPath& x)  Boolean CIMConstObject::isClass() const
 { {
     if (this != &x)      try
     {     {
         _reference = x._reference;          const CIMConstClass c(*this);
         _object = x._object;          return true;
       }
       catch (DynamicCastFailedException&)
       {
           return false;
     }     }
     return *this;  
 } }
  
 void CIMObjectWithPath::set(  Boolean CIMConstObject::isInstance() const
     const CIMReference& reference,  
     const CIMObject& object)  
 { {
     _reference = reference;      try
     _object = object;      {
           const CIMConstInstance i(*this);
           return true;
       }
       catch (DynamicCastFailedException&)
       {
           return false;
       }
 } }
  
 void CIMObjectWithPath::toXml(Array<Sint8>& out) const  Boolean CIMConstObject::identical(const CIMConstObject& x) const
 { {
     out << "<VALUE.OBJECTWITHPATH>\n";      x._checkRep();
       _checkRep();
       return _rep->identical(x._rep);
   }
  
     _reference.toXml(out, false);  CIMObject CIMConstObject::clone() const
     _object.toXml(out);  {
       return CIMObject(_rep->clone());
   }
  
     out << "</VALUE.OBJECTWITHPATH>\n";  void CIMConstObject::_checkRep() const
   {
       if (!_rep)
           throw UninitializedObjectException();
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.8  
changed lines
  Added in v.1.38

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2