00001 // Copyright (C) 2007-2011 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 public: 00051 SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable) {} 00052 bool IsDeletable() const { return myIsDeletable; } 00065 virtual void ProcessEvent(const int event, 00066 const int eventType, 00067 SMESH_subMesh* subMesh, 00068 SMESH_subMeshEventListenerData* data, 00069 const SMESH_Hypothesis* hyp = 0); 00070 }; 00071 00072 // ------------------------------------------------------------------ 00076 // ------------------------------------------------------------------ 00077 00078 struct SMESH_subMeshEventListenerData 00079 { 00080 bool myIsDeletable; 00081 int myType; 00082 std::list<SMESH_subMesh*> mySubMeshes; 00083 // on the one storing this data 00084 public: 00085 SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {} 00086 virtual ~SMESH_subMeshEventListenerData() {} 00087 bool IsDeletable() const { return myIsDeletable; } 00088 00098 static SMESH_subMeshEventListenerData* MakeData(SMESH_subMesh* dependentSM, 00099 const int type = 0) 00100 { 00101 SMESH_subMeshEventListenerData* data = new SMESH_subMeshEventListenerData(true); 00102 data->mySubMeshes.push_back( dependentSM ); 00103 data->myType = type; 00104 return data; 00105 } 00106 }; 00107 00108 00109 #endif