Back to index

salome-geom  6.5.0
GEOM_SmartPtr.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef GEOM_SMARTPTR_H 
00021 #define GEOM_SMARTPTR_H 
00022  
00023 #include <vtkSmartPointer.h> 
00024  
00025 template <class T>
00026 class GEOM_SmartPtr: public vtkSmartPointer<T>
00027 {
00028 public:
00029   GEOM_SmartPtr() {}
00030   GEOM_SmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer<T>(r) { 
00031     if(r && theIsOwner) 
00032       r->Delete();
00033   }
00034   GEOM_SmartPtr& operator()(T* r, bool theIsOwner = false){ 
00035     vtkSmartPointer<T>::operator=(r); 
00036     if(r && theIsOwner) 
00037       r->Delete();
00038     return *this;
00039   }
00040   GEOM_SmartPtr& operator=(T* r){ vtkSmartPointer<T>::operator=(r); return *this;}
00041   T* Get() const { return this->GetPointer();} 
00042 }; 
00043  
00044 class GEOM_DeviceActor; 
00045 typedef GEOM_SmartPtr<GEOM_DeviceActor> PDeviceActor; 
00046  
00047 class vtkPolyDataMapper; 
00048 typedef GEOM_SmartPtr<vtkPolyDataMapper> PPolyDataMapper;
00049 
00050 class GEOM_PainterPolyDataMapper;
00051 typedef GEOM_SmartPtr<GEOM_PainterPolyDataMapper> PPolyGeomPainterDataMapper;
00052  
00053  
00054 #endif //GEOM_SMARTPTR_H