Detailed Description

Executor with logging facilities.

Logging to Token IO

Logging destination in general is a TokenWriter, which may be initialised to a file or console output. Logging can be configured to include

  • the external behaviour (timed event sequence),
  • the internal behaviour (state sequence) and/or
  • timing statistics of conditions specified by AttributeSimCondition.

Logging to Internal FIFO Buffer

The state- and event-sequence can be logged to a internal FIFO Buffer. Methods to revert to a previous state are provided. This feature is meant to facilitate user interaction in simulator applications.

Technical detail: since the trace buffer only covers the dynamic state of the parallel executor, the RevertToStep method cannot recover the condition status. Including stochastic states with the trace buffer is considered to expensive.

File IO

For token IO, the LoggingExecutor reads and writes a section with default label "Executor". It contains a ParallelExecutor section to define a vector of generators and a SimConditionSet section to define the relevant conditions. Example:

<Executor>
<Generators>
"./some_generator.gen"
"./other_generator.gen"
</Generators>
"IdleCond"
<EventCondition>
<StartEvents> "beta" "mue" </StartEvents>
<StopEvents> "alpha" </StopEvents>
</EventCondition>
"DownCond"
<StateCondition>
<StateSet> "down" </StateSet> % refers to first generator
<StateSet> "down" "repair" </StateSet> % refers to second generator
</StateCondition>
</Executor>
const SimConditionSet & Conditions(void) const
Read-only access to simulation conditions.
IndexSet StateSet
Definition: cfl_indexset.h:271

Definition at line 85 of file sp_lpexecutor.h.

#include <sp_lpexecutor.h>

Classes

struct  TraceSample
 Buffer data entry. More...
 

Public Member Functions

Constructors & Destructor
 LoggingExecutor (void)
 Construct an emtpy LoggingExecuter. More...
 
 LoggingExecutor (const LoggingExecutor &rOther)
 Copy constructor. More...
 
 LoggingExecutor (const std::string &rFileName)
 Construct from file. More...
 
virtual ~LoggingExecutor (void)
 Explicit destructor. More...
 
Re-implemenented from ParallelExecutor
virtual void Clear (void)
 Clear all data. More...
 
virtual void Reset (void)
 Goto initial state. More...
 
virtual bool Valid (void) const
 Check validity of executors. More...
 
virtual bool ExecuteTime (Time::Type duration)
 Let time pass without executing a transition. More...
 
virtual bool ExecuteEvent (Idx event)
 Execute transition. More...
 
Time::Type CurrentTime (void) const
 Get clock time. More...
 
void CurrentTime (Time::Type time)
 Set clock time. More...
 
int CurrentStep (void) const
 Get logical time, ie number of transitions so far,. More...
 
void CurrentStep (int step)
 Set logical time (# of steps) More...
 
bool CurrentParallelTimedState (const ParallelTimedState &ptstate)
 Set current state of the ParallelExecutor. More...
 
const ParallelTimedStateCurrentParallelTimedState (void) const
 Get current state of the ParallelExecutor. More...
 
- Public Member Functions inherited from faudes::ParallelExecutor
 ParallelExecutor (void)
 Construct an emtpy ParallelExecuter. More...
 
 ParallelExecutor (const ParallelExecutor &rOther)
 Copy constructor. More...
 
 ParallelExecutor (const std::string &rFileName)
 Construct from file. More...
 
virtual ~ParallelExecutor (void)
 Explicit destructor. More...
 
Idx Size (void) const
 Number of TimedGenerators. More...
 
void Insert (const std::string &rFileName)
 Add a TimedGenerator from file. More...
 
void Insert (const TimedGenerator &rGen)
 Add a TimedGenerator. More...
 
const EventSetAlphabet (void) const
 Overall alphabet. More...
 
Iterator Begin (void) const
 
Iterator End (void) const
 
const ExecutorAt (int i) const
 
Idx EventIndex (const std::string &rName) const
 Event index lookup. More...
 
std::string EventName (Idx index) const
 Event name lookup. More...
 
Time::Type CurrentTime (void) const
 Get clock time. More...
 
int CurrentStep (void) const
 Get logical time, ie number of transitions so far,. More...
 
bool IsDeadlocked () const
 Test for deadlocked. More...
 
const ParallelTimedStateCurrentParallelTimedState (void) const
 Get current state of the ParallelExecutor. More...
 
const ParallelStateCurrentParallelState (void) const
 Get current discrete state vector of the ParallelExecutor. More...
 
const TimeIntervalEnabledTime () const
 Get maximal duration that can pass without executing an event. More...
 
const EventSetEnabledEvents () const
 Get events that are enabled at current (timed) state. More...
 
const EventSetDisabledEvents () const
 Get events that are disabled at current (timed) state. More...
 
const TimeIntervalEnabledInterval () const
 Get an interval on which the set of enabled events is constant. More...
 
TimeInterval EnabledEventTime (Idx event) const
 Get interval on which the specified event is enabled. More...
 
TimeInterval EnabledGuardTime (Idx event) const
 Get interval on which the respective guard is satisfied. More...
 
EventSet ActiveEventSet (const ParallelState &stateVec) const
 Get events that are active in all TimedGenerators. More...
 
bool Active (Idx ev, const ParallelState &stateVec) const
 Test whether an event is active in a given discrete state. More...
 
bool Active (Idx ev) const
 Test whether an event is active at current (discrete) state. More...
 
std::string PTSStr (const ParallelTimedState &ptstate) const
 Pretty printable string of timed parallel state. More...
 
std::string PSStr (const ParallelState &pstate) const
 Pretty printable string of parallel state. More...
 
std::string TEStr (const TimedEvent &tevent) const
 Pretty printable string of timed event. More...
 
std::string CStr (Idx clock) const
 Pretty printable string of clock name. More...
 
std::string EStr (Idx event) const
 Pretty printable string of event. More...
 
std::string CurrentParallelTimedStateStr (void) const
 Pretty printable string of current state. More...
 
std::string CurrentParallelStateStr (void) const
 Pretty printable string of parallel state
More...
 
void ComputeEnabled (void) const
 Compute enabled events and enabled interval (fake const) More...
 
void ComputeEnabledNonConst (void)
 Compute enabled core routine (non const) More...
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 Constructor. More...
 
 Type (const Type &rType)
 Copy constructor. More...
 
virtual ~Type (void)
 Destructor. More...
 
virtual TypeNew (void) const
 Construct on heap. More...
 
virtual TypeCopy (void) const
 Construct on heap. More...
 
virtual const TypeCast (const Type *pOther) const
 Cast other object to this type. More...
 
virtual TypeAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
virtual Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void Name (const std::string &rName)
 Set the objects's name. More...
 
virtual const std::string & Name (void) const
 Get objects's name. More...
 
virtual const std::string & TypeName (void) const
 Get objects's type name. More...
 
void Write (const Type *pContext=0) const
 Write configuration data to console. More...
 
void Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file. More...
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 Write configuration data to a file. More...
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to TokenWriter. More...
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to an XML file. More...
 
void XWrite (const Type *pContext=0) const
 Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes. More...
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in XML format to TokenWriter. More...
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a string. More...
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a formated string. More...
 
void DWrite (const Type *pContext=0) const
 Write configuration data to console, debugging format. More...
 
void DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file, debugging format. More...
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debug format to TokenWriter. More...
 
void SWrite (TokenWriter &rTw) const
 Write statistics comment to TokenWriter. More...
 
void SWrite (void) const
 Write statistics comment to console. More...
 
std::string ToSText (void) const
 Write statistics to a string. More...
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from file with label specified. More...
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from a string. More...
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from TokenReader with label sepcified. More...
 

Protected Member Functions

virtual void Compile ()
 Compile internal data (all) More...
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Reads logging executor from TokenReader, see also public wrappers in faudes::Type. More...
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write to TokenWriter, see also public wrappers in faudes::Type. More...
 
void DoAssign (const LoggingExecutor &rSrc)
 Assignment method. More...
 
- Protected Member Functions inherited from faudes::ParallelExecutor
virtual void DoReadGenerators (TokenReader &rTr)
 Reads generator files section from TokenReader. More...
 
virtual void DoWriteGenerators (TokenWriter &rTw) const
 Write generator files section to TokenWriter. More...
 
void DoAssign (const ParallelExecutor &rSrc)
 Assignment method. More...
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
bool DoEqual (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data of this object to TokenWriter in XML format. More...
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debugging format to TokenWriter. More...
 
virtual void DoSWrite (TokenWriter &rTw) const
 Write statistical data as a comment to TokenWriter. More...
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 Get objects's type definition. More...
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Private Member Functions

void CompileConditions (void)
 Compile condition internal data. More...
 
void ConditionsReset (void)
 Reset condition simulation state. More...
 
void ConditionsProcess (void)
 Process condition hook. More...
 
void LogWriteStatistics (void)
 Logging hook: dump statistics. More...
 
void LogWriteState (void)
 Logging hook: dump current state. More...
 
void LogWriteEvent (void)
 Logging hook: dump recent event. More...
 
void LogWriteTime (void)
 Logging hook: dump current time. More...
 
void LogWritePause (void)
 Logging hook: halt simulation. More...
 
void LogWriteResume (void)
 Logging hook: continue simulation. More...
 
void TraceAddSample (void)
 Trace: helper, append one void sample. More...
 
void TraceUpdateTime (void)
 Trace: append sample (if necessary) and update to current time
More...
 
void TraceUpdateTransition (Idx event)
 Trace: append sample (if necessary) and update to current state via given event
More...
 

Private Attributes

SimConditionSet mConditions
 Simulation conditions. More...
 
std::vector< AttributeSimCondition * > mEnabledConditions
 Enabled simulation conditions. More...
 
bool mBreakCondition
 Indicate break. More...
 
TokenWriterpLogTokenWriter
 Logging: tokenwriter ref. More...
 
std::string mLogFile
 Logging: file name. More...
 
int mLogMode
 Logging: mode. More...
 
int mTraceMax
 Trace data: max fifo length. More...
 
int mTraceFirstStep
 Trace data: step no of first sample. More...
 
std::deque< TraceSamplemTraceBuffer
 Trace data: fifo buffer. More...
 
std::map< Time::Type, int > mTraceTimeToStep
 Trace data: time to step mapping (first step) More...
 

Logging to Token I/O

enum  LogMode { LogStatistics =0x01 , LogStates =0x02 , LogEvents =0x04 , LogTime =0x08 }
 Logging mode flags, to specify what data to log. More...
 
void LogOpen (TokenWriter &rTw, int mode)
 Start logging to TokenWriter. More...
 
void LogOpen (const std::string &rFileName, int logmode, std::ios::openmode openmode=std::ios::out|std::ios::trunc)
 Start logging to file. More...
 
void LogClose (void)
 Stop logging. More...
 

Simulation Conditions

typedef SimConditionSet::Iterator ConditionIterator
 Condition iterator: typedef. More...
 
const SimConditionSetConditions (void) const
 Read-only access to simulation conditions. More...
 
void Conditions (const SimConditionSet &)
 Set all simulation conditions. More...
 
const AttributeSimConditionCondition (const std::string &rName) const
 Read-only access to a simulation condition by name. More...
 
const AttributeSimConditionCondition (Idx cond) const
 Read-only access to a simulation condition by index. More...
 
Idx SetCondition (const std::string &rName, const AttributeSimCondition &rCondition)
 Set (or add) a condition by name. More...
 
void SetCondition (Idx cond, const AttributeSimCondition &rCondition)
 Set a condition by index
More...
 
void ClrCondition (const std::string &rName)
 Remove a condition by name
More...
 
void ClrCondition (Idx cond)
 Remove a condition by index
More...
 
void ConditionsWrite (TokenWriter &rTw, const std::string &rLabel="SimConditions") const
 Write conditions so labled section
More...
 
void ConditionsRead (TokenReader &rTr, const std::string &rLabel="SimConditions")
 Read conditions from labled section
More...
 
ConditionIterator ConditionsBegin (void) const
 Condition iterator: begin. More...
 
ConditionIterator ConditionsEnd (void) const
 Condition iterator: end
More...
 
bool BreakCondition (void) const
 Simulation state: true if some break condition is currently satisfied. More...
 

Trace to FIFO buffer

typedef std::deque< TraceSample >::const_iterator TraceIterator
 Access buffer: iterator. More...
 
void TraceClear (int length=-2)
 Clear buffer and set max buffer. More...
 
int TraceLength (void) const
 Access buffer: current length. More...
 
TraceIterator TraceBegin (void) const
 Condition iterator: begin. More...
 
TraceIterator TraceEnd (void) const
 Condition iterator: end
More...
 
const TraceSampleTraceAtTime (Time::Type time) const
 Access buffer: sample by faudes time (returns first sample) More...
 
const TraceSampleTraceAtStep (int step) const
 Access buffer: sample by step. More...
 
const TraceSampleTraceFirst (void) const
 Access buffer: first sample. More...
 
const TraceSampleTraceRecent (void) const
 Access buffer: recent sample. More...
 
const TraceSampleTraceCurrent (void) const
 Access buffer: current sample. More...
 
void TraceWrite (TokenWriter &rTw, const TraceSample &sample) const
 Access buffer: tokenwriter output. More...
 
void TraceWrite (const TraceSample &sample) const
 Access buffer: console output. More...
 
std::string TraceToString (const TraceSample &sample) const
 Access buffer: convert to string. More...
 
void TraceWrite (void) const
 Access buffer: console output (list all) More...
 
virtual bool RevertToStep (Idx step)
 Revert executors state to past step from buffer. More...
 

Additional Inherited Members

- Public Types inherited from faudes::ParallelExecutor
typedef std::vector< IdxParallelState
 Typedef for parallel discrete state. More...
 
typedef std::vector< std::map< Idx, Time::Type > > ParallelClock
 Typedef for parallel clock values. More...
 
typedef Executor::TimedState TimedState
 Provide typedef from Executor. More...
 
typedef std::vector< Executor >::const_iterator Iterator
 Read-only access to individual executors. More...
 
- Protected Attributes inherited from faudes::ParallelExecutor
Idx mRecentEvent
 recent event More...
 

Member Typedef Documentation

◆ ConditionIterator

typedef SimConditionSet::Iterator faudes::LoggingExecutor::ConditionIterator

Condition iterator: typedef.

Definition at line 292 of file sp_lpexecutor.h.

◆ TraceIterator

typedef std::deque<TraceSample>::const_iterator faudes::LoggingExecutor::TraceIterator

Access buffer: iterator.

Definition at line 356 of file sp_lpexecutor.h.

Member Enumeration Documentation

◆ LogMode

Logging mode flags, to specify what data to log.

doxygen group

Enumerator
LogStatistics 
LogStates 
LogEvents 
LogTime 

Definition at line 314 of file sp_lpexecutor.h.

Constructor & Destructor Documentation

◆ LoggingExecutor() [1/3]

faudes::LoggingExecutor::LoggingExecutor ( void  )

Construct an emtpy LoggingExecuter.

doxygen group

Definition at line 22 of file sp_lpexecutor.cpp.

◆ LoggingExecutor() [2/3]

faudes::LoggingExecutor::LoggingExecutor ( const LoggingExecutor rOther)

Copy constructor.

Definition at line 30 of file sp_lpexecutor.cpp.

◆ LoggingExecutor() [3/3]

faudes::LoggingExecutor::LoggingExecutor ( const std::string &  rFileName)

Construct from file.

See ParallelExecutor::Insert(const std::string& rFileName) for details.

Parameters
rFileNameFilename
Exceptions
Exception
  • Non-deteministic generator (id 501)
  • IO errors (id 1)
  • token mismatch (id see TimedGenerator)

Definition at line 39 of file sp_lpexecutor.cpp.

◆ ~LoggingExecutor()

faudes::LoggingExecutor::~LoggingExecutor ( void  )
virtual

Explicit destructor.

Definition at line 48 of file sp_lpexecutor.cpp.

Member Function Documentation

◆ BreakCondition()

bool faudes::LoggingExecutor::BreakCondition ( void  ) const
inline

Simulation state: true if some break condition is currently satisfied.

Definition at line 301 of file sp_lpexecutor.h.

◆ Clear()

void faudes::LoggingExecutor::Clear ( void  )
virtual

Clear all data.

doxygen group Removes all generators/executors, all conditions, and resets the current state to a void value.

Reimplemented from faudes::ParallelExecutor.

Reimplemented in faudes::ProposingExecutor, and faudes::DeviceExecutor.

Definition at line 89 of file sp_lpexecutor.cpp.

◆ ClrCondition() [1/2]

void faudes::LoggingExecutor::ClrCondition ( const std::string &  rName)

Remove a condition by name

Definition at line 260 of file sp_lpexecutor.cpp.

◆ ClrCondition() [2/2]

void faudes::LoggingExecutor::ClrCondition ( Idx  cond)

Remove a condition by index

Definition at line 266 of file sp_lpexecutor.cpp.

◆ Compile()

void faudes::LoggingExecutor::Compile ( void  )
protectedvirtual

Compile internal data (all)

Reimplemented from faudes::ParallelExecutor.

Definition at line 63 of file sp_lpexecutor.cpp.

◆ CompileConditions()

void faudes::LoggingExecutor::CompileConditions ( void  )
private

Compile condition internal data.

Definition at line 294 of file sp_lpexecutor.cpp.

◆ Condition() [1/2]

const AttributeSimCondition & faudes::LoggingExecutor::Condition ( const std::string &  rName) const

Read-only access to a simulation condition by name.

Definition at line 223 of file sp_lpexecutor.cpp.

◆ Condition() [2/2]

const AttributeSimCondition & faudes::LoggingExecutor::Condition ( Idx  cond) const

Read-only access to a simulation condition by index.

Definition at line 228 of file sp_lpexecutor.cpp.

◆ Conditions() [1/2]

void faudes::LoggingExecutor::Conditions ( const SimConditionSet rConditions)

Set all simulation conditions.

Definition at line 214 of file sp_lpexecutor.cpp.

◆ Conditions() [2/2]

const SimConditionSet & faudes::LoggingExecutor::Conditions ( void  ) const

Read-only access to simulation conditions.

doxygen group

Definition at line 209 of file sp_lpexecutor.cpp.

◆ ConditionsBegin()

LoggingExecutor::ConditionIterator faudes::LoggingExecutor::ConditionsBegin ( void  ) const

Condition iterator: begin.

Definition at line 284 of file sp_lpexecutor.cpp.

◆ ConditionsEnd()

LoggingExecutor::ConditionIterator faudes::LoggingExecutor::ConditionsEnd ( void  ) const

Condition iterator: end

Definition at line 289 of file sp_lpexecutor.cpp.

◆ ConditionsProcess()

void faudes::LoggingExecutor::ConditionsProcess ( void  )
private

Process condition hook.

Definition at line 327 of file sp_lpexecutor.cpp.

◆ ConditionsRead()

void faudes::LoggingExecutor::ConditionsRead ( TokenReader rTr,
const std::string &  rLabel = "SimConditions" 
)

Read conditions from labled section

Definition at line 277 of file sp_lpexecutor.cpp.

◆ ConditionsReset()

void faudes::LoggingExecutor::ConditionsReset ( void  )
private

Reset condition simulation state.

Definition at line 320 of file sp_lpexecutor.cpp.

◆ ConditionsWrite()

void faudes::LoggingExecutor::ConditionsWrite ( TokenWriter rTw,
const std::string &  rLabel = "SimConditions" 
) const

Write conditions so labled section

Definition at line 272 of file sp_lpexecutor.cpp.

◆ CurrentParallelTimedState() [1/2]

bool faudes::LoggingExecutor::CurrentParallelTimedState ( const ParallelTimedState ptstate)
virtual

Set current state of the ParallelExecutor.

This resets the parallel executor to the given state, incl clock values. The trace buffer is cleared. You should pause/resume logging befor/after interfering with the executors state.

Returns
True for success

Reimplemented from faudes::ParallelExecutor.

Definition at line 196 of file sp_lpexecutor.cpp.

◆ CurrentParallelTimedState() [2/2]

const ParallelTimedState& faudes::LoggingExecutor::CurrentParallelTimedState ( void  ) const
inline

Get current state of the ParallelExecutor.

Returns
Discrete state vector and clock value maps

Definition at line 248 of file sp_lpexecutor.h.

◆ CurrentStep() [1/2]

void faudes::LoggingExecutor::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 is cleared. You should pause/resume logging befor/after interfering with the executors state.

Parameters
stepNew logical time

Reimplemented from faudes::ParallelExecutor.

Definition at line 176 of file sp_lpexecutor.cpp.

◆ CurrentStep() [2/2]

int faudes::LoggingExecutor::CurrentStep ( void  ) const
inline

Get logical time, ie number of transitions so far,.

Definition at line 213 of file sp_lpexecutor.h.

◆ CurrentTime() [1/2]

void faudes::LoggingExecutor::CurrentTime ( Time::Type  time)
virtual

Set clock time.

This does not affect clocks and, hence, is purely cosmetic. The trace buffer is cleared. You should pause/resume logging befor/after interfering with the executors state.

Parameters
timeNew clock time

Reimplemented from faudes::ParallelExecutor.

Definition at line 186 of file sp_lpexecutor.cpp.

◆ CurrentTime() [2/2]

Time::Type faudes::LoggingExecutor::CurrentTime ( void  ) const
inline

Get clock time.

Definition at line 196 of file sp_lpexecutor.h.

◆ DoAssign()

void faudes::LoggingExecutor::DoAssign ( const LoggingExecutor rSrc)
protected

Assignment method.

Parameters
rSrcSource to assign from

Definition at line 54 of file sp_lpexecutor.cpp.

◆ DoRead()

void faudes::LoggingExecutor::DoRead ( TokenReader rTr,
const std::string &  rLabel = "",
const Type pContext = 0 
)
protectedvirtual

Reads logging executor from TokenReader, see also public wrappers in faudes::Type.

Parameters
rTrTokenReader to read from
rLabelSection to read, defaults to "Executor"
pContextRead context to provide contextual information (ignored)
Exceptions
Exception
  • non-deterministic generator(s) (id 501)
  • token mismatch (id 502)
  • IO error (id 1)

Reimplemented from faudes::ParallelExecutor.

Reimplemented in faudes::ProposingExecutor.

Definition at line 112 of file sp_lpexecutor.cpp.

◆ DoWrite()

void faudes::LoggingExecutor::DoWrite ( TokenWriter rTw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const
protectedvirtual

Write to TokenWriter, see also public wrappers in faudes::Type.

Parameters
rTwReference to TokenWriter
rLabelLabel of section to write, defaults to "Executor"
pContextWrite context to provide contextual information (ignored)
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::ParallelExecutor.

Reimplemented in faudes::ProposingExecutor.

Definition at line 101 of file sp_lpexecutor.cpp.

◆ ExecuteEvent()

bool faudes::LoggingExecutor::ExecuteEvent ( Idx  event)
virtual

Execute transition.

Returns false if the transition cannot be executed at the current time.

Parameters
eventIndicate transition to execute
Returns
True on success

Reimplemented from faudes::ParallelExecutor.

Reimplemented in faudes::ProposingExecutor, and faudes::DeviceExecutor.

Definition at line 158 of file sp_lpexecutor.cpp.

◆ ExecuteTime()

bool faudes::LoggingExecutor::ExecuteTime ( Time::Type  duration)
virtual

Let time pass without executing a transition.

Return false if the specified duration
cannot elapse without an event being executed.

Parameters
durationAmount of time that shall elapse.
Returns
True for success

Reimplemented from faudes::ParallelExecutor.

Reimplemented in faudes::ProposingExecutor.

Definition at line 146 of file sp_lpexecutor.cpp.

◆ LogClose()

void faudes::LoggingExecutor::LogClose ( void  )

Stop logging.

Definition at line 417 of file sp_lpexecutor.cpp.

◆ LogOpen() [1/2]

void faudes::LoggingExecutor::LogOpen ( const std::string &  rFileName,
int  logmode,
std::ios::openmode  openmode = std::ios::out|std::ios::trunc 
)

Start logging to file.

Definition at line 408 of file sp_lpexecutor.cpp.

◆ LogOpen() [2/2]

void faudes::LoggingExecutor::LogOpen ( TokenWriter rTw,
int  mode 
)

Start logging to TokenWriter.

Definition at line 391 of file sp_lpexecutor.cpp.

◆ LogWriteEvent()

void faudes::LoggingExecutor::LogWriteEvent ( void  )
private

Logging hook: dump recent event.

Definition at line 467 of file sp_lpexecutor.cpp.

◆ LogWritePause()

void faudes::LoggingExecutor::LogWritePause ( void  )
private

Logging hook: halt simulation.

Definition at line 493 of file sp_lpexecutor.cpp.

◆ LogWriteResume()

void faudes::LoggingExecutor::LogWriteResume ( void  )
private

Logging hook: continue simulation.

Definition at line 505 of file sp_lpexecutor.cpp.

◆ LogWriteState()

void faudes::LoggingExecutor::LogWriteState ( void  )
private

Logging hook: dump current state.

Definition at line 457 of file sp_lpexecutor.cpp.

◆ LogWriteStatistics()

void faudes::LoggingExecutor::LogWriteStatistics ( void  )
private

Logging hook: dump statistics.

Definition at line 436 of file sp_lpexecutor.cpp.

◆ LogWriteTime()

void faudes::LoggingExecutor::LogWriteTime ( void  )
private

Logging hook: dump current time.

Definition at line 480 of file sp_lpexecutor.cpp.

◆ Reset()

void faudes::LoggingExecutor::Reset ( void  )
virtual

Goto initial state.

Reset all clock values to zero, assign initial states to each executor, reset condition states to not-satisfied, invalidate timing samples.

Reimplemented from faudes::ParallelExecutor.

Reimplemented in faudes::ProposingExecutor.

Definition at line 73 of file sp_lpexecutor.cpp.

◆ RevertToStep()

bool faudes::LoggingExecutor::RevertToStep ( Idx  step)
virtual

Revert executors state to past step from buffer.

Reimplemented in faudes::ProposingExecutor.

Definition at line 656 of file sp_lpexecutor.cpp.

◆ SetCondition() [1/2]

Idx faudes::LoggingExecutor::SetCondition ( const std::string &  rName,
const AttributeSimCondition rCondition 
)

Set (or add) a condition by name.

Definition at line 247 of file sp_lpexecutor.cpp.

◆ SetCondition() [2/2]

void faudes::LoggingExecutor::SetCondition ( Idx  cond,
const AttributeSimCondition rCondition 
)

Set a condition by index

Definition at line 254 of file sp_lpexecutor.cpp.

◆ TraceAddSample()

void faudes::LoggingExecutor::TraceAddSample ( void  )
private

Trace: helper, append one void sample.

Definition at line 579 of file sp_lpexecutor.cpp.

◆ TraceAtStep()

const LoggingExecutor::TraceSample * faudes::LoggingExecutor::TraceAtStep ( int  step) const

Access buffer: sample by step.

Definition at line 539 of file sp_lpexecutor.cpp.

◆ TraceAtTime()

const LoggingExecutor::TraceSample * faudes::LoggingExecutor::TraceAtTime ( Time::Type  time) const

Access buffer: sample by faudes time (returns first sample)

Definition at line 547 of file sp_lpexecutor.cpp.

◆ TraceBegin()

LoggingExecutor::TraceIterator faudes::LoggingExecutor::TraceBegin ( void  ) const

Condition iterator: begin.

Definition at line 529 of file sp_lpexecutor.cpp.

◆ TraceClear()

void faudes::LoggingExecutor::TraceClear ( int  length = -2)

Clear buffer and set max buffer.

doxygen group

Parameters
lengthMax length of buffer, or: -2 <> keep length, -1<>infinite, 0<> no buffer

Definition at line 513 of file sp_lpexecutor.cpp.

◆ TraceCurrent()

const LoggingExecutor::TraceSample * faudes::LoggingExecutor::TraceCurrent ( void  ) const

Access buffer: current sample.

Definition at line 556 of file sp_lpexecutor.cpp.

◆ TraceEnd()

LoggingExecutor::TraceIterator faudes::LoggingExecutor::TraceEnd ( void  ) const

Condition iterator: end

Definition at line 534 of file sp_lpexecutor.cpp.

◆ TraceFirst()

const LoggingExecutor::TraceSample * faudes::LoggingExecutor::TraceFirst ( void  ) const

Access buffer: first sample.

Definition at line 568 of file sp_lpexecutor.cpp.

◆ TraceLength()

int faudes::LoggingExecutor::TraceLength ( void  ) const

Access buffer: current length.

Definition at line 574 of file sp_lpexecutor.cpp.

◆ TraceRecent()

const LoggingExecutor::TraceSample * faudes::LoggingExecutor::TraceRecent ( void  ) const

Access buffer: recent sample.

Definition at line 562 of file sp_lpexecutor.cpp.

◆ TraceToString()

std::string faudes::LoggingExecutor::TraceToString ( const TraceSample sample) const

Access buffer: convert to string.

Definition at line 649 of file sp_lpexecutor.cpp.

◆ TraceUpdateTime()

void faudes::LoggingExecutor::TraceUpdateTime ( void  )
private

Trace: append sample (if necessary) and update to current time

Definition at line 612 of file sp_lpexecutor.cpp.

◆ TraceUpdateTransition()

void faudes::LoggingExecutor::TraceUpdateTransition ( Idx  event)
private

Trace: append sample (if necessary) and update to current state via given event

Definition at line 600 of file sp_lpexecutor.cpp.

◆ TraceWrite() [1/3]

void faudes::LoggingExecutor::TraceWrite ( const TraceSample sample) const

Access buffer: console output.

Definition at line 636 of file sp_lpexecutor.cpp.

◆ TraceWrite() [2/3]

void faudes::LoggingExecutor::TraceWrite ( TokenWriter rTw,
const TraceSample sample 
) const

Access buffer: tokenwriter output.

Definition at line 623 of file sp_lpexecutor.cpp.

◆ TraceWrite() [3/3]

void faudes::LoggingExecutor::TraceWrite ( void  ) const

Access buffer: console output (list all)

Definition at line 642 of file sp_lpexecutor.cpp.

◆ Valid()

virtual bool faudes::LoggingExecutor::Valid ( void  ) const
inlinevirtual

Check validity of executors.

This is currently not implemented. It should include tests on the state based conditions.

Returns
True on success

Reimplemented from faudes::ParallelExecutor.

Definition at line 164 of file sp_lpexecutor.h.

Member Data Documentation

◆ mBreakCondition

bool faudes::LoggingExecutor::mBreakCondition
private

Indicate break.

Definition at line 453 of file sp_lpexecutor.h.

◆ mConditions

SimConditionSet faudes::LoggingExecutor::mConditions
private

Simulation conditions.

Definition at line 447 of file sp_lpexecutor.h.

◆ mEnabledConditions

std::vector<AttributeSimCondition*> faudes::LoggingExecutor::mEnabledConditions
private

Enabled simulation conditions.

Definition at line 450 of file sp_lpexecutor.h.

◆ mLogFile

std::string faudes::LoggingExecutor::mLogFile
private

Logging: file name.

Definition at line 468 of file sp_lpexecutor.h.

◆ mLogMode

int faudes::LoggingExecutor::mLogMode
private

Logging: mode.

Definition at line 471 of file sp_lpexecutor.h.

◆ mTraceBuffer

std::deque<TraceSample> faudes::LoggingExecutor::mTraceBuffer
private

Trace data: fifo buffer.

Definition at line 498 of file sp_lpexecutor.h.

◆ mTraceFirstStep

int faudes::LoggingExecutor::mTraceFirstStep
private

Trace data: step no of first sample.

Definition at line 495 of file sp_lpexecutor.h.

◆ mTraceMax

int faudes::LoggingExecutor::mTraceMax
private

Trace data: max fifo length.

Definition at line 492 of file sp_lpexecutor.h.

◆ mTraceTimeToStep

std::map<Time::Type,int> faudes::LoggingExecutor::mTraceTimeToStep
private

Trace data: time to step mapping (first step)

Definition at line 501 of file sp_lpexecutor.h.

◆ pLogTokenWriter

TokenWriter* faudes::LoggingExecutor::pLogTokenWriter
private

Logging: tokenwriter ref.

Definition at line 465 of file sp_lpexecutor.h.


The documentation for this class was generated from the following files:

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen