1 | #ifndef __DICHHDEFS
|
---|
2 | #define __DICHHDEFS
|
---|
3 | #include <assert.h>
|
---|
4 | #include <stdlib.h>
|
---|
5 | #include <string.h>
|
---|
6 | #ifndef WIN32
|
---|
7 | #include <unistd.h>
|
---|
8 | #endif
|
---|
9 | #ifdef __VMS
|
---|
10 | #include <starlet.h>
|
---|
11 | #endif
|
---|
12 | #include "dim_core.hxx"
|
---|
13 | #include "dim.hxx"
|
---|
14 | #include "tokenstring.hxx"
|
---|
15 |
|
---|
16 | enum DimServiceType {DimSERVICE=1, DimCOMMAND, DimRPC};
|
---|
17 |
|
---|
18 | class DimClient;
|
---|
19 | class DimInfo;
|
---|
20 | class DimCurrentInfo;
|
---|
21 | class DimRpcInfo;
|
---|
22 |
|
---|
23 | class DllExp DimInfoHandler{
|
---|
24 | public:
|
---|
25 | DimInfo *itsService;
|
---|
26 | DimInfo *getInfo() { return itsService; };
|
---|
27 | virtual void infoHandler() = 0;
|
---|
28 | virtual ~DimInfoHandler() {};
|
---|
29 | };
|
---|
30 |
|
---|
31 | class DllExp DimInfo : public DimInfoHandler, public DimTimer{
|
---|
32 |
|
---|
33 | public :
|
---|
34 | DimInfoHandler *itsHandler;
|
---|
35 |
|
---|
36 | DimInfo(){};
|
---|
37 | DimInfo(const char *name, int nolink)
|
---|
38 | { subscribe((char *)name, 0, &nolink, sizeof(int), 0); };
|
---|
39 | DimInfo(const char *name, int time, int nolink)
|
---|
40 | { subscribe((char *)name, time, &nolink, sizeof(int), 0); };
|
---|
41 | DimInfo(const char *name, float nolink)
|
---|
42 | { subscribe((char *)name, 0, &nolink, sizeof(float), 0); };
|
---|
43 | DimInfo(const char *name, int time, float nolink)
|
---|
44 | { subscribe((char *)name, time, &nolink, sizeof(float), 0); };
|
---|
45 | DimInfo(const char *name, double nolink)
|
---|
46 | { subscribe((char *)name, 0, &nolink, sizeof(double), 0); };
|
---|
47 | DimInfo(const char *name, int time, double nolink)
|
---|
48 | { subscribe((char *)name, time, &nolink, sizeof(double), 0); };
|
---|
49 | DimInfo(const char *name, longlong nolink)
|
---|
50 | { subscribe((char *)name, 0, &nolink, sizeof(longlong), 0); };
|
---|
51 | DimInfo(const char *name, int time, longlong nolink)
|
---|
52 | { subscribe((char *)name, time, &nolink, sizeof(longlong), 0); };
|
---|
53 | DimInfo(const char *name, short nolink)
|
---|
54 | { subscribe((char *)name, 0, &nolink, sizeof(short), 0); };
|
---|
55 | DimInfo(const char *name, int time, short nolink)
|
---|
56 | { subscribe((char *)name, time, &nolink, sizeof(short), 0); };
|
---|
57 | DimInfo(const char *name, char *nolink)
|
---|
58 | { subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };
|
---|
59 | DimInfo(const char *name, int time, char *nolink)
|
---|
60 | { subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };
|
---|
61 | DimInfo(const char *name, void *nolink, int nolinksize)
|
---|
62 | { subscribe((char *)name, 0, nolink, nolinksize, 0); };
|
---|
63 | DimInfo(const char *name, int time, void *nolink, int nolinksize)
|
---|
64 | { subscribe((char *)name, time, nolink, nolinksize, 0); };
|
---|
65 |
|
---|
66 | DimInfo(const char *name, int nolink, DimInfoHandler *handler)
|
---|
67 | { subscribe((char *)name, 0, &nolink, sizeof(int), handler); };
|
---|
68 | DimInfo(const char *name, int time, int nolink, DimInfoHandler *handler)
|
---|
69 | { subscribe((char *)name, time, &nolink, sizeof(int), handler); };
|
---|
70 | DimInfo(const char *name, float nolink, DimInfoHandler *handler)
|
---|
71 | { subscribe((char *)name, 0, &nolink, sizeof(float), handler); };
|
---|
72 | DimInfo(const char *name, int time, float nolink, DimInfoHandler *handler)
|
---|
73 | { subscribe((char *)name, time, &nolink, sizeof(float), handler); };
|
---|
74 | DimInfo(const char *name, double nolink, DimInfoHandler *handler)
|
---|
75 | { subscribe((char *)name, 0, &nolink, sizeof(double), handler); };
|
---|
76 | DimInfo(const char *name, int time, double nolink, DimInfoHandler *handler)
|
---|
77 | { subscribe((char *)name, time, &nolink, sizeof(double), handler); };
|
---|
78 | DimInfo(const char *name, longlong nolink, DimInfoHandler *handler)
|
---|
79 | { subscribe((char *)name, 0, &nolink, sizeof(longlong), handler); };
|
---|
80 | DimInfo(const char *name, int time, longlong nolink, DimInfoHandler *handler)
|
---|
81 | { subscribe((char *)name, time, &nolink, sizeof(longlong), handler); };
|
---|
82 | DimInfo(const char *name, short nolink, DimInfoHandler *handler)
|
---|
83 | { subscribe((char *)name, 0, &nolink, sizeof(short), handler); };
|
---|
84 | DimInfo(const char *name, int time, short nolink, DimInfoHandler *handler)
|
---|
85 | { subscribe((char *)name, time, &nolink, sizeof(short), handler); };
|
---|
86 | DimInfo(const char *name, char *nolink, DimInfoHandler *handler)
|
---|
87 | { subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };
|
---|
88 | DimInfo(const char *name, int time, char *nolink, DimInfoHandler *handler)
|
---|
89 | { subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };
|
---|
90 | DimInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler)
|
---|
91 | { subscribe((char *)name, 0, nolink, nolinksize, handler); };
|
---|
92 | DimInfo(const char *name, int time, void *nolink, int nolinksize, DimInfoHandler *handler)
|
---|
93 | { subscribe((char *)name, time, nolink, nolinksize, handler); };
|
---|
94 |
|
---|
95 | virtual ~DimInfo();
|
---|
96 | void *itsData;
|
---|
97 | int itsDataSize;
|
---|
98 | int itsSize;
|
---|
99 | int getSize() {return itsSize; };
|
---|
100 | char *getName() { return itsName; } ;
|
---|
101 | void *getData();
|
---|
102 | int getInt() { return *(int *)getData(); } ;
|
---|
103 | float getFloat() { return *(float *)getData(); } ;
|
---|
104 | double getDouble() { return *(double *)getData(); } ;
|
---|
105 | longlong getLonglong() { return *(longlong *)getData(); } ;
|
---|
106 | short getShort() { return *(short *)getData(); } ;
|
---|
107 | char *getString() { return (char *)getData(); } ;
|
---|
108 |
|
---|
109 | virtual void infoHandler();
|
---|
110 | void timerHandler();
|
---|
111 | virtual void subscribe(char *name, int time, void *nolink, int nolinksize,
|
---|
112 | DimInfoHandler *handler);
|
---|
113 | virtual void doIt();
|
---|
114 | int getQuality();
|
---|
115 | int getTimestamp();
|
---|
116 | int getTimestampMillisecs();
|
---|
117 | char *getFormat();
|
---|
118 |
|
---|
119 | protected :
|
---|
120 | char *itsName;
|
---|
121 | int itsId;
|
---|
122 | int itsTime;
|
---|
123 | int itsType;
|
---|
124 | int itsTagId;
|
---|
125 | char *itsFormat;
|
---|
126 | void *itsNolinkBuf;
|
---|
127 | int itsNolinkSize;
|
---|
128 | int secs, millisecs;
|
---|
129 | };
|
---|
130 |
|
---|
131 | class DllExp DimStampedInfo : public DimInfo{
|
---|
132 |
|
---|
133 | public :
|
---|
134 | DimStampedInfo(){};
|
---|
135 | DimStampedInfo(const char *name, int nolink)
|
---|
136 | { subscribe((char *)name, 0, &nolink, sizeof(int), 0); };
|
---|
137 | DimStampedInfo(const char *name, int time, int nolink)
|
---|
138 | { subscribe((char *)name, time, &nolink, sizeof(int), 0); };
|
---|
139 | DimStampedInfo(const char *name, float nolink)
|
---|
140 | { subscribe((char *)name, 0, &nolink, sizeof(float), 0); };
|
---|
141 | DimStampedInfo(const char *name, int time, float nolink)
|
---|
142 | { subscribe((char *)name, time, &nolink, sizeof(float), 0); };
|
---|
143 | DimStampedInfo(const char *name, double nolink)
|
---|
144 | { subscribe((char *)name, 0, &nolink, sizeof(double), 0); };
|
---|
145 | DimStampedInfo(const char *name, int time, double nolink)
|
---|
146 | { subscribe((char *)name, time, &nolink, sizeof(double), 0); };
|
---|
147 | DimStampedInfo(const char *name, longlong nolink)
|
---|
148 | { subscribe((char *)name, 0, &nolink, sizeof(longlong), 0); };
|
---|
149 | DimStampedInfo(const char *name, int time, longlong nolink)
|
---|
150 | { subscribe((char *)name, time, &nolink, sizeof(longlong), 0); };
|
---|
151 | DimStampedInfo(const char *name, short nolink)
|
---|
152 | { subscribe((char *)name, 0, &nolink, sizeof(short), 0); };
|
---|
153 | DimStampedInfo(const char *name, int time, short nolink)
|
---|
154 | { subscribe((char *)name, time, &nolink, sizeof(short), 0); };
|
---|
155 | DimStampedInfo(const char *name, char *nolink)
|
---|
156 | { subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };
|
---|
157 | DimStampedInfo(const char *name, int time, char *nolink)
|
---|
158 | { subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };
|
---|
159 | DimStampedInfo(const char *name, void *nolink, int nolinksize)
|
---|
160 | { subscribe((char *)name, 0, nolink, nolinksize, 0); };
|
---|
161 | DimStampedInfo(const char *name, int time, void *nolink, int nolinksize)
|
---|
162 | { subscribe((char *)name, time, nolink, nolinksize, 0); };
|
---|
163 |
|
---|
164 | DimStampedInfo(const char *name, int nolink, DimInfoHandler *handler)
|
---|
165 | { subscribe((char *)name, 0, &nolink, sizeof(int), handler); };
|
---|
166 | DimStampedInfo(const char *name, int time, int nolink, DimInfoHandler *handler)
|
---|
167 | { subscribe((char *)name, time, &nolink, sizeof(int), handler); };
|
---|
168 | DimStampedInfo(const char *name, float nolink, DimInfoHandler *handler)
|
---|
169 | { subscribe((char *)name, 0, &nolink, sizeof(float), handler); };
|
---|
170 | DimStampedInfo(const char *name, int time, float nolink, DimInfoHandler *handler)
|
---|
171 | { subscribe((char *)name, time, &nolink, sizeof(float), handler); };
|
---|
172 | DimStampedInfo(const char *name, double nolink, DimInfoHandler *handler)
|
---|
173 | { subscribe((char *)name, 0, &nolink, sizeof(double), handler); };
|
---|
174 | DimStampedInfo(const char *name, int time, double nolink, DimInfoHandler *handler)
|
---|
175 | { subscribe((char *)name, time, &nolink, sizeof(double), handler); };
|
---|
176 | DimStampedInfo(const char *name, longlong nolink, DimInfoHandler *handler)
|
---|
177 | { subscribe((char *)name, 0, &nolink, sizeof(longlong), handler); };
|
---|
178 | DimStampedInfo(const char *name, int time, longlong nolink, DimInfoHandler *handler)
|
---|
179 | { subscribe((char *)name, time, &nolink, sizeof(longlong), handler); };
|
---|
180 | DimStampedInfo(const char *name, short nolink, DimInfoHandler *handler)
|
---|
181 | { subscribe((char *)name, 0, &nolink, sizeof(short), handler); };
|
---|
182 | DimStampedInfo(const char *name, int time, short nolink, DimInfoHandler *handler)
|
---|
183 | { subscribe((char *)name, time, &nolink, sizeof(short), handler); };
|
---|
184 | DimStampedInfo(const char *name, char *nolink, DimInfoHandler *handler)
|
---|
185 | { subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };
|
---|
186 | DimStampedInfo(const char *name, int time, char *nolink, DimInfoHandler *handler)
|
---|
187 | { subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };
|
---|
188 | DimStampedInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler)
|
---|
189 | { subscribe((char *)name, 0, nolink, nolinksize, handler); };
|
---|
190 | DimStampedInfo(const char *name, int time, void *nolink, int nolinksize, DimInfoHandler *handler)
|
---|
191 | { subscribe((char *)name, time, nolink, nolinksize, handler); };
|
---|
192 |
|
---|
193 | virtual ~DimStampedInfo();
|
---|
194 | private :
|
---|
195 | void doIt();
|
---|
196 | void subscribe(char *name, int time, void *nolink, int nolinksize,
|
---|
197 | DimInfoHandler *handler);
|
---|
198 | };
|
---|
199 |
|
---|
200 | class DllExp DimUpdatedInfo : public DimInfo{
|
---|
201 |
|
---|
202 | public :
|
---|
203 | DimUpdatedInfo(){};
|
---|
204 | DimUpdatedInfo(const char *name, int nolink)
|
---|
205 | { subscribe((char *)name, 0, &nolink, sizeof(int), 0); };
|
---|
206 | DimUpdatedInfo(const char *name, int time, int nolink)
|
---|
207 | { subscribe((char *)name, time, &nolink, sizeof(int), 0); };
|
---|
208 | DimUpdatedInfo(const char *name, float nolink)
|
---|
209 | { subscribe((char *)name, 0, &nolink, sizeof(float), 0); };
|
---|
210 | DimUpdatedInfo(const char *name, int time, float nolink)
|
---|
211 | { subscribe((char *)name, time, &nolink, sizeof(float), 0); };
|
---|
212 | DimUpdatedInfo(const char *name, double nolink)
|
---|
213 | { subscribe((char *)name, 0, &nolink, sizeof(double), 0); };
|
---|
214 | DimUpdatedInfo(const char *name, int time, double nolink)
|
---|
215 | { subscribe((char *)name, time, &nolink, sizeof(double), 0); };
|
---|
216 | DimUpdatedInfo(const char *name, longlong nolink)
|
---|
217 | { subscribe((char *)name, 0, &nolink, sizeof(longlong), 0); };
|
---|
218 | DimUpdatedInfo(const char *name, int time, longlong nolink)
|
---|
219 | { subscribe((char *)name, time, &nolink, sizeof(longlong), 0); };
|
---|
220 | DimUpdatedInfo(const char *name, short nolink)
|
---|
221 | { subscribe((char *)name, 0, &nolink, sizeof(short), 0); };
|
---|
222 | DimUpdatedInfo(const char *name, int time, short nolink)
|
---|
223 | { subscribe((char *)name, time, &nolink, sizeof(short), 0); };
|
---|
224 | DimUpdatedInfo(const char *name, char *nolink)
|
---|
225 | { subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };
|
---|
226 | DimUpdatedInfo(const char *name, int time, char *nolink)
|
---|
227 | { subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };
|
---|
228 | DimUpdatedInfo(const char *name, void *nolink, int nolinksize)
|
---|
229 | { subscribe((char *)name, 0, nolink, nolinksize, 0); };
|
---|
230 | DimUpdatedInfo(const char *name, int time, void *nolink, int nolinksize)
|
---|
231 | { subscribe((char *)name, time, nolink, nolinksize, 0); };
|
---|
232 |
|
---|
233 | DimUpdatedInfo(const char *name, int nolink, DimInfoHandler *handler)
|
---|
234 | { subscribe((char *)name, 0, &nolink, sizeof(int), handler); };
|
---|
235 | DimUpdatedInfo(const char *name, int time, int nolink, DimInfoHandler *handler)
|
---|
236 | { subscribe((char *)name, time, &nolink, sizeof(int), handler); };
|
---|
237 | DimUpdatedInfo(const char *name, float nolink, DimInfoHandler *handler)
|
---|
238 | { subscribe((char *)name, 0, &nolink, sizeof(float), handler); };
|
---|
239 | DimUpdatedInfo(const char *name, int time, float nolink, DimInfoHandler *handler)
|
---|
240 | { subscribe((char *)name, time, &nolink, sizeof(float), handler); };
|
---|
241 | DimUpdatedInfo(const char *name, double nolink, DimInfoHandler *handler)
|
---|
242 | { subscribe((char *)name, 0, &nolink, sizeof(double), handler); };
|
---|
243 | DimUpdatedInfo(const char *name, int time, double nolink, DimInfoHandler *handler)
|
---|
244 | { subscribe((char *)name, time, &nolink, sizeof(double), handler); };
|
---|
245 | DimUpdatedInfo(const char *name, longlong nolink, DimInfoHandler *handler)
|
---|
246 | { subscribe((char *)name, 0, &nolink, sizeof(longlong), handler); };
|
---|
247 | DimUpdatedInfo(const char *name, int time, longlong nolink, DimInfoHandler *handler)
|
---|
248 | { subscribe((char *)name, time, &nolink, sizeof(longlong), handler); };
|
---|
249 | DimUpdatedInfo(const char *name, short nolink, DimInfoHandler *handler)
|
---|
250 | { subscribe((char *)name, 0, &nolink, sizeof(short), handler); };
|
---|
251 | DimUpdatedInfo(const char *name, int time, short nolink, DimInfoHandler *handler)
|
---|
252 | { subscribe((char *)name, time, &nolink, sizeof(short), handler); };
|
---|
253 | DimUpdatedInfo(const char *name, char *nolink, DimInfoHandler *handler)
|
---|
254 | { subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };
|
---|
255 | DimUpdatedInfo(const char *name, int time, char *nolink, DimInfoHandler *handler)
|
---|
256 | { subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };
|
---|
257 | DimUpdatedInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler)
|
---|
258 | { subscribe((char *)name, 0, nolink, nolinksize, handler); };
|
---|
259 | DimUpdatedInfo(const char *name, int time, void *nolink, int nolinksize, DimInfoHandler *handler)
|
---|
260 | { subscribe((char *)name, time, nolink, nolinksize, handler); };
|
---|
261 |
|
---|
262 | virtual ~DimUpdatedInfo();
|
---|
263 | private :
|
---|
264 | void doIt();
|
---|
265 | void subscribe(char *name, int time, void *nolink, int nolinksize,
|
---|
266 | DimInfoHandler *handler);
|
---|
267 | };
|
---|
268 |
|
---|
269 | class DllExp DimCmnd {
|
---|
270 | public :
|
---|
271 |
|
---|
272 | int wakeUp;
|
---|
273 | int result;
|
---|
274 | int send(char *name, void *data, int datasize);
|
---|
275 | void sendNB(char *name, void *data, int datasize);
|
---|
276 | DimCmnd(){};
|
---|
277 | };
|
---|
278 |
|
---|
279 | class DllExp DimCurrentInfo {
|
---|
280 |
|
---|
281 | public :
|
---|
282 | void *itsData;
|
---|
283 | int itsDataSize;
|
---|
284 | int itsSize;
|
---|
285 | int itsTagId;
|
---|
286 | int wakeUp;
|
---|
287 |
|
---|
288 | DimCurrentInfo(const char *name, int nolink) {
|
---|
289 | subscribe((char *)name, 0, &nolink, sizeof(int)); };
|
---|
290 | DimCurrentInfo(const char *name, float nolink) {
|
---|
291 | subscribe((char *)name, 0, &nolink, sizeof(float)); };
|
---|
292 | DimCurrentInfo(const char *name, double nolink) {
|
---|
293 | subscribe((char *)name, 0, &nolink, sizeof(double)); };
|
---|
294 | DimCurrentInfo(const char *name, longlong nolink) {
|
---|
295 | subscribe((char *)name, 0, &nolink, sizeof(longlong)); };
|
---|
296 | DimCurrentInfo(const char *name, short nolink) {
|
---|
297 | subscribe((char *)name, 0, &nolink, sizeof(short)); };
|
---|
298 | DimCurrentInfo(const char *name, char *nolink) {
|
---|
299 | subscribe((char *)name, 0, nolink, strlen(nolink)+1); };
|
---|
300 | DimCurrentInfo(const char *name, void *nolink, int nolinksize) {
|
---|
301 | subscribe((char *)name, 0, nolink, nolinksize); };
|
---|
302 | DimCurrentInfo(const char *name, int time, int nolink) {
|
---|
303 | subscribe((char *)name, time, &nolink, sizeof(int)); };
|
---|
304 | DimCurrentInfo(const char *name, int time, float nolink) {
|
---|
305 | subscribe((char *)name, time, &nolink, sizeof(float)); };
|
---|
306 | DimCurrentInfo(const char *name, int time, double nolink) {
|
---|
307 | subscribe((char *)name, time, &nolink, sizeof(double)); };
|
---|
308 | DimCurrentInfo(const char *name, int time, longlong nolink) {
|
---|
309 | subscribe((char *)name, time, &nolink, sizeof(longlong)); };
|
---|
310 | DimCurrentInfo(const char *name, int time, short nolink) {
|
---|
311 | subscribe((char *)name, time, &nolink, sizeof(short)); };
|
---|
312 | DimCurrentInfo(const char *name, int time, char *nolink) {
|
---|
313 | subscribe((char *)name, time, nolink, strlen(nolink)+1); };
|
---|
314 | DimCurrentInfo(const char *name, int time, void *nolink, int nolinksize) {
|
---|
315 | subscribe((char *)name, time, nolink, nolinksize); };
|
---|
316 |
|
---|
317 |
|
---|
318 | virtual ~DimCurrentInfo();
|
---|
319 | char *getName() { return itsName; } ;
|
---|
320 | void *getData();
|
---|
321 | int getInt() { return *(int *)getData(); } ;
|
---|
322 | float getFloat() { return *(float *)getData(); } ;
|
---|
323 | double getDouble() { return *(double *)getData(); } ;
|
---|
324 | longlong getLonglong() { return *(longlong *)getData(); } ;
|
---|
325 | short getShort() { return *(short *)getData(); } ;
|
---|
326 | char *getString() { return (char *)getData(); } ;
|
---|
327 | int getSize() { getData(); return itsSize; } ;
|
---|
328 |
|
---|
329 | private :
|
---|
330 | char *itsName;
|
---|
331 | void *itsNolinkBuf;
|
---|
332 | int itsNolinkSize;
|
---|
333 | void subscribe(char *name, int time, void *nolink, int nolinksize);
|
---|
334 | };
|
---|
335 |
|
---|
336 | class DllExp DimRpcInfo : public DimTimer {
|
---|
337 | public :
|
---|
338 | int itsId;
|
---|
339 | int itsTagId;
|
---|
340 | int itsInit;
|
---|
341 | void *itsData;
|
---|
342 | int itsDataSize;
|
---|
343 | void *itsDataOut;
|
---|
344 | int itsDataOutSize;
|
---|
345 | int itsSize;
|
---|
346 | int wakeUp;
|
---|
347 | int itsWaiting;
|
---|
348 | int itsConnected;
|
---|
349 | void *itsNolinkBuf;
|
---|
350 | int itsNolinkSize;
|
---|
351 | DimRpcInfo *itsHandler;
|
---|
352 |
|
---|
353 | DimRpcInfo(const char *name, int nolink) {
|
---|
354 | subscribe((char *)name, 0, 0, &nolink, sizeof(int), 0); };
|
---|
355 | DimRpcInfo(const char *name, float nolink) {
|
---|
356 | subscribe((char *)name, 0, 0, &nolink, sizeof(float), 0); };
|
---|
357 | DimRpcInfo(const char *name, double nolink) {
|
---|
358 | subscribe((char *)name, 0, 0, &nolink, sizeof(double), 0); };
|
---|
359 | DimRpcInfo(const char *name, longlong nolink) {
|
---|
360 | subscribe((char *)name, 0, 0, &nolink, sizeof(longlong), 0); };
|
---|
361 | DimRpcInfo(const char *name, short nolink) {
|
---|
362 | subscribe((char *)name, 0, 0, &nolink, sizeof(short), 0); };
|
---|
363 | DimRpcInfo(const char *name, char *nolink) {
|
---|
364 | subscribe((char *)name, 0, 0, nolink, strlen(nolink)+1, 0); };
|
---|
365 | DimRpcInfo(const char *name, void *nolink, int nolinksize) {
|
---|
366 | subscribe((char *)name, 0, 0, nolink, nolinksize, 0); };
|
---|
367 |
|
---|
368 | DimRpcInfo(const char *name, int time, int nolink) {
|
---|
369 | subscribe((char *)name, 0, 0, &nolink, sizeof(int), time); };
|
---|
370 | DimRpcInfo(const char *name, int time, float nolink) {
|
---|
371 | subscribe((char *)name, 0, 0, &nolink, sizeof(float), time); };
|
---|
372 | DimRpcInfo(const char *name, int time, double nolink) {
|
---|
373 | subscribe((char *)name, 0, 0, &nolink, sizeof(double), time); };
|
---|
374 | DimRpcInfo(const char *name, int time, longlong nolink) {
|
---|
375 | subscribe((char *)name, 0, 0, &nolink, sizeof(longlong), time); };
|
---|
376 | DimRpcInfo(const char *name, int time, short nolink) {
|
---|
377 | subscribe((char *)name, 0, 0, &nolink, sizeof(short), time); };
|
---|
378 | DimRpcInfo(const char *name, int time, char *nolink) {
|
---|
379 | subscribe((char *)name, 0, 0, nolink, strlen(nolink)+1, time); };
|
---|
380 | DimRpcInfo(const char *name, int time, void *nolink, int nolinksize) {
|
---|
381 | subscribe((char *)name, 0, 0, nolink, nolinksize, time); };
|
---|
382 |
|
---|
383 | virtual void rpcInfoHandler();
|
---|
384 |
|
---|
385 | virtual ~DimRpcInfo();
|
---|
386 | int getId() {return itsId;};
|
---|
387 | void keepWaiting() {itsWaiting = 2;};
|
---|
388 | char *getName() { return itsName; } ;
|
---|
389 | void *getData();
|
---|
390 | int getInt() { return *(int *)getData(); } ;
|
---|
391 | float getFloat() { return *(float *)getData(); } ;
|
---|
392 | double getDouble() { return *(double *)getData(); } ;
|
---|
393 | longlong getLonglong() { return *(longlong *)getData(); } ;
|
---|
394 | short getShort() { return *(short *)getData(); } ;
|
---|
395 | char *getString() { return (char *)getData(); } ;
|
---|
396 | int getSize() { getData(); return itsSize; } ;
|
---|
397 |
|
---|
398 | void setData(void *data, int size) { doIt(data, size); };
|
---|
399 | void setData(int &data) { doIt(&data, sizeof(int)); } ;
|
---|
400 | void setData(float &data) { doIt(&data, sizeof(float)); } ;
|
---|
401 | void setData(double &data) { doIt(&data, sizeof(double)); } ;
|
---|
402 | void setData(longlong &data) { doIt(&data, sizeof(longlong)); } ;
|
---|
403 | void setData(short &data) { doIt(&data, sizeof(short)); } ;
|
---|
404 | void setData(char *data) { doIt(data, strlen(data)+1); } ;
|
---|
405 |
|
---|
406 | private :
|
---|
407 | char *itsName;
|
---|
408 | char *itsNameIn;
|
---|
409 | char *itsNameOut;
|
---|
410 | int itsTimeout;
|
---|
411 | void subscribe(char *name, void *data, int size,
|
---|
412 | void *nolink, int nolinksize, int timeout);
|
---|
413 | void doIt(void *data, int size);
|
---|
414 | void timerHandler();
|
---|
415 | };
|
---|
416 |
|
---|
417 | class DllExp DimClient : public DimInfoHandler, public DimErrorHandler
|
---|
418 | {
|
---|
419 | public:
|
---|
420 |
|
---|
421 | static char *dimDnsNode;
|
---|
422 | static DimErrorHandler *itsCltError;
|
---|
423 |
|
---|
424 | DimClient();
|
---|
425 | virtual ~DimClient();
|
---|
426 | static int sendCommand(const char *name, int data);
|
---|
427 | static int sendCommand(const char *name, float data);
|
---|
428 | static int sendCommand(const char *name, double data);
|
---|
429 | static int sendCommand(const char *name, longlong data);
|
---|
430 | static int sendCommand(const char *name, short data);
|
---|
431 | static int sendCommand(const char *name, const char *data);
|
---|
432 | static int sendCommand(const char *name, void *data, int datasize);
|
---|
433 | static void sendCommandNB(const char *name, int data);
|
---|
434 | static void sendCommandNB(const char *name, float data);
|
---|
435 | static void sendCommandNB(const char *name, double data);
|
---|
436 | static void sendCommandNB(const char *name, longlong data);
|
---|
437 | static void sendCommandNB(const char *name, short data);
|
---|
438 | static void sendCommandNB(const char *name, char *data);
|
---|
439 | static void sendCommandNB(const char *name, void *data, int datasize);
|
---|
440 | static int setExitHandler(const char *serverName);
|
---|
441 | static int killServer(const char *serverName);
|
---|
442 | static int setDnsNode(const char *node);
|
---|
443 | static int setDnsNode(const char *node, int port);
|
---|
444 | static char *getDnsNode();
|
---|
445 | static int getDnsPort();
|
---|
446 | static void addErrorHandler(DimErrorHandler *handler);
|
---|
447 | void addErrorHandler();
|
---|
448 | virtual void errorHandler(int /* severity */, int /* code */, char* /* msg */) {};
|
---|
449 | static char *serverName;
|
---|
450 | // Get Current Server Identifier
|
---|
451 | static int getServerId();
|
---|
452 | // Get Current Server Process Identifier
|
---|
453 | static int getServerPid();
|
---|
454 | // Get Current Server Name
|
---|
455 | static char *getServerName();
|
---|
456 | static char **getServerServices();
|
---|
457 | // static char *getServerServices(int serverId);
|
---|
458 |
|
---|
459 | virtual void infoHandler() {};
|
---|
460 |
|
---|
461 | static int dicNoCopy;
|
---|
462 | static void setNoDataCopy();
|
---|
463 | static int getNoDataCopy();
|
---|
464 | };
|
---|
465 |
|
---|
466 | class DllExp DimBrowser
|
---|
467 | {
|
---|
468 | public :
|
---|
469 |
|
---|
470 | DimBrowser();
|
---|
471 |
|
---|
472 | ~DimBrowser();
|
---|
473 |
|
---|
474 | int getServices(const char *serviceName);
|
---|
475 | int getServers();
|
---|
476 | int getServerServices(const char *serverName);
|
---|
477 | int getServerClients(const char *serverName);
|
---|
478 | int getServices(const char *serviceName, int timeout);
|
---|
479 | int getServers(int timeout);
|
---|
480 | int getServerServices(const char *serverName, int timeout);
|
---|
481 | int getServerClients(const char *serverName, int timeout);
|
---|
482 | int getNextService(char *&service, char *&format);
|
---|
483 | int getNextServer(char *&server, char *&node);
|
---|
484 | int getNextServer(char *&server, char *&node, int &pid);
|
---|
485 | int getNextServerService(char *&service, char *&format);
|
---|
486 | int getNextServerClient(char *&client, char *&node);
|
---|
487 |
|
---|
488 | private:
|
---|
489 |
|
---|
490 | TokenString *itsData[5];
|
---|
491 | int currIndex;
|
---|
492 | char *currToken;
|
---|
493 | char none;
|
---|
494 | DimRpcInfo *browserRpc;
|
---|
495 | };
|
---|
496 |
|
---|
497 | #endif
|
---|