ARPDAS_QNX6 1.0
|
00001 /** \file DC.h 00002 * Data Client Clases 00003 */ 00004 #ifndef DC_H_INCLUDED 00005 #define DC_H_INCLUDED 00006 #include <stdio.h> 00007 #include "tm.h" 00008 00009 #ifdef __cplusplus 00010 00011 /** 00012 * \brief Defines interface for data client connection to TMbfr 00013 */ 00014 class data_client { 00015 public: 00016 data_client(int bufsize_in, int fast = 0, int non_block = 0); 00017 data_client(int bufsize_in, int non_block, char *srcfile); 00018 void operate(); // event loop 00019 void resize_buffer(int bufsize_in); 00020 void load_tmdac(char *path); 00021 static unsigned int next_minor_frame, majf_row, minf_row; 00022 static char *srcnode; 00023 protected: 00024 virtual void process_data() = 0; 00025 virtual void process_init(); 00026 virtual void process_tstamp(); 00027 virtual int process_eof(); 00028 int bfr_fd; 00029 void read(); 00030 bool dc_quit; 00031 tm_msg_t *msg; 00032 int nbQrow; // may differ from nbrow if stripping MFCtr & Synch 00033 int nbDataHdr; 00034 tm_hdrw_t input_tm_type; 00035 void init_tm_type(); 00036 private: 00037 void process_message(); 00038 int nQrows; 00039 int bufsize; 00040 int dc_state; 00041 unsigned int bytes_read; /// number of bytes currently in buf 00042 unsigned int toread; /// number of bytes needed before next action 00043 bool tm_info_ready; 00044 char *buf; 00045 void init(int bufsize_in, int non_block, const char *srcfile); 00046 }; 00047 00048 #define DC_STATE_HDR 0 00049 #define DC_STATE_DATA 1 00050 00051 class ext_data_client : public data_client { 00052 public: 00053 inline ext_data_client(int bufsize_in, int fast = 0, int non_block = 0) : 00054 data_client(bufsize_in, fast, non_block) {} 00055 protected: 00056 void process_data(); 00057 }; 00058 00059 extern void tminitfunc(); 00060 00061 extern "C" { 00062 #endif 00063 00064 /* This is all that is exposed to a C module */ 00065 extern void dc_set_srcnode(char *nodename); 00066 00067 #ifdef __cplusplus 00068 }; 00069 #endif 00070 00071 #endif