-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOM_GenericObjPtr.h
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
#ifndef GEOM_GenericObjPtr_H
#define GEOM_GenericObjPtr_H
+#include "GEOM_GEOMBase.hxx"
+
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(GEOM_Gen)
This class can be used in conjunction with the references to the CORBA objects which
interfaces are inherited from the SALOME::GenericObj CORBA interface.
- The smart pointer class automatically invokes Register() / Destroy() functions of th
+ The smart pointer class automatically invokes Register() / UnRegister() functions of th
interface in order to prevent memory leaks and other such problems caused by improper
usage of the CORBA references.
}
//! Decrement counter for the object.
- void Destroy()
+ void UnRegister()
{
if ( !CORBA::is_nil( this->myObject ) ) {
- this->myObject->Destroy();
+ this->myObject->UnRegister();
this->myObject = TInterface::_nil();
}
}
//! Destroy pointer and remove the reference to the object.
~GenericObjPtr()
{
- this->Destroy();
+ this->UnRegister();
}
//! Assign object to reference and remove reference to an old object.
GenericObjPtr& operator=( TInterfacePtr theObject )
{
- this->Destroy();
+ this->UnRegister();
this->myObject = TInterface::_duplicate( theObject );
this->Register();
return *this;
//! Assign object to reference and remove reference to an old object.
GenericObjPtr& operator=( const GenericObjPtr& thePointer )
{
- this->Destroy();
+ this->UnRegister();
this->myObject = thePointer.myObject;
this->Register();
return *this;
//! Initialize pointer to the given generic object reference and take ownership on it.
void take( TInterfacePtr theObject )
{
- this->Destroy();
+ this->UnRegister();
this->myObject = TInterface::_duplicate( theObject );
}
//! Nullify pointer.
void nullify()
{
- this->Destroy();
+ this->UnRegister();
}
};
typedef GenericObjPtr<GEOM::GEOM_IGroupOperations> GroupOpPtr;
typedef GenericObjPtr<GEOM::GEOM_IAdvancedOperations> AdvancedOpPtr;
- template<> bool GenericObjPtr<GEOM::GEOM_Object>::isSame( GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight );
+ template<> bool GEOMBASE_EXPORT GenericObjPtr<GEOM::GEOM_Object>::isSame( GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight );
}
#endif // GEOM_GenericObjPtr_H