TimingSimulationEventSource.h

Go to the documentation of this file.
00001 //Copyright GSI 2012
00002 #ifndef _TIMING_SIMULATION_EVENT_SOURCE_H_
00003 #define _TIMING_SIMULATION_EVENT_SOURCE_H_
00004 
00005 #include <fesa-core/RealTime/AbstractEventSource.h>
00006 #include <fesa-core-gsi/RealTime/TimingSimulationStructures.h>
00007 #include <fesa-core-gsi/Exception/GSIException.h>
00008 #include <fesa-core/RealTime/RTEvent.h>
00009 
00010 namespace fesa
00011 {
00012         class EventElement;
00013 }
00014 
00015 namespace fesaGSI
00016 {
00017 
00023     class TimingSimulationEventSource: public fesa::AbstractEventSource
00024     {
00025         public:
00026 
00033             TimingSimulationEventSource(const std::string& name,const std::string& timingSimulationConfigFile,fesa::EventSourceType type);
00034 
00038             ~TimingSimulationEventSource();
00039 
00045             fesa::RTEvent* wait();
00046 
00052             void connect(boost::shared_ptr<fesa::EventElement>& eventElement);
00053 
00054         private:
00055 
00061                 class SimulationEvent
00062                 {
00063                         public:
00064 
00068                                 long delay_;
00069 
00073                                 long absOffset_;
00074 
00078                                 SimulationEvent* nextEvent_;
00079 
00083                                 EventConfig* eventConfig_;
00084 
00088                                 long cycleID_;
00089 
00093                                 std::string className_;
00094 
00098                                 std::string cycleName_;
00099 
00103                                 std::string domainName_;
00104 
00108                                 long relativEventTimeInCycle_;
00109 
00118                                 SimulationEvent(std::string &className,CycleConfig& cycle, DomainConfig* domain, long absOff,long relativEventTimeInCycle, EventConfig* eventConfig);
00119                 };
00120 
00125             void buildEventSequence();
00126 
00130             void checkTimingSimulationConfig();
00131 
00135             void fillEventCollection();
00136 
00140             TimingSimulationConfig* timingConfiguration_;
00141 
00145             SimulationEvent* simulationEventSequence_;
00146 
00150             SimulationEvent* currentEvent_;
00151 
00156             int superCycleCount_;
00157 
00161             long superCycleLength_;
00162 
00166             std::map <std::string,std::vector<std::string> > eventClassRelationCol_;
00167 
00171             bool eventSequenceBuild_;
00172 
00178             void insertSorted(SimulationEvent * newEvent);
00179 
00183             void computeDelays();
00184 
00188             void computeSuperCycleLength();
00189 
00197             void createSimulationEvent(EventConfig *config, long absStartCycleOffset, CycleConfig& cycle, DomainConfig* domain);
00198     };
00199 }//end namespace
00200 
00201 #endif // _TIMING_SIMULATION_EVENT_SOURCE_H_

Generated on 25 Jan 2013 for fesa-core-gsi by  doxygen 1.6.1