* \brief Notify stored event listeners on the occured event
* \param event - algo_event or compute_event itself
* \param eventType - algo_event or compute_event
- * \param subMesh - the submesh where the event occures
- * \param data - listener data stored in the subMesh
* \param hyp - hypothesis, if eventType is algo_event
*/
//================================================================================
{
map< EventListener*, EventListenerData* >::iterator l_d = myEventListeners.begin();
for ( ; l_d != myEventListeners.end(); ++l_d )
- l_d->first->ProcessEvent( event, eventType, this, l_d->second, hyp );
+ if ( (*l_d).first->myBusySM.insert( this ).second )
+ {
+ l_d->first->ProcessEvent( event, eventType, this, l_d->second, hyp );
+ l_d->first->myBusySM.erase( this );
+ }
}
//================================================================================
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SMESH SMESH : implementaion of SMESH idl descriptions
-// File : SMESH_subMeshEventListener.hxx
-// Created : Mon Nov 13 10:45:49 2006
-// Author : Edward AGAPOV (eap)
+// File : SMESH_subMeshEventListener.hxx
+// Created : Mon Nov 13 10:45:49 2006
+// Author : Edward AGAPOV (eap)
//
#ifndef SMESH_subMeshEventListener_HeaderFile
#define SMESH_subMeshEventListener_HeaderFile
#include "SMESH_SMESH.hxx"
#include <list>
+#include <set>
class SMESH_subMesh;
class SMESH_Hypothesis;
*/
// ------------------------------------------------------------------
-class SMESH_EXPORT SMESH_subMeshEventListener {
+class SMESH_EXPORT SMESH_subMeshEventListener
+{
bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh
+ mutable std::set<SMESH_subMesh*> myBusySM; //!< to avoid infinite recursion via events
+ friend class SMESH_subMesh;
public:
SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable) {}
bool IsDeletable() const { return myIsDeletable; }
* \param data - listener data stored in the subMesh
* \param hyp - hypothesis, if eventType is algo_event
*
- * The base implementation translates CLEAN event to the subMesh stored
- * in the listener data. Also it sends SUBMESH_COMPUTED event in case of
- * successful COMPUTE event.
+ * The base implementation (see SMESH_subMesh.cxx) translates CLEAN event
+ * to the subMesh stored in the listener data. Also it sends SUBMESH_COMPUTED
+ * event in case of successful COMPUTE event.
*/
virtual void ProcessEvent(const int event,
const int eventType,
// on the one storing this data
public:
SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {}
+ virtual ~SMESH_subMeshEventListenerData() {}
bool IsDeletable() const { return myIsDeletable; }
/*!