ARPDAS_QNX6 1.0
|
00001 #ifndef DG_H_INCLUDED 00002 #define DG_H_INCLUDED 00003 00004 #include "DQ.h" 00005 #include "DG_Resmgr.h" 00006 #include "DG_cmd.h" 00007 #include "DG_tmr.h" 00008 00009 enum dg_event { dg_event_start, dg_event_stop, dg_event_fast, dg_event_quit }; 00010 00011 class data_queue; 00012 class DG_cmd; 00013 class DG_tmr; 00014 00015 class data_generator : public data_queue { 00016 public: 00017 data_generator(int nQrows, int low_water); 00018 virtual ~data_generator(); 00019 void init( int collection ); 00020 void operate(); // event loop 00021 int execute(const char *cmd); 00022 virtual void event(enum dg_event evt); 00023 DG_dispatch *dispatch; 00024 virtual void service_row_timer() = 0; 00025 protected: 00026 bool quit; // non-zero means we are terminating 00027 bool started; // True while running 00028 bool regulated; // True whenever data flow is time-based 00029 bool autostart; 00030 bool regulation_optional; 00031 00032 // virtual void single_step() = 0; 00033 void transmit_data( int single_row ); 00034 int dg_bfr_fd; 00035 DG_cmd *cmd; 00036 DG_tmr *tmr; 00037 private: 00038 void tm_start(int lock_needed = 1); 00039 void tm_play(int lock_needed = 1); 00040 void tm_stop(); 00041 uint64_t row_period_nsec_default; 00042 uint64_t row_period_nsec_current; 00043 void check_writev( int rc, int wr_size, const char *where ); 00044 }; 00045 00046 #endif