This class extends the AbstractEventSource to return RTEvents according to the simulation sequence specified in the Timing-Simulation configuration document. More...
#include <TimingSimulationEventSource.h>
Classes | |
class | SimulationEvent |
This is the list-object of the linked list used in the TimingSimulationEventSource. The linked list stores the complete sequence of events on which the TimingSimulationEventSource is iterating. More... | |
Public Member Functions | |
TimingSimulationEventSource (const std::string &name, const std::string &timingSimulationConfigFile, fesa::EventSourceType type) | |
constructor | |
~TimingSimulationEventSource () | |
destructor | |
fesa::RTEvent * | wait () |
This method gets stuck, until a internal timer generates and returns the next RTEvent from the linked list of EventElements. | |
void | connect (boost::shared_ptr< fesa::EventElement > &eventElement) |
In this method we check, if the event, to which a FESA-class wants to connect exists in our configuration. If yes, we link the classname to the event. Later the event will be fired once per connected class. | |
Private Member Functions | |
void | buildEventSequence () |
this method builds the event simulation sequence according to the specification in the timing configuration file | |
void | checkTimingSimulationConfig () |
this method checks if the provided configuration is valid | |
void | fillEventCollection () |
this method fills the acceptedEventsCol_ | |
void | insertSorted (SimulationEvent *newEvent) |
This method inserts the newEvent and sorts it into the linked list, according to its offset. | |
void | computeDelays () |
compute the delays for each event after having built the entire sequence | |
void | computeSuperCycleLength () |
computes the leangth of the supercycle in ms | |
void | createSimulationEvent (EventConfig *config, long absStartCycleOffset, CycleConfig &cycle, DomainConfig *domain) |
This method creates and inserts a new simulation event using the information from the event passed by parameter. | |
Private Attributes | |
TimingSimulationConfig * | timingConfiguration_ |
the configuration, read out from an XML file | |
SimulationEvent * | simulationEventSequence_ |
the event sequence as linked list. Thats the hearth of this class | |
SimulationEvent * | currentEvent_ |
The event which is currently processed (has to be on class-scope, since wait() returns. | |
int | superCycleCount_ |
decreasing number. Is filled with the number of supercycles to play. The TimingSimulation event source will stop when 0 is reached (or run for infinite time in case of -1) | |
long | superCycleLength_ |
the length of the supercycle in ms | |
std::map< std::string, std::vector< std::string > > | eventClassRelationCol_ |
map<[event],vector<[class]> > stores all events which are provided by the TimingSimulation Config file and all FWK classes which did a "connect" to these events | |
bool | eventSequenceBuild_ |
indicates if the event sequence was already build. |
This class extends the AbstractEventSource to return RTEvents according to the simulation sequence specified in the Timing-Simulation configuration document.
Definition at line 23 of file TimingSimulationEventSource.h.
fesaGSI::TimingSimulationEventSource::TimingSimulationEventSource | ( | const std::string & | name, | |
const std::string & | timingSimulationConfigFile, | |||
fesa::EventSourceType | type | |||
) |
constructor
name | The unique name of the eventsource | |
timingSimulationConfigFile | The configuration file, used for this event source | |
type | The type of this event source |
Definition at line 56 of file TimingSimulationEventSource.cpp.
References eventSequenceBuild_, fillEventCollection(), simulationEventSequence_, and timingConfiguration_.
fesaGSI::TimingSimulationEventSource::~TimingSimulationEventSource | ( | ) |
destructor
Definition at line 64 of file TimingSimulationEventSource.cpp.
References fesaGSI::TimingSimulationEventSource::SimulationEvent::nextEvent_, simulationEventSequence_, and timingConfiguration_.
void fesaGSI::TimingSimulationEventSource::buildEventSequence | ( | ) | [private] |
this method builds the event simulation sequence according to the specification in the timing configuration file
Definition at line 194 of file TimingSimulationEventSource.cpp.
References fesaGSI::TimingSimulationConfig::basicPeriodLengthMs_, checkTimingSimulationConfig(), computeDelays(), computeSuperCycleLength(), createSimulationEvent(), eventSequenceBuild_, superCycleLength_, timingConfiguration_, and fesaGSI::TimingSimulationConfig::timingDomainCol_.
Referenced by wait().
void fesaGSI::TimingSimulationEventSource::checkTimingSimulationConfig | ( | ) | [private] |
this method checks if the provided configuration is valid
Definition at line 300 of file TimingSimulationEventSource.cpp.
References fesaGSI::TimingSimulationConfig::basicPeriodLengthMs_, fesaGSI::EventConfig::delay_, fesaGSI::EventBurst, fesaGSI::EventConfig::eventName_, FESAGSIErrorEventDelayOutOfRange, FESAGSIErrorMoreThanOneDomainShift0, FESAGSIErrorNoneDomainEnabled, fesaGSI::EventBurstConfig::occurrences_, fesaGSI::EventBurstConfig::period_, superCycleLength_, timingConfiguration_, and fesaGSI::TimingSimulationConfig::timingDomainCol_.
Referenced by buildEventSequence().
void fesaGSI::TimingSimulationEventSource::computeDelays | ( | ) | [private] |
compute the delays for each event after having built the entire sequence
Definition at line 269 of file TimingSimulationEventSource.cpp.
References fesaGSI::TimingSimulationEventSource::SimulationEvent::absOffset_, fesaGSI::TimingSimulationEventSource::SimulationEvent::delay_, fesaGSI::TimingSimulationEventSource::SimulationEvent::nextEvent_, and simulationEventSequence_.
Referenced by buildEventSequence().
void fesaGSI::TimingSimulationEventSource::computeSuperCycleLength | ( | ) | [private] |
computes the leangth of the supercycle in ms
Definition at line 281 of file TimingSimulationEventSource.cpp.
References fesaGSI::TimingSimulationConfig::basicPeriodLengthMs_, superCycleLength_, timingConfiguration_, and fesaGSI::TimingSimulationConfig::timingDomainCol_.
Referenced by buildEventSequence().
void fesaGSI::TimingSimulationEventSource::connect | ( | boost::shared_ptr< fesa::EventElement > & | eventElement | ) |
In this method we check, if the event, to which a FESA-class wants to connect exists in our configuration. If yes, we link the classname to the event. Later the event will be fired once per connected class.
The | event element, to which FESA wants to connect |
Definition at line 172 of file TimingSimulationEventSource.cpp.
References eventClassRelationCol_, and FesaGSIMissingEventConfiguration.
void fesaGSI::TimingSimulationEventSource::createSimulationEvent | ( | EventConfig * | config, | |
long | absStartCycleOffset, | |||
CycleConfig & | cycle, | |||
DomainConfig * | domain | |||
) | [private] |
This method creates and inserts a new simulation event using the information from the event passed by parameter.
config | the configuration of the new event | |
absStartCycleOffset | The offset-time (in ms), when the related cycle "cycle" starts | |
cycle | Link to the cycle configuration of this event | |
domain | Link to the domain configuration of this event |
Definition at line 367 of file TimingSimulationEventSource.cpp.
References fesaGSI::EventConfig::delay_, fesaGSI::EventBurst, eventClassRelationCol_, fesaGSI::EventConfig::eventName_, insertSorted(), fesaGSI::EventBurstConfig::occurrences_, fesaGSI::EventBurstConfig::period_, superCycleLength_, and fesaGSI::EventConfig::type_.
Referenced by buildEventSequence().
void fesaGSI::TimingSimulationEventSource::fillEventCollection | ( | ) | [private] |
this method fills the acceptedEventsCol_
Definition at line 148 of file TimingSimulationEventSource.cpp.
References eventClassRelationCol_, timingConfiguration_, and fesaGSI::TimingSimulationConfig::timingDomainCol_.
Referenced by TimingSimulationEventSource().
void fesaGSI::TimingSimulationEventSource::insertSorted | ( | SimulationEvent * | newEvent | ) | [private] |
This method inserts the newEvent and sorts it into the linked list, according to its offset.
newEvent | The event to be inserted |
Definition at line 234 of file TimingSimulationEventSource.cpp.
References fesaGSI::TimingSimulationEventSource::SimulationEvent::absOffset_, fesaGSI::TimingSimulationEventSource::SimulationEvent::nextEvent_, and simulationEventSequence_.
Referenced by createSimulationEvent().
fesa::RTEvent * fesaGSI::TimingSimulationEventSource::wait | ( | ) |
This method gets stuck, until a internal timer generates and returns the next RTEvent from the linked list of EventElements.
Definition at line 77 of file TimingSimulationEventSource.cpp.
References buildEventSequence(), fesaGSI::TimingSimulationEventSource::SimulationEvent::className_, currentEvent_, fesaGSI::TimingSimulationEventSource::SimulationEvent::cycleID_, fesaGSI::TimingSimulationEventSource::SimulationEvent::cycleName_, fesaGSI::TimingSimulationEventSource::SimulationEvent::delay_, fesaGSI::TimingSimulationEventSource::SimulationEvent::domainName_, fesaGSI::TimingSimulationEventSource::SimulationEvent::eventConfig_, fesaGSI::EventConfig::eventName_, eventSequenceBuild_, FesaGSIUnusedEventSkipped, fesaGSI::TimingSimulationEventSource::SimulationEvent::nextEvent_, fesaGSI::TimingSimulationEventSource::SimulationEvent::relativEventTimeInCycle_, fesaGSI::TimingSimulationContext::setCycleTimeStamp(), simulationEventSequence_, superCycleCount_, fesaGSI::TimingSimulationConfig::superCycleRepetition_, and timingConfiguration_.
The event which is currently processed (has to be on class-scope, since wait() returns.
Definition at line 150 of file TimingSimulationEventSource.h.
Referenced by wait().
std::map<std::string,std::vector<std::string> > fesaGSI::TimingSimulationEventSource::eventClassRelationCol_ [private] |
map<[event],vector<[class]> > stores all events which are provided by the TimingSimulation Config file and all FWK classes which did a "connect" to these events
Definition at line 166 of file TimingSimulationEventSource.h.
Referenced by connect(), createSimulationEvent(), and fillEventCollection().
bool fesaGSI::TimingSimulationEventSource::eventSequenceBuild_ [private] |
indicates if the event sequence was already build.
Definition at line 171 of file TimingSimulationEventSource.h.
Referenced by buildEventSequence(), TimingSimulationEventSource(), and wait().
the event sequence as linked list. Thats the hearth of this class
Definition at line 145 of file TimingSimulationEventSource.h.
Referenced by computeDelays(), insertSorted(), TimingSimulationEventSource(), wait(), and ~TimingSimulationEventSource().
int fesaGSI::TimingSimulationEventSource::superCycleCount_ [private] |
decreasing number. Is filled with the number of supercycles to play. The TimingSimulation event source will stop when 0 is reached (or run for infinite time in case of -1)
Definition at line 156 of file TimingSimulationEventSource.h.
Referenced by wait().
long fesaGSI::TimingSimulationEventSource::superCycleLength_ [private] |
the length of the supercycle in ms
Definition at line 161 of file TimingSimulationEventSource.h.
Referenced by buildEventSequence(), checkTimingSimulationConfig(), computeSuperCycleLength(), and createSimulationEvent().
the configuration, read out from an XML file
Definition at line 140 of file TimingSimulationEventSource.h.
Referenced by buildEventSequence(), checkTimingSimulationConfig(), computeSuperCycleLength(), fillEventCollection(), TimingSimulationEventSource(), wait(), and ~TimingSimulationEventSource().