ARPDAS_QNX6 1.0
|
00001 #ifndef DG_DATA_H 00002 #define DG_DATA_H 00003 00004 struct data_dev_attr; 00005 #define IOFUNC_ATTR_T struct data_dev_attr 00006 #define IOFUNC_OCB_T struct data_dev_ocb 00007 00008 #include <signal.h> 00009 #include <limits.h> 00010 #include "DG.h" 00011 00012 class data_generator; 00013 class DG_data; 00014 00015 struct data_dev_attr { 00016 iofunc_attr_t attr; 00017 iofunc_notify_t notify[3]; 00018 bool written; 00019 DG_data *DGd; 00020 }; 00021 00022 struct data_dev_ocb { 00023 iofunc_ocb_t hdr; 00024 int rcvid; 00025 int msgsize; 00026 }; 00027 00028 00029 class DG_data : public DG_dispatch_client { 00030 private: 00031 int dev_id; 00032 const char *name; // Keep around mostly for debugging 00033 int stale_count; 00034 void *dptr; 00035 int dsize; 00036 bool synched; 00037 struct data_dev_attr data_attr; 00038 struct data_dev_ocb *blocked; 00039 static resmgr_connect_funcs_t connect_funcs; 00040 static resmgr_io_funcs_t io_funcs; 00041 static bool funcs_initialized; 00042 static bool quitting; 00043 public: 00044 // DG_data(data_generator *data_gen); // perhaps I only need the dispatch 00045 DG_data(DG_dispatch *disp, const char *name, void *data, 00046 int data_size, int synch); 00047 ~DG_data(); 00048 int ready_to_quit(); // virtual function of DG_dispatch_client 00049 int io_write(resmgr_context_t *ctp, IOFUNC_OCB_T *ocb, int nonblock); 00050 void synch(); 00051 int stale(int max_stale = SHRT_MAX); 00052 }; 00053 00054 extern "C" { 00055 int DG_data_io_write( resmgr_context_t *ctp, 00056 io_write_t *msg, IOFUNC_OCB_T *ocb ); 00057 int DG_data_io_notify( resmgr_context_t *ctp, 00058 io_notify_t *msg, IOFUNC_OCB_T *ocb ); 00059 int DG_data_io_close_ocb( resmgr_context_t *ctp, 00060 void *rsvd, IOFUNC_OCB_T *ocb ); 00061 } 00062 00063 #endif 00064