TimingEventSource.h

Go to the documentation of this file.
00001 //Copyright GSI 2012
00002 #ifndef _TIMING_EVENT_SOURCE_H_
00003 #define _TIMING_EVENT_SOURCE_H_
00004 
00005 #include <map>
00006 
00007 #include <fesa-core/RealTime/AbstractEventSource.h>
00008 #include <fesa-core-gsi/Exception/GSIException.h>
00009 #include <fesa-core/RealTime/RTEvent.h>
00010 #include <fesa-core-gsi/RealTime/RealTimeLabObjectFactory.h>
00011 
00012 extern "C"
00013 {
00014 #include <tim/TimLib.h>
00015 #include <tgv/tgv.h>
00016 }
00017 
00018 namespace fesa
00019 {
00020         class EventElement;
00021 }
00022 
00023 namespace fesaGSI
00024 {
00025 
00026     class TimingEventSource: public fesa::AbstractEventSource
00027     {
00028         friend class fesaGSI::RealTimeLabObjectFactory;
00029 
00030         public:
00031         private:
00032             TimingEventSource();
00033             ~TimingEventSource();
00034 
00035             fesa::RTEvent* wait();
00036 
00037             void connect(boost::shared_ptr<fesa::EventElement>& eventElement);
00038 
00039 
00040             struct TimingInfo {
00041 
00043                 std::string concreteName_;
00044 
00046                 bool forewarning_;
00047 
00048             };
00049 
00050 
00051                          class TimingKey
00052             {
00053                 private:
00054                     int _equipId;
00055                     int _module;
00056                 public:
00057                     TimingKey(int equipId, int module) :
00058                         _equipId(equipId), _module(module)
00059                     {
00060                     }
00061                     ;
00062                     bool operator<(const TimingKey& tk) const
00063                     {
00064 
00065                         if (_equipId < tk._equipId)
00066                             return true;
00067                         else if (_equipId > tk._equipId)
00068                             return false;
00069                         // last value to check (shortened)
00070                         return (_module < tk._module);
00071                     }
00072                     ;
00073             };
00074 
00075 
00079             std::map <int, TimingInfo> ctimEventsCol_;
00080 
00084             std::map <int, TimingInfo> ltimEventsCol_;
00085 
00089             std::map <TimingKey, TimingInfo> ltimHardEventsCol_;
00090 
00091             // LTIM_HARD connectionId is computed from the moduleNb and the channel.
00092             // Therefore, they can overlap CTIM connectionId. So LTIM_HARD connectionId
00093             // are multiplied by -1 to make them different
00094             static int LTIM_HARD_ID_TRANS;
00095             unsigned int getDebugOptions(); // gets global debug options
00096             //          unsigned int getLtimId(const string& name);             // translates ltim name into ltim ID
00097             // FileDescriptor for the timingDriver connection
00098             int fd_;
00099             static int ourDebugOptions_;
00100 
00101     };
00102 
00103 }
00104 
00105 #endif // _TIMING_EVENT_SOURCE_H_

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