+ };
+ enum event_type
+ {
+ ALGO_EVENT, COMPUTE_EVENT
+ };
+
+ // ==================================================================
+ // Members to track non hierarchical dependencies between submeshes
+ // ==================================================================
+
+ /*!
+ * \brief Sets an event listener and its data to a submesh
+ * \param listener - the listener to store
+ * \param data - the listener data to store
+ * \param where - the submesh to store the listener and it's data
+ *
+ * The method remembers the submesh \awhere it puts the listener in order to delete
+ * it when HYP_OK algo_state is lost
+ * After being set, event listener is notified on each event of \awhere submesh.
+ */
+ void SetEventListener(EventListener* listener,
+ EventListenerData* data,
+ SMESH_subMesh* where);
+
+ /*!
+ * \brief Return an event listener data
+ * \param listener - the listener whose data is
+ * \param myOwn - if \c true, returns a listener set by this sub-mesh,
+ * else returns a listener listening to events of this sub-mesh
+ * \retval EventListenerData* - found data, maybe NULL
+ */
+ EventListenerData* GetEventListenerData(EventListener* listener,
+ const bool myOwn=false) const;
+
+ /*!
+ * \brief Return an event listener data
+ * \param listenerName - the listener name
+ * \param myOwn - if \c true, returns a listener set by this sub-mesh,
+ * else returns a listener listening to events of this sub-mesh
+ * \retval EventListenerData* - found data, maybe NULL
+ */
+ EventListenerData* GetEventListenerData(const std::string& listenerName,
+ const bool myOwn=false) const;
+
+ /*!
+ * \brief Unregister the listener and delete it and it's data
+ * \param listener - the event listener to delete
+ */
+ void DeleteEventListener(EventListener* listener);
+
+protected:
+
+ //!< event listeners to notify
+ std::map< EventListener*, EventListenerData* > _eventListeners;
+
+ //!< event listeners to delete when HYP_OK algo_state is lost
+ struct OwnListenerData {
+ SMESH_subMesh* mySubMesh;
+ int myMeshID; // id of mySubMesh->GetFather()
+ int mySubMeshID;
+ EventListener* myListener;
+ OwnListenerData( SMESH_subMesh* sm=0, EventListener* el=0);
+ };
+ std::list< OwnListenerData > _ownListeners;
+
+ /*!
+ * \brief Sets an event listener and its data to a submesh
+ * \param listener - the listener to store
+ * \param data - the listener data to store
+ *
+ * After being set, event listener is notified on each event of a submesh.
+ */
+ void setEventListener(EventListener* listener, EventListenerData* data);
+
+ /*!
+ * \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 hyp - hypothesis, if eventType is algo_event
+ */
+ void notifyListenersOnEvent( const int event,
+ const event_type eventType,
+ SMESH_Hypothesis* hyp = 0);
+
+ /*!
+ * \brief Delete event listeners depending on algo of this submesh
+ */
+ void deleteOwnListeners();
+
+ /*!
+ * \brief loads dependent meshes on SUBMESH_LOADED event
+ */
+ void loadDependentMeshes();
+
+ // END: Members to track non hierarchical dependencies between submeshes
+ // =====================================================================
+
+public: