faudes::Executor Class Reference
|
Classes | |
struct | TimedState |
Typedef for timed state. More... | |
Public Member Functions | |
Executor (void) | |
Creates an emtpy Executer. | |
Executor (const TimedGenerator &rGen) | |
Construct from tgenerator. | |
Executor (const std::string &rFileName) | |
Construct from TimedGenerator file. | |
void | Generator (const TimedGenerator &rGen) |
Initialise from TimedGenerator. | |
const TimedGenerator & | Generator (void) const |
Reference to the internal generator for inspection. | |
const std::string & | Name (void) const |
Generator name (for convenience). | |
std::string | StateName (Idx idx) const |
State name (for convenience). | |
std::string | EventName (Idx idx) const |
Event name (for convenience). | |
void | Clear (void) |
Clear all data incl TimedGenerator. | |
void | Reset () |
Reset all clocks and assign initial state. | |
const TimeInterval & | EnabledTime () const |
Get maximal interval of time that can pass without executing an event. | |
const EventSet & | EnabledEvents () const |
Get set of events that are enabled at current (timed) state. | |
const EventSet & | DisabledEvents () const |
Get set of events that are disabled at current (timed) state. | |
const TimeInterval & | EnabledInterval () const |
Get maximal interval on which set of enabled events is constant. | |
TimeInterval | EnabledEventTime (Idx event) const |
Get interval on which an active event is enabled. | |
TimeInterval | EnabledGuardTime (Idx event) const |
Get interval on which an active event satisfies its guard. | |
const EventSet & | ActiveEventSet (void) const |
Get set of events that are active at current (untimed) state. | |
const TransSet & | ActiveTransSet (void) const |
Get set of transitions that are active at current (untimed) state. | |
bool | ExecuteTime (tpTime::Type time) |
Let time pass. | |
bool | ExecuteEvent (Idx event) |
Execute transition. | |
bool | CurrentTimedState (const TimedState &tstate) |
Set timed state. | |
const TimedState & | CurrentTimedState (void) const |
Get timed state. | |
bool | CurrentState (Idx index) |
Set discrete state. | |
Idx | CurrentState (void) const |
Get discrete state. | |
bool | CurrentClockValue (Idx clock, tpTime::Type time) |
Set value of clock variable. | |
tpTime::Type | CurrentClockValue (Idx clock) const |
Get value of clock. | |
void | CurrentTime (tpTime::Type time) |
Set current time. | |
tpTime::Type | CurrentTime (void) const |
Get current time. | |
void | CurrentStep (int step) |
Set logic time (# of steps). | |
int | CurrentStep (void) const |
Get logic time ie numer of transitions so far. | |
bool | IsDeadlocked () const |
Returns true if timed generator is in a deadlocked state. | |
virtual bool | Valid (void) const |
Check if Executor is valid. | |
std::string | CurrentTimedStateStr (void) const |
Pretty printable string of current state. | |
std::string | TSStr (const TimedState &tstate) const |
Pretty printable string of timed state. | |
std::string | TEStr (const TimedEvent &tevent) const |
Pretty printable string of timed event. | |
std::string | CStr (Idx idx) const |
Pretty printable string of clock name. | |
std::string | EStr (Idx idx) const |
Pretty printable string of event. | |
std::string | SStr (Idx idx) const |
Pretty printable string of state. | |
Protected Member Functions | |
virtual void | DoAssign (const Executor &rSrc) |
Assignment method. | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Reads configuration from TokenReader, see Typefor public wrappers. | |
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Writes configuration to TokenWriter, see Type for public wrappers. | |
Private Member Functions | |
void | Compile (void) |
Prepare internal data structurs from generator. | |
void | ComputeEnabled (void) const |
Compute enabled events and enabled interval (fake const). | |
void | ComputeEnabledNonConst (void) |
Compute enabled core routine (non const). | |
Private Attributes | |
TimedState | mCurrentTimedState |
Current state incl clock values. | |
tpTime::Type | mCurrentTime |
Current clock time. | |
int | mCurrentStep |
Current logic time. | |
TimeInterval | mETime |
Record enabled time. | |
EventSet | mEEvents |
Record enabled events. | |
TimeInterval | mEInterval |
Record rime on shich mEEvents is constant. | |
std::map< Idx, TimeInterval > | mEGuardInterval |
Record interval in which each guard is enabled. | |
EventSet | mDEvents |
Record disabled events. | |
EventSet | mAEvents |
Record active events (ie regardles time). | |
TransSet | mATrans |
Record active transitions (regardles time). | |
bool | mEValid |
Validity flag for the above data. | |
std::map< Transition, std::map < Idx, TimeInterval > > | mTransClockIntervalMap |
Compiled generator data: map transition to clock to interval constraint. | |
std::map< Idx, std::map< Idx, TimeInterval > > | mStateClockIntervalMap |
Compiled generator data: map state to clock to interval constraint. |
An Executor is a timed generator that maintains a current state.
The Executor is the lowest level building block for the libFAUDES simulator plugin. It maintains a current state that consists of
The Executor provides Methods that indicate which transitions currently are enabled, referring to the current state, the current clock values and the guard and invariant data from the TimedGenerator. In contrast to enabled events, there is also the notion of active events, which refers to the discrete state only, ignoring guards and invariants.
Technically, the Executor class is derived from the TimedGenerator, however inheritence is private. The common way to initialise an Executor object is to construct it from a const ref to a TimedGenerator, which sets up additional internal data structures. Read-only access to the underlying generator is given by the faudes::Executor::Generator() method.
Note: a prequisit of the current implementation is that the underlying generator is deterministic ie the current discrete state is uniquely determind by the external sequence of discrete events.
Definition at line 92 of file sp_executor.h.
faudes::Executor::Executor | ( | void | ) |
Creates an emtpy Executer.
Definition at line 22 of file sp_executor.cpp.
faudes::Executor::Executor | ( | const TimedGenerator & | rGen | ) |
Construct from tgenerator.
Construction from a TimedGenerator will copy all given TimedGenerator data and complie it to some additional Executor specific data. Thus, if the original TimedGenerator changes the Executor will not reflect these changes.
rGen | Input generator |
Exception |
|
Definition at line 29 of file sp_executor.cpp.
faudes::Executor::Executor | ( | const std::string & | rFileName | ) |
Construct from TimedGenerator file.
rFileName | File to read |
Exception |
|
Definition at line 35 of file sp_executor.cpp.
const EventSet & faudes::Executor::ActiveEventSet | ( | void | ) | const |
Get set of events that are active at current (untimed) state.
Definition at line 273 of file sp_executor.cpp.
const TransSet & faudes::Executor::ActiveTransSet | ( | void | ) | const |
Get set of transitions that are active at current (untimed) state.
Definition at line 279 of file sp_executor.cpp.
void faudes::Executor::Clear | ( | void | ) | [virtual] |
Clear all data incl TimedGenerator.
Reimplemented from faudes::TaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >.
Definition at line 91 of file sp_executor.cpp.
void faudes::Executor::Compile | ( | void | ) | [private] |
Prepare internal data structurs from generator.
Definition at line 53 of file sp_executor.cpp.
void faudes::Executor::ComputeEnabled | ( | void | ) | const [private] |
Compute enabled events and enabled interval (fake const).
Definition at line 138 of file sp_executor.cpp.
void faudes::Executor::ComputeEnabledNonConst | ( | void | ) | [private] |
Compute enabled core routine (non const).
Definition at line 144 of file sp_executor.cpp.
std::string faudes::Executor::CStr | ( | Idx | idx | ) | const |
Pretty printable string of clock name.
Reimplemented from faudes::TtGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >.
Definition at line 496 of file sp_executor.cpp.
tpTime::Type faudes::Executor::CurrentClockValue | ( | Idx | clock | ) | const |
Get value of clock.
clock | Index of clock variable |
Definition at line 422 of file sp_executor.cpp.
bool faudes::Executor::CurrentClockValue | ( | Idx | clock, | |
tpTime::Type | time | |||
) |
Set value of clock variable.
Returns false if clock not in clockset.
clock | Index of clock variable to set | |
time | Time to set |
Definition at line 414 of file sp_executor.cpp.
Idx faudes::Executor::CurrentState | ( | void | ) | const |
bool faudes::Executor::CurrentState | ( | Idx | index | ) |
Set discrete state.
Returns false if state is not in state set.
index | State index |
Definition at line 401 of file sp_executor.cpp.
int faudes::Executor::CurrentStep | ( | void | ) | const |
Get logic time ie numer of transitions so far.
Definition at line 447 of file sp_executor.cpp.
void faudes::Executor::CurrentStep | ( | int | step | ) |
Set logic time (# of steps).
step | New logic time |
Definition at line 441 of file sp_executor.cpp.
tpTime::Type faudes::Executor::CurrentTime | ( | void | ) | const |
void faudes::Executor::CurrentTime | ( | tpTime::Type | time | ) |
const Executor::TimedState & faudes::Executor::CurrentTimedState | ( | void | ) | const |
Get timed state.
Definition at line 396 of file sp_executor.cpp.
bool faudes::Executor::CurrentTimedState | ( | const TimedState & | tstate | ) |
Set timed state.
Returns false if state or clock values are invalid.
tstate | State to set. |
Definition at line 382 of file sp_executor.cpp.
std::string faudes::Executor::CurrentTimedStateStr | ( | void | ) | const |
Pretty printable string of current state.
Definition at line 479 of file sp_executor.cpp.
const EventSet & faudes::Executor::DisabledEvents | ( | void | ) | const |
Get set of events that are disabled at current (timed) state.
Definition at line 261 of file sp_executor.cpp.
void faudes::Executor::DoAssign | ( | const Executor & | rSrc | ) | [protected, virtual] |
Assignment method.
rSrc | Source to assign from |
Definition at line 128 of file sp_executor.cpp.
void faudes::Executor::DoRead | ( | TokenReader & | rTr, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | [protected, virtual] |
Reads configuration from TokenReader, see Typefor public wrappers.
rTr | TokenReader to read from | |
rLabel | Section to read | |
pContext | Read context to provide contextual information |
Exception |
|
Reimplemented from faudes::vGenerator.
Definition at line 115 of file sp_executor.cpp.
void faudes::Executor::DoWrite | ( | TokenWriter & | rTw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [protected, virtual] |
Writes configuration to TokenWriter, see Type for public wrappers.
rTw | TokenWriter to write to | |
rLabel | Section to write | |
pContext | Write context to provide contextual information |
Exception |
|
Reimplemented from faudes::vGenerator.
Definition at line 122 of file sp_executor.cpp.
const EventSet & faudes::Executor::EnabledEvents | ( | void | ) | const |
Get set of events that are enabled at current (timed) state.
Definition at line 255 of file sp_executor.cpp.
TimeInterval faudes::Executor::EnabledEventTime | ( | Idx | event | ) | const |
Get interval on which an active event is enabled.
event | Active event |
Definition at line 285 of file sp_executor.cpp.
TimeInterval faudes::Executor::EnabledGuardTime | ( | Idx | event | ) | const |
Get interval on which an active event satisfies its guard.
event | Active event |
Definition at line 304 of file sp_executor.cpp.
const TimeInterval & faudes::Executor::EnabledInterval | ( | void | ) | const |
Get maximal interval on which set of enabled events is constant.
Definition at line 267 of file sp_executor.cpp.
const TimeInterval & faudes::Executor::EnabledTime | ( | void | ) | const |
Get maximal interval of time that can pass without executing an event.
This corresponds to the inveriant of the current timed state.
Definition at line 249 of file sp_executor.cpp.
std::string faudes::Executor::EStr | ( | Idx | idx | ) | const |
Pretty printable string of event.
Reimplemented from faudes::vGenerator.
Definition at line 491 of file sp_executor.cpp.
std::string faudes::Executor::EventName | ( | Idx | idx | ) | const [inline] |
Event name (for convenience).
Reimplemented from faudes::vGenerator.
Definition at line 173 of file sp_executor.h.
bool faudes::Executor::ExecuteEvent | ( | Idx | event | ) |
Execute transition.
Returns false if the transition is not enabled and hence cannot be executed at the current time
event | Indicate transition to execute |
Definition at line 354 of file sp_executor.cpp.
bool faudes::Executor::ExecuteTime | ( | tpTime::Type | time | ) |
Let time pass.
Returns false if the specified amount of time cannot elapse without an event being executed
time | Amount of time that shall elapse. |
Definition at line 317 of file sp_executor.cpp.
const TimedGenerator & faudes::Executor::Generator | ( | void | ) | const |
Reference to the internal generator for inspection.
Definition at line 41 of file sp_executor.cpp.
void faudes::Executor::Generator | ( | const TimedGenerator & | rGen | ) |
Initialise from TimedGenerator.
rGen | Input generator |
Definition at line 46 of file sp_executor.cpp.
bool faudes::Executor::IsDeadlocked | ( | void | ) | const |
Returns true if timed generator is in a deadlocked state.
Definition at line 452 of file sp_executor.cpp.
const std::string& faudes::Executor::Name | ( | void | ) | const [inline, virtual] |
Generator name (for convenience).
Reimplemented from faudes::vGenerator.
Definition at line 160 of file sp_executor.h.
void faudes::Executor::Reset | ( | void | ) |
Reset all clocks and assign initial state.
Definition at line 102 of file sp_executor.cpp.
std::string faudes::Executor::SStr | ( | Idx | idx | ) | const |
Pretty printable string of state.
Reimplemented from faudes::vGenerator.
Definition at line 501 of file sp_executor.cpp.
std::string faudes::Executor::StateName | ( | Idx | idx | ) | const [inline] |
State name (for convenience).
Reimplemented from faudes::vGenerator.
Definition at line 166 of file sp_executor.h.
std::string faudes::Executor::TEStr | ( | const TimedEvent & | tevent | ) | const |
Pretty printable string of timed event.
Definition at line 484 of file sp_executor.cpp.
std::string faudes::Executor::TSStr | ( | const TimedState & | tstate | ) | const |
Pretty printable string of timed state.
Definition at line 460 of file sp_executor.cpp.
virtual bool faudes::Executor::Valid | ( | void | ) | const [inline, virtual] |
Check if Executor is valid.
Not implemented, should check for determinism and consitency of current state and clock values.
Definition at line 394 of file sp_executor.h.
EventSet faudes::Executor::mAEvents [private] |
Record active events (ie regardles time).
Definition at line 510 of file sp_executor.h.
TransSet faudes::Executor::mATrans [private] |
Record active transitions (regardles time).
Definition at line 513 of file sp_executor.h.
int faudes::Executor::mCurrentStep [private] |
Current logic time.
Definition at line 483 of file sp_executor.h.
tpTime::Type faudes::Executor::mCurrentTime [private] |
Current clock time.
Definition at line 480 of file sp_executor.h.
Current state incl clock values.
Definition at line 477 of file sp_executor.h.
EventSet faudes::Executor::mDEvents [private] |
Record disabled events.
Definition at line 507 of file sp_executor.h.
EventSet faudes::Executor::mEEvents [private] |
Record enabled events.
Definition at line 498 of file sp_executor.h.
std::map<Idx,TimeInterval> faudes::Executor::mEGuardInterval [private] |
Record interval in which each guard is enabled.
Definition at line 504 of file sp_executor.h.
TimeInterval faudes::Executor::mEInterval [private] |
Record rime on shich mEEvents is constant.
Definition at line 501 of file sp_executor.h.
TimeInterval faudes::Executor::mETime [private] |
Record enabled time.
Definition at line 495 of file sp_executor.h.
bool faudes::Executor::mEValid [private] |
Validity flag for the above data.
Definition at line 516 of file sp_executor.h.
std::map<Idx, std::map<Idx,TimeInterval> > faudes::Executor::mStateClockIntervalMap [private] |
Compiled generator data: map state to clock to interval constraint.
Definition at line 522 of file sp_executor.h.
std::map<Transition, std::map<Idx,TimeInterval> > faudes::Executor::mTransClockIntervalMap [private] |
Compiled generator data: map transition to clock to interval constraint.
Definition at line 519 of file sp_executor.h.
libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen