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
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
namespace fail {
|
namespace fail {
|
||||||
|
|
||||||
EventId BaseEvent::m_Counter = 0;
|
event_id_t BaseEvent::m_Counter = 0;
|
||||||
|
|
||||||
bool TroubleEvent::isMatching(unsigned troubleNum) const
|
bool TroubleEvent::isMatching(unsigned troubleNum) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,10 +14,10 @@ namespace fail {
|
|||||||
|
|
||||||
class ExperimentFlow;
|
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)
|
//! invalid event id (used as a return indicator)
|
||||||
const EventId INVALID_EVENT = static_cast<EventId>(-1);
|
const event_id_t INVALID_EVENT = static_cast<event_id_t>(-1);
|
||||||
//! address wildcard (e.g. for BPEvent's)
|
//! address wildcard (e.g. for BPEvent's)
|
||||||
const address_t ANY_ADDR = static_cast<address_t>(-1);
|
const address_t ANY_ADDR = static_cast<address_t>(-1);
|
||||||
//! instruction wildcard
|
//! instruction wildcard
|
||||||
@ -34,9 +34,9 @@ const unsigned ANY_INTERRUPT = static_cast<unsigned>(-1);
|
|||||||
class BaseEvent {
|
class BaseEvent {
|
||||||
private:
|
private:
|
||||||
//! current class-scoped id counter to provide \a unique id's
|
//! current class-scoped id counter to provide \a unique id's
|
||||||
static EventId m_Counter;
|
static event_id_t m_Counter;
|
||||||
protected:
|
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
|
time_t m_tStamp; //!< time stamp of event
|
||||||
unsigned int m_OccCounter; //!< event fires when 0 is reached
|
unsigned int m_OccCounter; //!< event fires when 0 is reached
|
||||||
unsigned int m_OccCounterInit; //!< initial value for m_OccCounter
|
unsigned int m_OccCounterInit; //!< initial value for m_OccCounter
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
* Retrieves the unique event id for this event.
|
* Retrieves the unique event id for this event.
|
||||||
* @return the unique id
|
* @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
|
* 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
|
* the event gets created, id est the constructor is called. The meaning
|
||||||
|
|||||||
@ -33,7 +33,7 @@ void EventList::clearCaches()
|
|||||||
m_Io_cache.clear();
|
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!");
|
assert(ev != NULL && "FATAL ERROR: Event (of base type BaseEvent*) cannot be NULL!");
|
||||||
// a zero counter does not make sense
|
// a zero counter does not make sense
|
||||||
@ -146,7 +146,7 @@ EventList::~EventList()
|
|||||||
// nothing to do here yet
|
// nothing to do here yet
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseEvent* EventList::getEventFromId(EventId id)
|
BaseEvent* EventList::getEventFromId(event_id_t id)
|
||||||
{
|
{
|
||||||
// Loop through all events:
|
// Loop through all events:
|
||||||
for (bufferlist_t::iterator it = m_BufferList.begin();
|
for (bufferlist_t::iterator it = m_BufferList.begin();
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public:
|
|||||||
* which is interested in such events, cannot be \c NULL)
|
* which is interested in such events, cannot be \c NULL)
|
||||||
* @return the id of the added event object, that is ev->getId()
|
* @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
|
* Removes the event based upon the specified \a ev pointer (requires
|
||||||
* to loop through the whole buffer-list).
|
* to loop through the whole buffer-list).
|
||||||
@ -134,7 +134,7 @@ public:
|
|||||||
* @param id of event to be retrieved.
|
* @param id of event to be retrieved.
|
||||||
* @return pointer to event or \c NULL of \a id could not be found
|
* @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.
|
* Removes all events for the specified experiment.
|
||||||
* @param flow pointer to experiment context (0 = all experiments)
|
* @param flow pointer to experiment context (0 = all experiments)
|
||||||
|
|||||||
@ -6,10 +6,10 @@ namespace fail {
|
|||||||
// External reference declared in SALInst.hpp
|
// External reference declared in SALInst.hpp
|
||||||
ConcreteSimulatorController simulator;
|
ConcreteSimulatorController simulator;
|
||||||
|
|
||||||
EventId SimulatorController::addEvent(BaseEvent* ev)
|
event_id_t SimulatorController::addEvent(BaseEvent* ev)
|
||||||
{
|
{
|
||||||
assert(ev != NULL && "FATAL ERROR: Argument (ptr) cannot be NULL!");
|
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:
|
// Call the common postprocessing function:
|
||||||
if (!ev->onEventAddition()) { // If the return value signals "false"...,
|
if (!ev->onEventAddition()) { // If the return value signals "false"...,
|
||||||
m_EvList.remove(ev); // ...skip the addition
|
m_EvList.remove(ev); // ...skip the addition
|
||||||
|
|||||||
@ -193,7 +193,7 @@ public:
|
|||||||
* @return the id of the event used to identify the object on occurrence;
|
* @return the id of the event used to identify the object on occurrence;
|
||||||
* -1 is returned on errors
|
* -1 is returned on errors
|
||||||
*/
|
*/
|
||||||
EventId addEvent(BaseEvent* ev);
|
event_id_t addEvent(BaseEvent* ev);
|
||||||
/**
|
/**
|
||||||
* Removes the event with the specified id.
|
* Removes the event with the specified id.
|
||||||
* @param ev the pointer of the event-object to be removed; if \a ev is
|
* @param ev the pointer of the event-object to be removed; if \a ev is
|
||||||
|
|||||||
@ -39,8 +39,6 @@ public:
|
|||||||
* mechanism in the experiment-flow. The timer starts automatically when
|
* mechanism in the experiment-flow. The timer starts automatically when
|
||||||
* added to FailBochs.
|
* added to FailBochs.
|
||||||
* @param timeout the time intervall in milliseconds (ms)
|
* @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
|
* @see SimulatorController::addEvent
|
||||||
*/
|
*/
|
||||||
TimerEvent(unsigned timeout)
|
TimerEvent(unsigned timeout)
|
||||||
@ -56,14 +54,14 @@ public:
|
|||||||
* the addition of the event \a pev, yielding an error in the
|
* the addition of the event \a pev, yielding an error in the
|
||||||
* experiment flow (i.e. -1 is returned).
|
* experiment flow (i.e. -1 is returned).
|
||||||
*/
|
*/
|
||||||
virtual bool onEventAddition();
|
bool onEventAddition();
|
||||||
/**
|
/**
|
||||||
* This method is called when an experiment flow removes an event from
|
* This method is called when an experiment flow removes an event from
|
||||||
* the event-management by calling \c removeEvent(prev), \c clearEvents()
|
* the event-management by calling \c removeEvent(prev), \c clearEvents()
|
||||||
* or by deleting a complete flow (\c removeFlow). More specifically, this
|
* or by deleting a complete flow (\c removeFlow). More specifically, this
|
||||||
* event handler will be called *before* the event is actually deleted.
|
* 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
|
* This method is called when an previously added event is about to be
|
||||||
* triggered by the simulator-backend. More specifically, this event handler
|
* triggered by the simulator-backend. More specifically, this event handler
|
||||||
|
|||||||
Reference in New Issue
Block a user