| |
libFAUDES
Sections
Index
|
faudes::ParallelExecutor Class Reference |
Public Types | |
typedef std::vector< Idx > | ParallelState |
Typedef for parallel discrete state. | |
typedef std::vector< std::map < Idx, tpTime::Type > > | ParallelClock |
Typedef for parallel clock values. | |
typedef Executor::TimedState | TimedState |
Provide typedef from Executor. | |
typedef std::vector< Executor > ::const_iterator | Iterator |
Read-only access to individual executors. | |
Public Member Functions | |
ParallelExecutor (void) | |
Construct an emtpy ParallelExecuter. | |
ParallelExecutor (const std::string &rFileName) | |
Construct from file. | |
virtual | ~ParallelExecutor (void) |
Explicit destructor. | |
virtual void | Clear (void) |
Clear all data. | |
Idx | Size (void) const |
Number of tGenerators. | |
void | Insert (const std::string &rFileName) |
Add a tGenerator from file. | |
void | Insert (const tGenerator &rGen) |
Add a tGenerator. | |
const EventSet & | Alphabet (void) const |
Overall alphabet. | |
virtual void | Reset (void) |
Goto initial state. | |
Iterator | Begin (void) const |
Iterator | End (void) const |
const Executor & | At (int i) const |
Idx | EventIndex (const std::string &rName) const |
Event index lookup. | |
std::string | EventName (Idx index) const |
Event name lookup. | |
tpTime::Type | CurrentTime (void) const |
Get clock time. | |
int | CurrentStep (void) const |
Get logical time, ie number of transitions so far,. | |
bool | IsDeadlocked () const |
Test for deadlocked. | |
virtual bool | Valid (void) const |
Check validity of executors. | |
const ParallelTimedState & | CurrentParallelTimedState (void) const |
Get current state of the ParallelExecutor. | |
const ParallelState & | CurrentParallelState (void) const |
Get current discrete state vector of the ParallelExecutor. | |
virtual void | CurrentTime (tpTime::Type time) |
Set clock time. | |
virtual void | CurrentStep (int step) |
Set logical time (# of steps). | |
virtual bool | CurrentParallelTimedState (const ParallelTimedState &ptstate) |
Set current state of the ParallelExecutor. | |
virtual bool | ExecuteTime (tpTime::Type duration) |
Let time pass without executing a transition. | |
virtual bool | ExecuteEvent (Idx event) |
Execute transition. | |
const TimeInterval & | EnabledTime () const |
Get maximal duration that can pass without executing an event. | |
const EventSet & | EnabledEvents () const |
Get events that are enabled at current (timed) state. | |
const EventSet & | DisabledEvents () const |
Get events that are disabled at current (timed) state. | |
const TimeInterval & | EnabledInterval () const |
Get an interval on which the set of enabled events is constant. | |
TimeInterval | EnabledEventTime (Idx event) const |
Get interval on which the specified event is enabled. | |
TimeInterval | EnabledGuardTime (Idx event) const |
Get interval on which the respective guard is satisfied. | |
EventSet | ActiveEventSet (const ParallelState &stateVec) const |
Get events that are active in all tGenerators. | |
bool | Active (Idx ev, const ParallelState &stateVec) const |
Test whether an event is active in a given discrete state. | |
bool | Active (Idx ev) const |
Test whether an event is active at current (discrete) state. | |
std::string | PTSStr (const ParallelTimedState &ptstate) const |
Pretty printable string of timed parallel state. | |
std::string | PSStr (const ParallelState &pstate) const |
Pretty printable string of parallel state. | |
std::string | TEStr (const TimedEvent &tevent) const |
Pretty printable string of timed event. | |
std::string | CStr (Idx clock) const |
Pretty printable string of clock name. | |
std::string | EStr (Idx event) const |
Pretty printable string of event. | |
std::string | CurrentParallelTimedStateStr (void) const |
Pretty printable string of current state. | |
std::string | CurrentParallelStateStr (void) const |
Pretty printable string of parallel state. | |
void | ComputeEnabled (void) const |
Compute enabled events and enabled interval (fake const). | |
void | ComputeEnabledNonConst (void) |
Compute enabled core routine (non const). | |
Protected Member Functions | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Reads parallel executor from TokenReader, see also public wrappers Read() in faudes::Type. | |
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Write to TokenWriter, see also public wrappers Write() in faudes::Type. | |
virtual void | DoReadGenerators (TokenReader &rTr) |
Reads generator files section from TokenReader. | |
virtual void | DoWriteGenerators (TokenWriter &rTw) const |
Write generator files section to TokenWriter. | |
virtual void | Compile () |
compile internal data (eg overall alphabet) | |
Protected Attributes | |
Idx | mRecentEvent |
recent event | |
Private Types | |
typedef std::vector< Executor > ::iterator | iterator |
Internal non-const iterator. | |
Private Member Functions | |
void | UpdateParallelTimedState (void) |
update parallel timed state() | |
Private Attributes | |
std::vector< Executor > | mExecutors |
list of executors | |
std::vector< std::string > | mExecutorNames |
list of executors | |
EventSet | mAlphabet |
overall alphabet | |
tpTime::Type | mCurrentTime |
global time (real) | |
int | mCurrentStep |
global time (step) | |
TimeInterval | mETime |
enabled time | |
EventSet | mEEvents |
enabled events | |
EventSet | mDEvents |
disabled events | |
TimeInterval | mEInterval |
enabled interval | |
bool | mEValid |
validity flag for fevents and ftime | |
ParallelTimedState | mCurrentParallelTimedState |
current state | |
Classes | |
class | ParallelTimedState |
Typedef for parallel timed state, incl token io. More... |
typedef std::vector<Idx> faudes::ParallelExecutor::ParallelState |
typedef std::vector< std::map<Idx,tpTime::Type> > faudes::ParallelExecutor::ParallelClock |
typedef std::vector<Executor>::const_iterator faudes::ParallelExecutor::Iterator |
typedef std::vector<Executor>::iterator faudes::ParallelExecutor::iterator [private] |
faudes::ParallelExecutor::ParallelExecutor | ( | void | ) |
faudes::ParallelExecutor::ParallelExecutor | ( | const std::string & | rFileName | ) |
Construct from file.
This constructor uses the DoRead method to initialize from file.
rFileName | Filename |
Exception |
|
Definition at line 25 of file sp_pexecutor.cpp.
faudes::ParallelExecutor::~ParallelExecutor | ( | void | ) | [virtual] |
void faudes::ParallelExecutor::Clear | ( | void | ) | [virtual] |
Clear all data.
Removes all generators/executors and resets the current state to a void value.
Reimplemented from faudes::Type.
Reimplemented in faudes::DeviceExecutor, faudes::LoggingExecutor, and faudes::ProposingExecutor.
Definition at line 99 of file sp_pexecutor.cpp.
Idx faudes::ParallelExecutor::Size | ( | void | ) | const |
void faudes::ParallelExecutor::Insert | ( | const std::string & | rFileName | ) |
Add a tGenerator from file.
This method uses the tGenerator's read to find the first generator in the file. If the generator found is not a tGenerator, timing data defaults to infinite invariants/guards and empty resets. After inserting generators and before starting to execute, you must call Reset() to update internal datastructures.
rFileName | File to read |
Exception |
|
Definition at line 75 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::Insert | ( | const tGenerator & | rGen | ) |
Add a tGenerator.
After inserting generators and before starting to execute, you must call Reset() to update internal datastructures.
rGen | Generator to add |
Exception |
|
Definition at line 90 of file sp_pexecutor.cpp.
const EventSet & faudes::ParallelExecutor::Alphabet | ( | void | ) | const |
Overall alphabet.
Reimplemented in faudes::ProposingExecutor.
Definition at line 194 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::Reset | ( | void | ) | [virtual] |
Goto initial state.
Reset all clock values to zero, assign initial states to each executor.
Reimplemented in faudes::LoggingExecutor.
Definition at line 68 of file sp_pexecutor.cpp.
Iterator faudes::ParallelExecutor::Begin | ( | void | ) | const [inline] |
Definition at line 175 of file sp_pexecutor.h.
Iterator faudes::ParallelExecutor::End | ( | void | ) | const [inline] |
Definition at line 176 of file sp_pexecutor.h.
const Executor& faudes::ParallelExecutor::At | ( | int | i | ) | const [inline] |
Definition at line 177 of file sp_pexecutor.h.
Idx faudes::ParallelExecutor::EventIndex | ( | const std::string & | rName | ) | const [inline] |
Event index lookup.
This convenience method refers to the global event symbol table.
rName | Name of event to lookup |
Definition at line 191 of file sp_pexecutor.h.
std::string faudes::ParallelExecutor::EventName | ( | Idx | index | ) | const [inline] |
Event name lookup.
This convenience method refers to the global event symbol table.
index | Index of event to look up |
Definition at line 204 of file sp_pexecutor.h.
tpTime::Type faudes::ParallelExecutor::CurrentTime | ( | void | ) | const |
Get clock time.
Reimplemented in faudes::LoggingExecutor.
Definition at line 392 of file sp_pexecutor.cpp.
int faudes::ParallelExecutor::CurrentStep | ( | void | ) | const |
Get logical time, ie number of transitions so far,.
Reimplemented in faudes::LoggingExecutor.
Definition at line 405 of file sp_pexecutor.cpp.
bool faudes::ParallelExecutor::IsDeadlocked | ( | void | ) | const |
Test for deadlocked.
The parallel executor is deadlocked if neither time can pass nor an event can be executed. Prototypical examples for such a situation is that the indvidual executers fail to agree on a common time interval, at which shaered events are enabled.
Definition at line 410 of file sp_pexecutor.cpp.
virtual bool faudes::ParallelExecutor::Valid | ( | void | ) | const [inline, virtual] |
Check validity of executors.
This is currently not implemented.
Reimplemented in faudes::LoggingExecutor.
Definition at line 238 of file sp_pexecutor.h.
const ParallelExecutor::ParallelTimedState & faudes::ParallelExecutor::CurrentParallelTimedState | ( | void | ) | const |
Get current state of the ParallelExecutor.
With "the current state" w refer to all data relevant for events generated in future. This data consists of a discrete state vector and a mapping from clocks to closk values.
Reimplemented in faudes::LoggingExecutor.
Definition at line 289 of file sp_pexecutor.cpp.
const ParallelExecutor::ParallelState & faudes::ParallelExecutor::CurrentParallelState | ( | void | ) | const |
Get current discrete state vector of the ParallelExecutor.
By "the current discrete state" we refer to a vector of indices that indicate the current state of the untimed transition structure.
Definition at line 284 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::CurrentTime | ( | tpTime::Type | time | ) | [virtual] |
Set clock time.
This does not affect clocks and, hence, is purely cosmetic. The trace buffer will record an invalid event.
time | New clock time |
Reimplemented in faudes::LoggingExecutor.
Definition at line 384 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::CurrentStep | ( | int | step | ) | [virtual] |
Set logical time (# of steps).
This does not affect clocks and, hence, is purely cosmetic. Note that, in contrast to clock time, the individual generators do not agree in logical time. The trace buffer will get out of order and should be cleared.
step | New logical time |
Reimplemented in faudes::LoggingExecutor.
Definition at line 397 of file sp_pexecutor.cpp.
bool faudes::ParallelExecutor::CurrentParallelTimedState | ( | const ParallelTimedState & | ptstate | ) | [virtual] |
Set current state of the ParallelExecutor.
This resets the parallel executor to the given state, incl clock values. Both, clock time and logical time is also reset (to 0).
Reimplemented in faudes::LoggingExecutor.
Definition at line 294 of file sp_pexecutor.cpp.
bool faudes::ParallelExecutor::ExecuteTime | ( | tpTime::Type | duration | ) | [virtual] |
Let time pass without executing a transition.
Return false if the duration specified cannot elapse without an event being executed.
duration | Amount of time that shall elapse. |
Reimplemented in faudes::LoggingExecutor, and faudes::ProposingExecutor.
Definition at line 329 of file sp_pexecutor.cpp.
bool faudes::ParallelExecutor::ExecuteEvent | ( | Idx | event | ) | [virtual] |
Execute transition.
Returns false if the transition cannot be executed at the current time.
event | Indicate transition to execute |
Reimplemented in faudes::DeviceExecutor, faudes::LoggingExecutor, and faudes::ProposingExecutor.
Definition at line 354 of file sp_pexecutor.cpp.
const TimeInterval & faudes::ParallelExecutor::EnabledTime | ( | void | ) | const |
Get maximal duration that can pass without executing an event.
Definition at line 235 of file sp_pexecutor.cpp.
const EventSet & faudes::ParallelExecutor::EnabledEvents | ( | void | ) | const |
Get events that are enabled at current (timed) state.
By "enabled" we refer to the synchronizes timed generators, that is, we do care about clock values, invariants and guards.
Definition at line 242 of file sp_pexecutor.cpp.
const EventSet & faudes::ParallelExecutor::DisabledEvents | ( | void | ) | const |
Get events that are disabled at current (timed) state.
By "disabled" we refer to the synchronizes timed generators, that is, we do care about clock values, invariants and guards.
Definition at line 248 of file sp_pexecutor.cpp.
const TimeInterval & faudes::ParallelExecutor::EnabledInterval | ( | void | ) | const |
Get an interval on which the set of enabled events is constant.
Note: while this implementation tries to come up with a potentially large interval, it is not guaranteed to be maximal.
Definition at line 254 of file sp_pexecutor.cpp.
TimeInterval faudes::ParallelExecutor::EnabledEventTime | ( | Idx | event | ) | const |
Get interval on which the specified event is enabled.
Returns empty, if the event is not active or never simultanuosly enabled in all executors.
event |
Definition at line 260 of file sp_pexecutor.cpp.
TimeInterval faudes::ParallelExecutor::EnabledGuardTime | ( | Idx | event | ) | const |
Get interval on which the respective guard is satisfied.
Returns empty, if the event is not active or if the guards are never simultanuosly satisfied in all executors.
event |
Definition at line 272 of file sp_pexecutor.cpp.
EventSet faudes::ParallelExecutor::ActiveEventSet | ( | const ParallelState & | stateVec | ) | const |
Get events that are active in all tGenerators.
By "active" we refer to the untimed transition structure, that is, we ignore clock values etc.
stateVec | Discrete state |
Definition at line 486 of file sp_pexecutor.cpp.
bool faudes::ParallelExecutor::Active | ( | Idx | ev, | |
const ParallelState & | stateVec | |||
) | const |
Test whether an event is active in a given discrete state.
By "active" we refer to the untimed transition structure, that is, we ignore clock values etc.
ev | Event to test | |
stateVec | ParallelState |
Definition at line 502 of file sp_pexecutor.cpp.
bool faudes::ParallelExecutor::Active | ( | Idx | ev | ) | const |
Test whether an event is active at current (discrete) state.
By "active" we refer to the untimed transition structure, that is, we ignore clock values etc.
ev | Event ro test |
Definition at line 497 of file sp_pexecutor.cpp.
std::string faudes::ParallelExecutor::PTSStr | ( | const ParallelTimedState & | ptstate | ) | const |
std::string faudes::ParallelExecutor::PSStr | ( | const ParallelState & | pstate | ) | const |
std::string faudes::ParallelExecutor::TEStr | ( | const TimedEvent & | tevent | ) | const |
std::string faudes::ParallelExecutor::CStr | ( | Idx | clock | ) | const |
std::string faudes::ParallelExecutor::EStr | ( | Idx | event | ) | const |
std::string faudes::ParallelExecutor::CurrentParallelTimedStateStr | ( | void | ) | const |
std::string faudes::ParallelExecutor::CurrentParallelStateStr | ( | void | ) | const |
void faudes::ParallelExecutor::ComputeEnabled | ( | void | ) | const |
Compute enabled events and enabled interval (fake const).
this is public only for performance experiments --- dont use
Definition at line 199 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::ComputeEnabledNonConst | ( | void | ) |
void faudes::ParallelExecutor::DoRead | ( | TokenReader & | rTr, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | [protected, virtual] |
Reads parallel executor from TokenReader, see also public wrappers Read() in faudes::Type.
rTr | TokenReader to read from | |
rLabel | Section to read, defaults to "Executor" | |
pContext | Read context to provide contextual information (ignored) |
Exception |
|
Reimplemented from faudes::Type.
Reimplemented in faudes::LoggingExecutor, and faudes::ProposingExecutor.
Definition at line 140 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::DoWrite | ( | TokenWriter & | rTw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [protected, virtual] |
Write to TokenWriter, see also public wrappers Write() in faudes::Type.
rTw | Reference to TokenWriter | |
rLabel | Label of section to write, defaults to "Executor" | |
pContext | Write context to provide contextual information (ignored) |
Exception |
|
Reimplemented from faudes::Type.
Reimplemented in faudes::LoggingExecutor, and faudes::ProposingExecutor.
Definition at line 114 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::DoReadGenerators | ( | TokenReader & | rTr | ) | [protected, virtual] |
Reads generator files section from TokenReader.
rTr | TokenReader to read from |
Exception |
|
Definition at line 159 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::DoWriteGenerators | ( | TokenWriter & | rTw | ) | const [protected, virtual] |
Write generator files section to TokenWriter.
rTw | Reference to TokenWriter |
Exception |
|
Definition at line 124 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::Compile | ( | void | ) | [protected, virtual] |
compile internal data (eg overall alphabet)
Reimplemented in faudes::LoggingExecutor.
Definition at line 46 of file sp_pexecutor.cpp.
void faudes::ParallelExecutor::UpdateParallelTimedState | ( | void | ) | [private] |
Idx faudes::ParallelExecutor::mRecentEvent [protected] |
std::vector<Executor> faudes::ParallelExecutor::mExecutors [private] |
std::vector<std::string> faudes::ParallelExecutor::mExecutorNames [private] |
EventSet faudes::ParallelExecutor::mAlphabet [private] |
int faudes::ParallelExecutor::mCurrentStep [private] |
TimeInterval faudes::ParallelExecutor::mETime [private] |
EventSet faudes::ParallelExecutor::mEEvents [private] |
EventSet faudes::ParallelExecutor::mDEvents [private] |
bool faudes::ParallelExecutor::mEValid [private] |
libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6