diff --git a/core/controller/EventList.cc b/core/controller/EventList.cc index 2ec46447db676c898e80c7d2a1767bfa0695c0b4..a987261bcc9a339009b6580b08c0ca7e8160a905 100644 --- a/core/controller/EventList.cc +++ b/core/controller/EventList.cc @@ -16,27 +16,28 @@ EventId EventList::add(BaseEvent* ev, ExperimentFlow* pExp) return (ev->getId()); } -bool EventList::remove(BaseEvent* ev) +void EventList::remove(BaseEvent* ev) { - if(ev != NULL) - { - iterator it = std::find(m_BufferList.begin(), m_BufferList.end(), ev); - if(it != end()) - { - m_BufferList.erase(it); + // possible cases: + // - ev == 0 -> remove all events + // * clear m_BufferList + // * copy m_FireList to m_DeleteList + if (ev == 0) { + m_BufferList.clear(); + // all remaining active events must not fire anymore + m_DeleteList.insert(m_DeleteList.end(), m_FireList.begin(), m_FireList.end()); + + // - ev != 0 -> remove single event + // * find/remove ev in m_BufferList + // * if ev in m_FireList, copy to m_DeleteList + } else { + m_BufferList.remove(ev); + firelist_t::const_iterator it = + std::find(m_FireList.begin(), m_FireList.end(), ev); + if (it != m_FireList.end()) { m_DeleteList.push_back(ev); - return (true); } } - else - { - for(iterator it = m_BufferList.begin(); it != m_BufferList.end(); - it++) - m_DeleteList.push_back(*it); - m_BufferList.clear(); - return (true); - } - return (false); } EventList::iterator EventList::remove(iterator it) diff --git a/core/controller/EventList.hpp b/core/controller/EventList.hpp index ba70031e86f83d3f0bd3e4ab43be223fd1038247..29a3e992162efd99a3abbc70e2fe45b16c5da750 100644 --- a/core/controller/EventList.hpp +++ b/core/controller/EventList.hpp @@ -82,10 +82,8 @@ class EventList * @param ev the pointer of the event to be removed; if ev is set to * \c NULL, all events (for \a all experiments) will be * removed - * @return \c true if the object has been removed or \c false if the - * pointer could not be found */ - bool remove(BaseEvent* ev); + void remove(BaseEvent* ev); /** * Behaves like remove(BaseEvent) and additionally updates the provided * iteration.