summaryrefslogtreecommitdiff
path: root/storage/connect/value.h
blob: 0980349820dc0af0960d87f834e80eb2ed669e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
/**************** Value H Declares Source Code File (.H) ***************/
/*  Name: VALUE.H    Version 1.6                                       */
/*                                                                     */
/*  (C) Copyright to the author Olivier BERTRAND          2001-2012    */
/*                                                                     */
/*  This file contains the VALUE and derived classes declares.         */
/***********************************************************************/

/***********************************************************************/
/*  Include required application header files                          */
/*  assert.h     is header required when using the assert function.    */
/*  block.h      is header containing Block    global declarations.    */
/***********************************************************************/
#ifndef __VALUE__H__
#define __VALUE__H__
#include "assert.h"
#include "block.h"

/***********************************************************************/
/*  Types used in some class definitions.                              */
/***********************************************************************/
enum CONV {CNV_ANY     =   0,         /* Convert to any type           */
           CNV_CHAR    =   1,         /* Convert to character type     */
           CNV_NUM     =   2};        /* Convert to numeric type       */

/***********************************************************************/
/*  Types used in some class definitions.                              */
/***********************************************************************/
class CONSTANT;                       // For friend setting
typedef struct _datpar *PDTP;         // For DTVAL


/***********************************************************************/
/*  Utilities used to test types and to allocated values.              */
/***********************************************************************/
int   GetPLGType(int);
short GetSQLType(int);
int   GetSQLCType(int);
PVAL  AllocateValue(PGLOBAL, void *, short);

// Exported functions
DllExport PSZ   GetTypeName(int);
DllExport int   GetTypeSize(int, int);
DllExport int   TranslateSQLType(int stp, int prec, int& len);
DllExport char *GetFormatType(int);
DllExport int   GetFormatType(char);
DllExport int   GetDBType(int);
DllExport bool  IsTypeChar(int type);
DllExport bool  IsTypeNum(int type);
DllExport int   ConvertType(int, int, CONV, bool match = false);
DllExport PVAL  AllocateValue(PGLOBAL, PVAL, int = TYPE_VOID);
DllExport PVAL  AllocateValue(PGLOBAL, int, int len = 0, int prec = 2,
                              PSZ dom = NULL, PCATLG cat = NULL);

/***********************************************************************/
/*  Class VALUE represents a constant or variable of any valid type.   */
/***********************************************************************/
class DllExport VALUE : public BLOCK {
  friend class CONSTANT; // The only object allowed to use SetConstFormat
 public:
  // Constructors

  // Implementation
  virtual bool   IsTypeNum(void) = 0;
  virtual bool   IsZero(void) = 0;
  virtual bool   IsCi(void) {return false;}
  virtual void   Reset(void) = 0;
  virtual int    GetSize(void) = 0;
  virtual int    GetValLen(void) = 0;
  virtual int    GetValPrec(void) = 0;
  virtual int    GetLength(void) {return 1;}
  virtual PSZ    GetCharValue(void) {assert(false); return NULL;}
  virtual short  GetShortValue(void) {assert(false); return 0;}
  virtual int    GetIntValue(void) = 0;
  virtual double GetFloatValue(void) = 0;
  virtual void  *GetTo_Val(void) = 0;
          int    GetType(void) {return Type;}
          int    GetClen(void) {return Clen;}
          void   SetGlobal(PGLOBAL g) {Global = g;}

  // Methods
  virtual bool   SetValue_pval(PVAL valp, bool chktype = false) = 0;
  virtual void   SetValue_char(char *p, int n) = 0;
  virtual void   SetValue_psz(PSZ s) = 0;
  virtual void   SetValue_bool(bool b) {assert(false);}
  virtual void   SetValue(short i) {assert(false);}
  virtual void   SetValue(int n) {assert(false);}
  virtual void   SetValue(double f) {assert(false);}
  virtual void   SetValue_pvblk(PVBLK blk, int n) = 0;
  virtual void   SetBinValue(void *p) = 0;
  virtual bool   GetBinValue(void *buf, int buflen, bool go) = 0;
  virtual void   GetBinValue(void *buf, int len) = 0;
  virtual bool   IsEqual(PVAL vp, bool chktype) = 0;
  virtual int    CompareValue(PVAL vp) = 0;
  virtual BYTE   TestValue(PVAL vp);
  virtual void   Divide(int cnt) {assert(false);}
  virtual void   StdVar(PVAL vp, int cnt, bool b) {assert(false);}
  virtual void   Add(int lv) {assert(false);}
  virtual void   Add(PVAL vp) {assert(false);}
  virtual void   Add(PVBLK vbp, int i) {assert(false);}
  virtual void   Add(PVBLK vbp, int j, int k) {assert(false);}
  virtual void   Add(PVBLK vbp, int *x, int j, int k) {assert(false);}
  virtual void   AddSquare(PVAL vp) {assert(false);}
  virtual void   AddSquare(PVBLK vbp, int i) {assert(false);}
  virtual void   AddSquare(PVBLK vbp, int j, int k) {assert(false);}
  virtual void   Times(PVAL vp) {assert(false);}
  virtual void   SetMin(PVAL vp) = 0;
  virtual void   SetMin(PVBLK vbp, int i) = 0;
  virtual void   SetMin(PVBLK vbp, int j, int k) = 0;
  virtual void   SetMin(PVBLK vbp, int *x, int j, int k) = 0;
  virtual void   SetMax(PVAL vp) = 0;
  virtual void   SetMax(PVBLK vbp, int i) = 0;
  virtual void   SetMax(PVBLK vbp, int j, int k) = 0;
  virtual void   SetMax(PVBLK vbp, int *x, int j, int k) = 0;
  virtual char  *ShowValue(char *buf, int len = 0) = 0;
  virtual char  *GetCharString(char *p) = 0;
  virtual char  *GetShortString(char *p, int n) {return "#####";}
  virtual char  *GetIntString(char *p, int n) = 0;
  virtual char  *GetFloatString(char *p, int n, int prec) = 0;
  virtual bool   Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) = 0;
  virtual int    GetTime(PGLOBAL g, PVAL *vp, int np) = 0;
  virtual bool   FormatValue(PVAL vp, char *fmt) = 0;
          char  *ShowTypedValue(PGLOBAL g, char *buf, int typ, int n, int p);
 protected:
  virtual bool   SetConstFormat(PGLOBAL, FORMAT&) = 0;

  // Constructor used by derived classes
  VALUE(int type) : Type(type) {}

  // Members
  PGLOBAL Global;                   // To reduce arglist
//const int   Type;                 // The value type
  int     Type;                     // The value type
  int     Clen;                     // Internal value length
  }; // end of class VALUE

/***********************************************************************/
/*  Class STRING: represents zero terminated strings.                  */
/***********************************************************************/
class STRING : public VALUE {
  friend class SFROW;
 public:
  // Constructors
  STRING(PSZ s);
  STRING(PGLOBAL g, PSZ s, int n, int c = 0);
  STRING(PGLOBAL g, short i);
  STRING(PGLOBAL g, int n);
  STRING(PGLOBAL g, double f);

  // Implementation
  virtual bool   IsTypeNum(void) {return false;}
  virtual bool   IsZero(void) {return (Strp) ? strlen(Strp) == 0 : true;}
  virtual bool   IsCi(void) {return Ci;}
  virtual void   Reset(void) {*Strp = '\0';}
  virtual int    GetValLen(void) {return Len;}
  virtual int    GetValPrec() {return (Ci) ? 1 : 0;}
  virtual int    GetLength(void) {return Len;}
  virtual int    GetSize(void) {return (Strp) ? strlen(Strp) : 0;}
  virtual PSZ    GetCharValue(void) {return Strp;}
  virtual short  GetShortValue(void) {return (short)atoi(Strp);}
  virtual int    GetIntValue(void) {return atol(Strp);}
  virtual double GetFloatValue(void) {return atof(Strp);}
  virtual void  *GetTo_Val(void) {return Strp;}

  // Methods
  virtual bool   SetValue_pval(PVAL valp, bool chktype);
  virtual void   SetValue_char(char *p, int n);
  virtual void   SetValue_psz(PSZ s);
  virtual void   SetValue_pvblk(PVBLK blk, int n);
  virtual void   SetValue(short i);
  virtual void   SetValue(int n);
  virtual void   SetValue(double f);
  virtual void   SetBinValue(void *p);
  virtual bool   GetBinValue(void *buf, int buflen, bool go);
  virtual void   GetBinValue(void *buf, int len);
  virtual char  *ShowValue(char *buf, int);
  virtual char  *GetCharString(char *p);
  virtual char  *GetShortString(char *p, int n);
  virtual char  *GetIntString(char *p, int n);
  virtual char  *GetFloatString(char *p, int n, int prec = -1);
  virtual bool   IsEqual(PVAL vp, bool chktype);
  virtual int    CompareValue(PVAL vp);
  virtual BYTE   TestValue(PVAL vp);
  virtual void   SetMin(PVAL vp);
  virtual void   SetMin(PVBLK vbp, int i);
  virtual void   SetMin(PVBLK vbp, int j, int k);
  virtual void   SetMin(PVBLK vbp, int *x, int j, int k);
  virtual void   SetMax(PVAL vp);
  virtual void   SetMax(PVBLK vbp, int i);
  virtual void   SetMax(PVBLK vbp, int j, int k);
  virtual void   SetMax(PVBLK vbp, int *x, int j, int k);
  virtual bool   SetConstFormat(PGLOBAL, FORMAT&);
  virtual bool   Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
  virtual int    GetTime(PGLOBAL g, PVAL *vp, int np);
  virtual bool   FormatValue(PVAL vp, char *fmt);
  virtual void   Print(PGLOBAL g, FILE *, uint);
  virtual void   Print(PGLOBAL g, char *, uint);

 protected:
  // Default constructor not to be used
  STRING(void) : VALUE(TYPE_ERROR) {}

  // Members
  PSZ     Strp;
  int     Len;
	bool    Ci;												// true if case insensitive
  }; // end of class STRING

/***********************************************************************/
/*  Class SHVAL: represents short integer values.                      */
/***********************************************************************/
class SHVAL : public VALUE {
 public:
  // Constructors
  SHVAL(PSZ s);
  SHVAL(short n);
  SHVAL(int n);
  SHVAL(double f);

  // Implementation
  virtual bool   IsTypeNum(void) {return true;}
  virtual bool   IsZero(void) {return Sval == 0;}
  virtual void   Reset(void) {Sval = 0;}
  virtual int    GetValLen(void);
  virtual int    GetValPrec() {return 0;}
  virtual int    GetSize(void) {return sizeof(short);}
//virtual PSZ    GetCharValue(void) {}
  virtual short  GetShortValue(void) {return Sval;}
  virtual int    GetIntValue(void) {return (int)Sval;}
  virtual double GetFloatValue(void) {return (double)Sval;}
  virtual void  *GetTo_Val(void) {return &Sval;}

  // Methods
  virtual bool   SetValue_pval(PVAL valp, bool chktype);
  virtual void   SetValue_char(char *p, int n);
  virtual void   SetValue_psz(PSZ s);
  virtual void   SetValue_bool(bool b) {Sval = (b) ? 1 : 0;}
  virtual void   SetValue(short i) {Sval = i;}
  virtual void   SetValue(int n) {Sval = (short)n;}
  virtual void   SetValue_pvblk(PVBLK blk, int n);
  virtual void   SetBinValue(void *p);
  virtual bool   GetBinValue(void *buf, int buflen, bool go);
  virtual void   GetBinValue(void *buf, int len);
  virtual char  *ShowValue(char *buf, int);
  virtual char  *GetCharString(char *p);
  virtual char  *GetShortString(char *p, int n);
  virtual char  *GetIntString(char *p, int n);
  virtual char  *GetFloatString(char *p, int n, int prec = -1);
  virtual bool   IsEqual(PVAL vp, bool chktype);
  virtual int    CompareValue(PVAL vp);
  virtual void   Divide(int cnt);
  virtual void   StdVar(PVAL vp, int cnt, bool b);
  virtual void   Add(int lv) {Sval += (short)lv;}
  virtual void   Add(PVAL vp);
  virtual void   Add(PVBLK vbp, int i);
  virtual void   Add(PVBLK vbp, int j, int k);
  virtual void   Add(PVBLK vbp, int *x, int j, int k);
  virtual void   AddSquare(PVAL vp);
  virtual void   AddSquare(PVBLK vbp, int i);
  virtual void   AddSquare(PVBLK vbp, int j, int k);
  virtual void   Times(PVAL vp);
  virtual void   SetMin(PVAL vp);
  virtual void   SetMin(PVBLK vbp, int i);
  virtual void   SetMin(PVBLK vbp, int j, int k);
  virtual void   SetMin(PVBLK vbp, int *x, int j, int k);
  virtual void   SetMax(PVAL vp);
  virtual void   SetMax(PVBLK vbp, int i);
  virtual void   SetMax(PVBLK vbp, int j, int k);
  virtual void   SetMax(PVBLK vbp, int *x, int j, int k);
  virtual bool   SetConstFormat(PGLOBAL, FORMAT&);
  virtual bool   Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
  virtual int    GetTime(PGLOBAL g, PVAL *vp, int np) {return 0;}
  virtual bool   FormatValue(PVAL vp, char *fmt);
  virtual void   Print(PGLOBAL g, FILE *, uint);
  virtual void   Print(PGLOBAL g, char *, uint);

 protected:
          short  SafeAdd(short n1, short n2);
          short  SafeMult(short n1, short n2);
  // Default constructor not to be used
  SHVAL(void) : VALUE(TYPE_ERROR) {}

  // Members
  short   Sval;
  }; // end of class SHVAL

/***********************************************************************/
/*  Class INTVAL: represents int integer values.                       */
/***********************************************************************/
class DllExport INTVAL : public VALUE {
 public:
  // Constructors
  INTVAL(PSZ s);
  INTVAL(short i);
  INTVAL(int n);
  INTVAL(double f);

  // Implementation
  virtual bool   IsTypeNum(void) {return true;}
  virtual bool   IsZero(void) {return Ival == 0;}
  virtual void   Reset(void) {Ival = 0;}
  virtual int    GetValLen(void);
  virtual int    GetValPrec() {return 0;}
  virtual int    GetSize(void) {return sizeof(int);}
//virtual PSZ    GetCharValue(void) {}
  virtual short  GetShortValue(void) {return (short)Ival;}
  virtual int    GetIntValue(void) {return Ival;}
  virtual double GetFloatValue(void) {return (double)Ival;}
  virtual void  *GetTo_Val(void) {return &Ival;}

  // Methods
  virtual bool   SetValue_pval(PVAL valp, bool chktype);
  virtual void   SetValue_char(char *p, int n);
  virtual void   SetValue_psz(PSZ s);
  virtual void   SetValue_bool(bool b) {Ival = (b) ? 1 : 0;}
  virtual void   SetValue(short i) {Ival = (int)i;}
  virtual void   SetValue(int n) {Ival = n;}
  virtual void   SetValue(double f) {Ival = (int)f;}
  virtual void   SetValue_pvblk(PVBLK blk, int n);
  virtual void   SetBinValue(void *p);
  virtual bool   GetBinValue(void *buf, int buflen, bool go);
  virtual void   GetBinValue(void *buf, int len);
  virtual char  *ShowValue(char *buf, int);
  virtual char  *GetCharString(char *p);
  virtual char  *GetShortString(char *p, int n);
  virtual char  *GetIntString(char *p, int n);
  virtual char  *GetFloatString(char *p, int n, int prec = -1);
  virtual bool   IsEqual(PVAL vp, bool chktype);
  virtual int    CompareValue(PVAL vp);
  virtual void   Divide(int cnt);
  virtual void   StdVar(PVAL vp, int cnt, bool b);
  virtual void   Add(int lv) {Ival += lv;}
  virtual void   Add(PVAL vp);
  virtual void   Add(PVBLK vbp, int i);
  virtual void   Add(PVBLK vbp, int j, int k);
  virtual void   Add(PVBLK vbp, int *x, int j, int k);
  virtual void   AddSquare(PVAL vp);
  virtual void   AddSquare(PVBLK vbp, int i);
  virtual void   AddSquare(PVBLK vbp, int j, int k);
  virtual void   Times(PVAL vp);
  virtual void   SetMin(PVAL vp);
  virtual void   SetMin(PVBLK vbp, int i);
  virtual void   SetMin(PVBLK vbp, int j, int k);
  virtual void   SetMin(PVBLK vbp, int *x, int j, int k);
  virtual void   SetMax(PVAL vp);
  virtual void   SetMax(PVBLK vbp, int i);
  virtual void   SetMax(PVBLK vbp, int j, int k);
  virtual void   SetMax(PVBLK vbp, int *x, int j, int k);
  virtual bool   SetConstFormat(PGLOBAL, FORMAT&);
  virtual bool   Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
  virtual int    GetTime(PGLOBAL g, PVAL *vp, int np);
  virtual bool   FormatValue(PVAL vp, char *fmt);
  virtual void   Print(PGLOBAL g, FILE *, uint);
  virtual void   Print(PGLOBAL g, char *, uint);

 protected:
          int   SafeAdd(int n1, int n2);
          int   SafeMult(int n1, int n2);
  // Default constructor not to be used
  INTVAL(void) : VALUE(TYPE_ERROR) {}

  // Members
  int    Ival;
  }; // end of class INTVAL

/***********************************************************************/
/*  Class DTVAL: represents a time stamp value.                        */
/***********************************************************************/
class DllExport DTVAL : public INTVAL {
 public:
  // Constructors
  DTVAL(PGLOBAL g, int n, int p, PSZ fmt);
  DTVAL(PGLOBAL g, PSZ s, int n);
  DTVAL(PGLOBAL g, short i);
  DTVAL(PGLOBAL g, int n);
  DTVAL(PGLOBAL g, double f);

  // Implementation
  virtual bool   SetValue_pval(PVAL valp, bool chktype);
  virtual void   SetValue_char(char *p, int n);
  virtual void   SetValue_psz(PSZ s);
  virtual void   SetValue_pvblk(PVBLK blk, int n);
  virtual char  *GetCharString(char *p);
  virtual char  *ShowValue(char *buf, int);
  virtual bool   Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
  virtual int    GetTime(PGLOBAL g, PVAL *vp, int np);
  virtual bool   FormatValue(PVAL vp, char *fmt);
          bool   SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
          bool   SetFormat(PGLOBAL g, PVAL valp);
          bool   IsFormatted(void) {return Pdtp != NULL;}
          bool   GetTmMember(OPVAL op, int& mval);
          bool   DateDiff(DTVAL *dtp, OPVAL op, int& tdif);
          bool   MakeTime(struct tm *ptm);
  static  void   SetTimeShift(void);
  static  int    GetShift(void) {return Shift;}

  // Methods
          bool   MakeDate(PGLOBAL g, int *val, int nval);
          bool   WeekNum(PGLOBAL g, int& nval);

  struct  tm    *GetGmTime(void);

 protected:
  // Default constructor not to be used
  DTVAL(void) : INTVAL() {}

  // Members
  static int    Shift;        // Time zone shift in seconds
  PDTP          Pdtp;         // To the DATPAR structure
  char         *Sdate;        // Utility char buffer
//struct tm    *DateTime;     // Utility (not used yet)
  int           DefYear;      // Used by ExtractDate
  int           Len;          // Used by CHAR scalar function
  }; // end of class DTVAL

/***********************************************************************/
/*  Class DFVAL: represents double float values.                       */
/***********************************************************************/
class DFVAL : public VALUE {
 public:
  // Constructors
  DFVAL(PSZ s, int prec = 2);
  DFVAL(short i, int prec = 2);
  DFVAL(int n, int prec = 2);
  DFVAL(double f, int prec = 2);

  // Implementation
  virtual bool   IsTypeNum(void) {return true;}
  virtual bool   IsZero(void) {return Fval == 0.0;}
  virtual void   Reset(void) {Fval = 0.0;}
  virtual int    GetValLen(void);
  virtual int    GetValPrec() {return Prec;}
  virtual int    GetSize(void) {return sizeof(double);}
//virtual PSZ    GetCharValue(void) {}
  virtual short  GetShortValue(void) {return (short)Fval;}
  virtual int    GetIntValue(void) {return (int)Fval;}
  virtual double GetFloatValue(void) {return Fval;}
  virtual void  *GetTo_Val(void) {return &Fval;}
          void   SetPrec(int prec) {Prec = prec;}

  // Methods
  virtual bool   SetValue_pval(PVAL valp, bool chktype);
  virtual void   SetValue_char(char *p, int n);
  virtual void   SetValue_psz(PSZ s);
  virtual void   SetValue(short i) {Fval = (double)i;}
  virtual void   SetValue(int n) {Fval = (double)n;}
  virtual void   SetValue(double f) {Fval = f;}
  virtual void   SetValue_pvblk(PVBLK blk, int n);
  virtual void   SetBinValue(void *p);
  virtual bool   GetBinValue(void *buf, int buflen, bool go);
  virtual void   GetBinValue(void *buf, int len);
  virtual char  *ShowValue(char *buf, int);
  virtual char  *GetCharString(char *p);
  virtual char  *GetShortString(char *p, int n);
  virtual char  *GetIntString(char *p, int n);
  virtual char  *GetFloatString(char *p, int n, int prec = -1);
  virtual bool   IsEqual(PVAL vp, bool chktype);
  virtual int    CompareValue(PVAL vp);
  virtual void   Divide(int cnt);
  virtual void   StdVar(PVAL vp, int cnt, bool b);
  virtual void   Add(PVAL vp);
  virtual void   Add(PVBLK vbp, int i);
  virtual void   Add(PVBLK vbp, int j, int k);
  virtual void   Add(PVBLK vbp, int *x, int j, int k);
  virtual void   AddSquare(PVAL vp);
  virtual void   AddSquare(PVBLK vbp, int i);
  virtual void   AddSquare(PVBLK vbp, int j, int k);
  virtual void   Times(PVAL vp);
  virtual void   SetMin(PVAL vp);
  virtual void   SetMin(PVBLK vbp, int i);
  virtual void   SetMin(PVBLK vbp, int j, int k);
  virtual void   SetMin(PVBLK vbp, int *x, int j, int k);
  virtual void   SetMax(PVAL vp);
  virtual void   SetMax(PVBLK vbp, int i);
  virtual void   SetMax(PVBLK vbp, int j, int k);
  virtual void   SetMax(PVBLK vbp, int *x, int j, int k);
  virtual bool   SetConstFormat(PGLOBAL, FORMAT&);
  virtual bool   Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
  virtual int    GetTime(PGLOBAL g, PVAL *vp, int np);
  virtual bool   FormatValue(PVAL vp, char *fmt);
  virtual void   Print(PGLOBAL g, FILE *, uint);
  virtual void   Print(PGLOBAL g, char *, uint);

  // Specific function
          void   Divide(double div) {Fval /= div;}

 protected:
  // Default constructor not to be used
  DFVAL(void) : VALUE(TYPE_ERROR) {}

  // Members
  double  Fval;
  int     Prec;
  }; // end of class DFVAL

#endif