CARMA C++
FrameIPQwriter.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_MONITOR_FRAME_IPQ_WRITER_H
11 #define CARMA_MONITOR_FRAME_IPQ_WRITER_H
12 
13 #include "carma/util/FrameAlignedTimer.h"
14 
15 namespace carma {
16 namespace monitor {
17 
18 
19 extern const long HALF_SECOND_IN_NANOSECONDS;
20 
21 
22 class FrameIPQwriter {
23  public:
24 
31  FrameIPQwriter(
32  const ::std::string & ipqWriterThreadName,
33  double delayInS );
34 
35  virtual ~FrameIPQwriter( );
36 
41  void operator()();
42 
43  protected:
44 
50  double getNextFireTime( ) const;
51 
57  double resetNextFireTime( long delayFrames );
58 
59  private:
60 
61  virtual void writeBuffer() = 0;
62 
63  struct ::timespec nextTime_;
64 
68  util::FrameAlignedTimer timer_;
69 
70  size_t writeCount_;
71  size_t nextWriteLogCount_;
72 };
73 
74 
75 } // End namespace carma::monitor
76 } // End namespace carma
77 
78 #endif