diff --git a/src/core/sal/Event.cc b/src/core/sal/Event.cc index 389a430b..f2011a4d 100644 --- a/src/core/sal/Event.cc +++ b/src/core/sal/Event.cc @@ -3,8 +3,6 @@ namespace fail { -event_id_t BaseEvent::m_Counter = 0; - bool TroubleEvent::isMatching(unsigned troubleNum) const { for (unsigned i = 0; i < m_WatchNumbers.size(); i++) { diff --git a/src/core/sal/Event.hpp b/src/core/sal/Event.hpp index 10e33f65..64f74bea 100644 --- a/src/core/sal/Event.hpp +++ b/src/core/sal/Event.hpp @@ -14,10 +14,6 @@ namespace fail { class ExperimentFlow; -typedef unsigned long event_id_t; //!< type of event ids - -//! invalid event id (used as a return indicator) -const event_id_t INVALID_EVENT = static_cast(-1); //! address wildcard (e.g. for BPEvent's) const address_t ANY_ADDR = static_cast(-1); //! instruction wildcard @@ -32,17 +28,13 @@ const unsigned ANY_INTERRUPT = static_cast(-1); * This is the base class for all event types. */ class BaseEvent { -private: - //! current class-scoped id counter to provide \a unique id's - static event_id_t m_Counter; protected: - event_id_t m_Id; //!< unique id of this event time_t m_tStamp; //!< time stamp of event unsigned int m_OccCounter; //!< event fires when 0 is reached unsigned int m_OccCounterInit; //!< initial value for m_OccCounter ExperimentFlow* m_Parent; //!< this event belongs to experiment m_Parent public: - BaseEvent() : m_Id(++m_Counter), m_OccCounter(1), m_OccCounterInit(1), m_Parent(NULL) + BaseEvent() : m_OccCounter(1), m_OccCounterInit(1), m_Parent(NULL) { updateTime(); } virtual ~BaseEvent() { } /** @@ -69,11 +61,6 @@ public: * corresponding coroutine is toggled. */ virtual void onEventTrigger() { } - /** - * Retrieves the unique event id for this event. - * @return the unique id - */ - event_id_t getId() const { return (m_Id); } /** * Retrieves the time stamp of this event. The time stamp is set when * the event gets created, id est the constructor is called. The meaning diff --git a/src/core/sal/EventManager.cc b/src/core/sal/EventManager.cc index a13a4b6c..31f9f115 100644 --- a/src/core/sal/EventManager.cc +++ b/src/core/sal/EventManager.cc @@ -33,7 +33,7 @@ void EventManager::clearCaches() m_Io_cache.clear(); } -event_id_t EventManager::add(BaseEvent* ev, ExperimentFlow* pExp) +void EventManager::add(BaseEvent* ev, ExperimentFlow* pExp) { assert(ev != NULL && "FATAL ERROR: Event (of base type BaseEvent*) cannot be NULL!"); // a zero counter does not make sense @@ -42,7 +42,6 @@ event_id_t EventManager::add(BaseEvent* ev, ExperimentFlow* pExp) addToCaches(ev); m_BufferList.push_back(ev); - return ev->getId(); } void EventManager::remove(BaseEvent* ev) @@ -146,16 +145,6 @@ EventManager::~EventManager() // nothing to do here yet } -BaseEvent* EventManager::getEventFromId(event_id_t id) -{ - // Loop through all events: - for (bufferlist_t::iterator it = m_BufferList.begin(); - it != m_BufferList.end(); it++) - if ((*it)->getId() == id) - return *it; - return NULL; // Nothing found. -} - EventManager::iterator EventManager::makeActive(iterator it) { assert(it != m_BufferList.end() && diff --git a/src/core/sal/EventManager.hpp b/src/core/sal/EventManager.hpp index ca071228..01ee3695 100644 --- a/src/core/sal/EventManager.hpp +++ b/src/core/sal/EventManager.hpp @@ -83,7 +83,7 @@ public: * which is interested in such events, cannot be \c NULL) * @return the id of the added event object, that is ev->getId() */ - event_id_t add(BaseEvent* ev, ExperimentFlow* pExp); + void add(BaseEvent* ev, ExperimentFlow* pExp); /** * Removes the event based upon the specified \a ev pointer (requires * to loop through the whole buffer-list). @@ -134,13 +134,6 @@ public: * @return iterator to the end */ iterator end() { return (m_BufferList.end()); } - /** - * Retrieves the event object for the given \a id. The internal data - * remains unchanged. - * @param id of event to be retrieved. - * @return pointer to event or \c NULL of \a id could not be found - */ - BaseEvent* getEventFromId(event_id_t id); /** * Removes all events for the specified experiment. * @param flow pointer to experiment context (0 = all experiments) diff --git a/src/core/sal/SimulatorController.cc b/src/core/sal/SimulatorController.cc index 1f31835f..201b8d72 100644 --- a/src/core/sal/SimulatorController.cc +++ b/src/core/sal/SimulatorController.cc @@ -6,16 +6,16 @@ namespace fail { // External reference declared in SALInst.hpp ConcreteSimulatorController simulator; -event_id_t SimulatorController::addEvent(BaseEvent* ev) +bool SimulatorController::addEvent(BaseEvent* ev) { assert(ev != NULL && "FATAL ERROR: Argument (ptr) cannot be NULL!"); - event_id_t ret = m_EvList.add(ev, m_Flows.getCurrent()); + m_EvList.add(ev, m_Flows.getCurrent()); // Call the common postprocessing function: if (!ev->onEventAddition()) { // If the return value signals "false"..., m_EvList.remove(ev); // ...skip the addition - ret = INVALID_EVENT; + return false; } - return ret; + return true; } BaseEvent* SimulatorController::waitAny(void) diff --git a/src/core/sal/SimulatorController.hpp b/src/core/sal/SimulatorController.hpp index a3ace36e..a08f633a 100644 --- a/src/core/sal/SimulatorController.hpp +++ b/src/core/sal/SimulatorController.hpp @@ -190,10 +190,9 @@ public: * Add event ev to the event management. This causes the event to be * active. * @param ev the event pointer to be added for the current flow - * @return the id of the event used to identify the object on occurrence; - * -1 is returned on errors + * @return \c true if the event has been added successfully, \c false otherwise */ - event_id_t addEvent(BaseEvent* ev); + bool addEvent(BaseEvent* ev); /** * Removes the event with the specified id. * @param ev the pointer of the event-object to be removed; if \a ev is