Removed internal (event-)ID stuff (no need for ID's ATM).
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1445 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
namespace fail {
|
namespace fail {
|
||||||
|
|
||||||
event_id_t BaseEvent::m_Counter = 0;
|
|
||||||
|
|
||||||
bool TroubleEvent::isMatching(unsigned troubleNum) const
|
bool TroubleEvent::isMatching(unsigned troubleNum) const
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < m_WatchNumbers.size(); i++) {
|
for (unsigned i = 0; i < m_WatchNumbers.size(); i++) {
|
||||||
|
|||||||
@ -14,10 +14,6 @@ namespace fail {
|
|||||||
|
|
||||||
class ExperimentFlow;
|
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<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
|
||||||
@ -32,17 +28,13 @@ const unsigned ANY_INTERRUPT = static_cast<unsigned>(-1);
|
|||||||
* This is the base class for all event types.
|
* This is the base class for all event types.
|
||||||
*/
|
*/
|
||||||
class BaseEvent {
|
class BaseEvent {
|
||||||
private:
|
|
||||||
//! current class-scoped id counter to provide \a unique id's
|
|
||||||
static event_id_t m_Counter;
|
|
||||||
protected:
|
protected:
|
||||||
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
|
||||||
ExperimentFlow* m_Parent; //!< this event belongs to experiment m_Parent
|
ExperimentFlow* m_Parent; //!< this event belongs to experiment m_Parent
|
||||||
public:
|
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(); }
|
{ updateTime(); }
|
||||||
virtual ~BaseEvent() { }
|
virtual ~BaseEvent() { }
|
||||||
/**
|
/**
|
||||||
@ -69,11 +61,6 @@ public:
|
|||||||
* corresponding coroutine is toggled.
|
* corresponding coroutine is toggled.
|
||||||
*/
|
*/
|
||||||
virtual void onEventTrigger() { }
|
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
|
* 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 EventManager::clearCaches()
|
|||||||
m_Io_cache.clear();
|
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!");
|
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
|
||||||
@ -42,7 +42,6 @@ event_id_t EventManager::add(BaseEvent* ev, ExperimentFlow* pExp)
|
|||||||
|
|
||||||
addToCaches(ev);
|
addToCaches(ev);
|
||||||
m_BufferList.push_back(ev);
|
m_BufferList.push_back(ev);
|
||||||
return ev->getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventManager::remove(BaseEvent* ev)
|
void EventManager::remove(BaseEvent* ev)
|
||||||
@ -146,16 +145,6 @@ EventManager::~EventManager()
|
|||||||
// nothing to do here yet
|
// 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)
|
EventManager::iterator EventManager::makeActive(iterator it)
|
||||||
{
|
{
|
||||||
assert(it != m_BufferList.end() &&
|
assert(it != m_BufferList.end() &&
|
||||||
|
|||||||
@ -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()
|
||||||
*/
|
*/
|
||||||
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
|
* 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,13 +134,6 @@ public:
|
|||||||
* @return iterator to the end
|
* @return iterator to the end
|
||||||
*/
|
*/
|
||||||
iterator end() { return (m_BufferList.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.
|
* 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,16 +6,16 @@ namespace fail {
|
|||||||
// External reference declared in SALInst.hpp
|
// External reference declared in SALInst.hpp
|
||||||
ConcreteSimulatorController simulator;
|
ConcreteSimulatorController simulator;
|
||||||
|
|
||||||
event_id_t SimulatorController::addEvent(BaseEvent* ev)
|
bool SimulatorController::addEvent(BaseEvent* ev)
|
||||||
{
|
{
|
||||||
assert(ev != NULL && "FATAL ERROR: Argument (ptr) cannot be NULL!");
|
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:
|
// 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
|
||||||
ret = INVALID_EVENT;
|
return false;
|
||||||
}
|
}
|
||||||
return ret;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseEvent* SimulatorController::waitAny(void)
|
BaseEvent* SimulatorController::waitAny(void)
|
||||||
|
|||||||
@ -190,10 +190,9 @@ public:
|
|||||||
* Add event ev to the event management. This causes the event to be
|
* Add event ev to the event management. This causes the event to be
|
||||||
* active.
|
* active.
|
||||||
* @param ev the event pointer to be added for the current flow
|
* @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;
|
* @return \c true if the event has been added successfully, \c false otherwise
|
||||||
* -1 is returned on errors
|
|
||||||
*/
|
*/
|
||||||
event_id_t addEvent(BaseEvent* ev);
|
bool 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
|
||||||
|
|||||||
Reference in New Issue
Block a user