Back to index

salome-smesh  6.5.0
SMESH_subMeshEventListener.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File    : SMESH_subMeshEventListener.hxx
00024 // Created : Mon Nov 13 10:45:49 2006
00025 // Author  : Edward AGAPOV (eap)
00026 //
00027 #ifndef SMESH_subMeshEventListener_HeaderFile
00028 #define SMESH_subMeshEventListener_HeaderFile
00029 
00030 #include "SMESH_SMESH.hxx"
00031 
00032 #include <list>
00033 #include <set>
00034 
00035 class  SMESH_subMesh;
00036 class  SMESH_Hypothesis;
00037 struct SMESH_subMeshEventListenerData;
00038 
00039 // ------------------------------------------------------------------
00043 // ------------------------------------------------------------------
00044 
00045 class SMESH_EXPORT SMESH_subMeshEventListener
00046 {
00047   bool myIsDeletable; 
00048   mutable std::set<SMESH_subMesh*> myBusySM; 
00049   friend class SMESH_subMesh;
00050 #ifdef _DEBUG_
00051   const char* myName; 
00052 #endif
00053 
00054  public:
00055   SMESH_subMeshEventListener(bool isDeletable, const char* name) :myIsDeletable(isDeletable)
00056 #ifdef _DEBUG_
00057     ,myName(name)
00058 #endif
00059   {}
00060   bool IsDeletable() const { return myIsDeletable; }
00073   virtual void ProcessEvent(const int          event,
00074                             const int          eventType,
00075                             SMESH_subMesh*     subMesh,
00076                             SMESH_subMeshEventListenerData* data,
00077                             const SMESH_Hypothesis*         hyp = 0);
00078 };
00079 
00080 // ------------------------------------------------------------------
00084 // ------------------------------------------------------------------
00085 
00086 struct SMESH_subMeshEventListenerData
00087 {
00088   bool myIsDeletable; 
00089   int myType;         
00090   std::list<SMESH_subMesh*> mySubMeshes; /* generally: submeshes depending
00091                                             on the one storing this data;
00092                                             !! they are used to track intermesh
00093                                             dependencies at mesh loading as well !! */
00094 public:
00095   SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {}
00096   virtual ~SMESH_subMeshEventListenerData() {}
00097   bool IsDeletable() const { return myIsDeletable; }
00098 
00108   static SMESH_subMeshEventListenerData* MakeData(SMESH_subMesh* dependentSM,
00109                                                   const int      type = 0)
00110   {
00111     SMESH_subMeshEventListenerData* data = new SMESH_subMeshEventListenerData(true);
00112     data->mySubMeshes.push_back( dependentSM );
00113     data->myType = type;
00114     return data;
00115   }
00116 };
00117 
00118 
00119 #endif