Salome HOME
Merge branch 'master' of ssh://git.salome-platform.org/modules/kernel
[modules/yacs.git] / src / Basics / BasicsGenericDestructor.hxx
index 3435c7e4b31f2be39c79468f3798eb33fcc5a7be..82eea8694ad5099ee5b99af1fadf1208118012ef 100644 (file)
@@ -1,34 +1,36 @@
-//  SALOME Basics : general SALOME definitions and tools (C++ part - no CORBA)
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  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 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 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// 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, or (at your option) any later version.
 //
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
+//  SALOME Basics : general SALOME definitions and tools (C++ part - no CORBA)
 //  File   : BasicGenericDestructor.hxx
 //  Author : Antoine YESSAYAN, Paul RASCLE, EDF
 //  Module : SALOME
 //  $Header$
-
+//
 #ifndef _BASICGENERICDESTRUCTOR_HXX_
 #define _BASICGENERICDESTRUCTOR_HXX_
 
+#include "SALOME_Basics.hxx"
+
 #include <list>
 #include <algorithm>
 #include <cassert>
 #include <cstdlib>
 #include <pthread.h>
 
-#if defined BASICS_EXPORTS
-#if defined WIN32
-#define BASICS_EXPORT __declspec( dllexport )
-#else
-#define BASICS_EXPORT
-#endif
-#else
-#if defined WNT
-#define BASICS_EXPORT __declspec( dllimport )
-#else
-#define BASICS_EXPORT
-#endif
-#endif
-
 //#define _DEVDEBUG_
 
 #ifdef _DEVDEBUG_
 #define DEVTRACE(msg)
 #endif
 
+#ifdef WIN32
+#pragma warning(disable:4251) // Warning DLL Interface ...
+#endif
+
 // ============================================================================
 /*!
  * The PROTECTED_DELETE base class provides a protected destructor. 
@@ -79,7 +71,7 @@
  */ 
 // ============================================================================
 
-class PROTECTED_DELETE
+class BASICS_EXPORT PROTECTED_DELETE
 {
 public:
   static void deleteInstance(PROTECTED_DELETE *anObject);
@@ -111,14 +103,14 @@ private:
  */ 
 // ============================================================================
 
-class GENERIC_DESTRUCTOR
+class BASICS_EXPORT GENERIC_DESTRUCTOR
 {
 public :
-  BASICS_EXPORT static std::list<GENERIC_DESTRUCTOR*> *Destructors;
+  static std::list<GENERIC_DESTRUCTOR*> *Destructors;
 
   virtual ~GENERIC_DESTRUCTOR() {};
-  BASICS_EXPORT static const int Add(GENERIC_DESTRUCTOR &anObject);
-  BASICS_EXPORT virtual void operator()(void) = 0;
+  static const int Add(GENERIC_DESTRUCTOR &anObject);
+  virtual void operator()(void) = 0;
 };
 
 // ============================================================================
@@ -142,7 +134,6 @@ public :
 
 template <class TYPE> class DESTRUCTOR_OF : public GENERIC_DESTRUCTOR
 {
-
 public:
   /*!
     Programs the destruction at the end of the process, of the object anObject.
@@ -153,7 +144,7 @@ public:
     _objectPtr(&anObject)
   {
     DEVTRACE(" DESTRUCTOR_OF " << typeid(anObject).name() 
-            << " " << _objectPtr << " " << this );
+             << " " << _objectPtr << " " << this );
     PROTECTED_DELETE::addObj(_objectPtr);
     assert(GENERIC_DESTRUCTOR::Add(*this) >= 0);
   }
@@ -167,9 +158,9 @@ public:
   {
     if (_objectPtr)
       {
-       DEVTRACE("DESTRUCTOR_OF<>::operator() " << _objectPtr);
-       if (_objectPtr) PROTECTED_DELETE::deleteInstance(_objectPtr);
-       _objectPtr = NULL;
+        DEVTRACE("DESTRUCTOR_OF<>::operator() " << _objectPtr);
+        if (_objectPtr) PROTECTED_DELETE::deleteInstance(_objectPtr);
+        _objectPtr = NULL;
       }
   }