From d143d6ae5047b2c1780940dc7f7f01ea20083d92 Mon Sep 17 00:00:00 2001 From: adrian Date: Thu, 21 Jun 2012 11:18:38 +0000 Subject: [PATCH] EvendId -> event_id_t (refactoring). git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1370 8c4709b5-6ec9-48aa-a5cd-a96041d1645a --- src/core/sal/Event.cc | 2 +- src/core/sal/Event.hpp | 10 +++++----- src/core/sal/EventList.cc | 4 ++-- src/core/sal/EventList.hpp | 4 ++-- src/core/sal/SimulatorController.cc | 4 ++-- src/core/sal/SimulatorController.hpp | 2 +- src/core/sal/bochs/BochsEvents.hpp | 6 ++---- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/core/sal/Event.cc b/src/core/sal/Event.cc index a44c26ea..389a430b 100644 --- a/src/core/sal/Event.cc +++ b/src/core/sal/Event.cc @@ -3,7 +3,7 @@ namespace fail { -EventId BaseEvent::m_Counter = 0; +event_id_t BaseEvent::m_Counter = 0; bool TroubleEvent::isMatching(unsigned troubleNum) const { diff --git a/src/core/sal/Event.hpp b/src/core/sal/Event.hpp index d8e96310..98d41c2f 100644 --- a/src/core/sal/Event.hpp +++ b/src/core/sal/Event.hpp @@ -14,10 +14,10 @@ namespace fail { class ExperimentFlow; -typedef unsigned long EventId; //!< type of event ids +typedef unsigned long event_id_t; //!< type of event ids //! invalid event id (used as a return indicator) -const EventId INVALID_EVENT = static_cast(-1); +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 @@ -34,9 +34,9 @@ const unsigned ANY_INTERRUPT = static_cast(-1); class BaseEvent { private: //! current class-scoped id counter to provide \a unique id's - static EventId m_Counter; + static event_id_t m_Counter; protected: - EventId m_Id; //!< unique id of this event + 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 @@ -73,7 +73,7 @@ public: * Retrieves the unique event id for this event. * @return the unique id */ - EventId getId() const { return (m_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/EventList.cc b/src/core/sal/EventList.cc index 9fc6f041..fde5eb2d 100644 --- a/src/core/sal/EventList.cc +++ b/src/core/sal/EventList.cc @@ -33,7 +33,7 @@ void EventList::clearCaches() m_Io_cache.clear(); } -EventId EventList::add(BaseEvent* ev, ExperimentFlow* pExp) +event_id_t EventList::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 @@ -146,7 +146,7 @@ EventList::~EventList() // nothing to do here yet } -BaseEvent* EventList::getEventFromId(EventId id) +BaseEvent* EventList::getEventFromId(event_id_t id) { // Loop through all events: for (bufferlist_t::iterator it = m_BufferList.begin(); diff --git a/src/core/sal/EventList.hpp b/src/core/sal/EventList.hpp index c0da7cfa..09d3ab8a 100644 --- a/src/core/sal/EventList.hpp +++ b/src/core/sal/EventList.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() */ - EventId add(BaseEvent* ev, ExperimentFlow* pExp); + event_id_t add(BaseEvent* ev, ExperimentFlow* pExp); /** * Removes the event based upon the specified \a ev pointer (requires * to loop through the whole buffer-list). @@ -134,7 +134,7 @@ public: * @param id of event to be retrieved. * @return pointer to event or \c NULL of \a id could not be found */ - BaseEvent* getEventFromId(EventId id); + 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 fbca2022..eedfb29d 100644 --- a/src/core/sal/SimulatorController.cc +++ b/src/core/sal/SimulatorController.cc @@ -6,10 +6,10 @@ namespace fail { // External reference declared in SALInst.hpp ConcreteSimulatorController simulator; -EventId SimulatorController::addEvent(BaseEvent* ev) +event_id_t SimulatorController::addEvent(BaseEvent* ev) { assert(ev != NULL && "FATAL ERROR: Argument (ptr) cannot be NULL!"); - EventId ret = m_EvList.add(ev, m_Flows.getCurrent()); + event_id_t ret = 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 diff --git a/src/core/sal/SimulatorController.hpp b/src/core/sal/SimulatorController.hpp index 82183538..9254d2d2 100644 --- a/src/core/sal/SimulatorController.hpp +++ b/src/core/sal/SimulatorController.hpp @@ -193,7 +193,7 @@ public: * @return the id of the event used to identify the object on occurrence; * -1 is returned on errors */ - EventId addEvent(BaseEvent* ev); + event_id_t 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 diff --git a/src/core/sal/bochs/BochsEvents.hpp b/src/core/sal/bochs/BochsEvents.hpp index 7be3002d..07f5562c 100644 --- a/src/core/sal/bochs/BochsEvents.hpp +++ b/src/core/sal/bochs/BochsEvents.hpp @@ -39,8 +39,6 @@ public: * mechanism in the experiment-flow. The timer starts automatically when * added to FailBochs. * @param timeout the time intervall in milliseconds (ms) - * @param once \c true, if the TimerEvent should be triggered once, - * \c false if it should occur regularly * @see SimulatorController::addEvent */ TimerEvent(unsigned timeout) @@ -56,14 +54,14 @@ public: * the addition of the event \a pev, yielding an error in the * experiment flow (i.e. -1 is returned). */ - virtual bool onEventAddition(); + bool onEventAddition(); /** * This method is called when an experiment flow removes an event from * the event-management by calling \c removeEvent(prev), \c clearEvents() * or by deleting a complete flow (\c removeFlow). More specifically, this * event handler will be called *before* the event is actually deleted. */ - virtual void onEventDeletion(); + void onEventDeletion(); /** * This method is called when an previously added event is about to be * triggered by the simulator-backend. More specifically, this event handler