#ifndef CTA_ACTL_CDTS_SIMULATOR #define CTA_ACTL_CDTS_SIMULATOR #include #include #include #include namespace CTA { namespace ACTL { namespace CDTS { typedef std::unique_ptr Socket_ptr; class Simulator : public Processor { public: Simulator(Socket_ptr&& pSocket, double pFrequencyInHz, double pRMSInPS); virtual ~Simulator() {} DELETE_CONSTRUCTORS(Simulator) double GetFrequencyInHz() const { Lock lock(fMutex); return fFrequencyInHz; } double GetRMSInPS() const { Lock lock(fMutex); return fRMSInPS; } void SetFrequency(double pFrequencyInHz) { Lock lock(fMutex); fFrequencyInHz = pFrequencyInHz; } void SetRMS(double pRMSInPS) { Lock lock(fMutex); fRMSInPS = pRMSInPS; } bool GetBunchCounterErrorEnabled() const { Lock lock(fMutex); return fBunchCounterErrorEnabled; } bool GetEventCounterErrorEnabled() const { Lock lock(fMutex); return fEventCounterErrorEnabled; } bool GetTimeStampMissingEnabled() const { Lock lock(fMutex); return fTimeStampMissingEnabled; } bool GetSecondErrorEnabled() const { Lock lock(fMutex); return fSecondErrorEnabled; } bool GetPicoSecondErrorEnabled() const { Lock lock(fMutex); return fPicoSecondErrorEnabled; } void SetBunchCounterErrorEnabled(bool pFlag) { Lock lock(fMutex); fBunchCounterErrorEnabled = pFlag; } void SetEventCounterErrorEnabled(bool pFlag) { Lock lock(fMutex); fEventCounterErrorEnabled = pFlag; } void SetTimeStampMissingEnabled(bool pFlag) { Lock lock(fMutex); fTimeStampMissingEnabled = pFlag; } void SetSecondErrorEnabled(bool pFlag) { Lock lock(fMutex); fSecondErrorEnabled = pFlag; } void SetPicoSecondErrorEnabled(bool pFlag) { Lock lock(fMutex); fPicoSecondErrorEnabled = pFlag; } protected: virtual bool Process(); private: typedef std::chrono::system_clock Clock; typedef std::chrono::seconds Seconds; typedef std::chrono::milliseconds Milliseconds; typedef std::chrono::nanoseconds Nanoseconds; typedef std::chrono::time_point TimePoint; Socket_ptr fSocket; double fFrequencyInHz; double fRMSInPS; bool fBunchCounterErrorEnabled; bool fEventCounterErrorEnabled; bool fTimeStampMissingEnabled; bool fSecondErrorEnabled; bool fPicoSecondErrorEnabled; TriggerBunch fTriggerBunch; uint64_t fBunchCounter; uint64_t fEventCounter; TimePoint fLast; TRandom3 fRandom; }; } } } #endif