00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef LIST_CLIENT_H
00027 #define LIST_CLIENT_H
00028
00029 #include "packet.h"
00030
00031 #include <iostream.h>
00032 #include <assert.h>
00033 #include <string.h>
00034 #include <stdio.h>
00035 #include <string.h>
00036 #include <stdlib.h>
00037
00038
00039 #include <string>
00040
00041 #include <qstring.h>
00042 #include <qlist.h>
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 class PlotProps {
00057 public :
00058 friend class Plot;
00059 PlotProps (char *dev = "no_name",char *var="no_name",
00060 int in =0,int prio=0,bool p=FALSE,bool s=FALSE) {
00061 dev_name = dev;
00062 var_name = var;
00063 priority = prio;
00064 indx = in;
00065 plotflag = p;
00066 storeflag = s;
00067 InitPlotOptions();
00068 marker = FALSE;
00069 }
00070 ~PlotProps() {
00071 dev_name.~string();
00072 var_name.~string();
00073 }
00074 int indx;
00075 int priority;
00076 string dev_name;
00077 string var_name;
00078 bool plotflag;
00079 bool storeflag;
00080 PlotSettings Ps;
00081 bool marker;
00082 private:
00083 void InitPlotOptions(void) {
00084 Ps.pminx = P_MIN_SIZE_X;
00085 Ps.pminy = P_MIN_SIZE_Y;
00086 Ps.pleftborder = P_LEFT_BORDER;
00087 Ps.pupperborder = P_UPPER_BORDER;
00088 Ps.pdefsizex = P_DEF_SIZE_X;
00089 Ps.pdefsizey = P_DEF_SIZE_Y;
00090 Ps.xticks = X_TICKS;
00091 Ps.yticks = Y_TICKS;
00092 Ps.ticksize = TICKSIZE;
00093 Ps.tickpos = TICKPOS;
00094 Ps.tickposx = TICKPOS_X;
00095 Ps.as_interval = AS_INTERVAL;
00096 Ps.yupper = Y_UPPER_LIMIT;
00097 Ps.ylower = Y_LOWER_LIMIT;
00098 Ps.autoscale = AUTOSCALE;
00099 Ps.hgridlines = HGRIDLINES;
00100 Ps.vgridlines = VGRIDLINES;
00101 }
00102 };
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 class Element {
00117 friend class Cl_List;
00118 public:
00119
00120 private:
00121
00122 Element(int W, const char *device, const char *var,int flag,int data_type,
00123 int x=0,int y=0, Element *E = 0) {
00124 i_var = W;
00125 next = E;
00126 enabled = flag;
00127 plotflag = y;
00128 type = data_type;
00129 storeflag = x;
00130 device_name = device;
00131 var_name = var;
00132 }
00133
00134 Element(double W, const char *device,const char *var,int flag, int data_type,
00135 int x=0,int y=0, Element *E = 0) {
00136 d_var = W;
00137 next = E;
00138 enabled = flag;
00139 plotflag = y;
00140 type = data_type;
00141 storeflag = x;
00142 device_name = device;
00143 var_name = var;
00144 }
00145 ~Element() {
00146 device_name.~string();
00147 var_name.~string();
00148 }
00149 string device_name;
00150 string var_name;
00151 int enabled;
00152
00153
00154 int i_var;
00155 double d_var;
00156 char c_var;
00157 char *s_var;
00158 Element *next;
00159 int type;
00160 int storeflag;
00161 int plotflag;
00162 };
00163
00164
00165
00166 class Cl_List
00167 {
00168 public:
00169 Cl_List()
00170 {
00171 L=0; Buffer_pointer=L;
00172 PlotPropList = new QList<PlotProps>;
00173 PlotPropList -> setAutoDelete(TRUE);
00174 assert(PlotPropList !=0);
00175
00176
00177 }
00178 ~Cl_List() {
00179 remove();
00180 delete PlotPropList;
00181 }
00182 void initialize();
00183 void insert (int , char *,char *,int,int );
00184 void insert (double, char *,char *,int,int );
00185 void append (int, char *,char *,int,int,int,int );
00186 void append (double ,char *,char *,int,int,int,int );
00187 Element * exist(char *,char *);
00188 void SortPlotProperties(void);
00189 void remove ();
00190 int is_active(char *);
00191
00192 int remove (int );
00193 int remove (double );
00194 int getvar (int * ,char *,char *);
00195 int getvar (double *,char *,char *);
00196 int putvar (int ,char *,char *);
00197 int putvar (double ,char *,char *);
00198 int varcomp(Element *,char *,char *);
00199 void putvar(int, int);
00200 void putvar(double, int);
00201 void putvar( char *,int);
00202 int enabled(char *,char *);
00203 int plotstatus(int );
00204 int getint (int );
00205 double getdouble(int );
00206 char getchr (int );
00207 char* getstr (int );
00208 char* get_data_type(char *);
00209
00210
00211
00212
00213
00214 devDataPacket * GetPacketElement(char *);
00215 devDataPacket * GetNextPacket(void );
00216 void ResetHelpPointer(void);
00217 int AdvanceHelpPointer(void);
00218
00219 string getAllDeviceParameters(char * );
00220 void reset_data_buffer();
00221 void printlist();
00222 int initlist(char *);
00223 int initPlotOptions(FILE *fp,PlotProps *);
00224 Element* End_Of_List();
00225 char * getstring(int);
00226 int get_type(int );
00227 int length();
00228 int array_length();
00229 char * get_name(int );
00230 const char * get_var_name(int );
00231 int get_store_flag(int );
00232 int get_plot_flag(int);
00233 int get_enabled_flag(int);
00234 void set_enabled_flag(int,bool);
00235 void set_plot_flag(int,bool);
00236 int get_number_plotvars(char *);
00237 string get_plotvar_namelist(char *);
00238
00239 QList <PlotProps> *PlotPropList;
00240 private:
00241 string ParameterStr;
00242 int index;
00243 int x,i,y;
00244 Element *L;
00245 Element *BufferPointer,*Buffer_pointer;
00246 };
00247
00248 #endif
00249
00250
00251