Disable all code related to libXp
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / StyleSheet / FeatureValue.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: FeatureValue.h /main/5 1996/08/21 15:50:29 drk $ */
24 #ifndef _FeatureValue_h
25 #define _FeatureValue_h
26
27 //#include "Feature.h"
28
29 #ifndef CDE_NEXT
30
31 #else
32 #include "dti_cc/cc_pvect.h"
33 #endif
34
35 #include <string.h>
36
37 #if 0
38 //  SWM -- COMMENT THIS OUT -- MMDB utility/funcs.h defines this
39 #ifdef _IBMR2
40 extern "C" int strcasecmp(const char*, const char*);
41 #endif
42 #endif
43
44 class FeatureValue;
45 class FeatureSet;
46 class Expression;
47
48 ostream &operator << (ostream &, const FeatureValue &);
49
50 /* **************************************************************
51  * class FeatureValue
52  * ************************************************************** */
53
54 class FeatureValueDimension;
55 class FeatureValueExpression;
56 class FeatureValueFeatureSet;
57 class FeatureValueInt;
58 class FeatureValueReal;
59 class FeatureValueString;
60 class FeatureValueSymbol;
61 class FeatureValueArray;
62
63 class FeatureValue
64 {
65 public:
66   enum FeatureType { real, integer, string, symbol, expression, featureset, dimension, array } ;
67   enum Unit { INCH=0, PICA=1, POINT=2, CM=3, PIXEL=4, NONE=5 };
68
69   FeatureValue  (FeatureType type) : f_type(type) {}
70   virtual ~FeatureValue();
71
72   const FeatureType     type()  const { return f_type ; }
73   
74   virtual FeatureValue *clone() const = 0; /* deep copy */
75
76   virtual FeatureValue *evaluate() const;
77
78   virtual unsigned int operator==(const FeatureValue &) const;
79   virtual unsigned int operator==(const FeatureValueInt &) const;
80   virtual unsigned int operator==(const FeatureValueString &) const;
81   virtual unsigned int operator==(const FeatureValueReal &) const;
82   virtual unsigned int operator==(const FeatureValueSymbol &) const;
83   
84   // produce a new object which is a merge with this object and the parameter
85   virtual FeatureValue *merge(const FeatureValue &);
86
87   // these should return a FeatureValue of the appropriate type
88   // the operations are resolved vi double dispatching
89   // all non-numeric types will use zero for their value unless they 
90   // are the denominator in a division operation, then they will use a 
91   // value of 1
92   virtual FeatureValue *operator+(const FeatureValue&) const ;
93   virtual FeatureValue *operator-(const FeatureValue&) const ;
94   virtual FeatureValue *operator*(const FeatureValue&) const ;
95   virtual FeatureValue *operator/(const FeatureValue&) const ;
96
97   virtual FeatureValue *operator+(const FeatureValueInt&) const ;
98   virtual FeatureValue *operator-(const FeatureValueInt&) const ;
99   virtual FeatureValue *operator*(const FeatureValueInt&) const ;
100   virtual FeatureValue *operator/(const FeatureValueInt&) const ;
101
102   virtual FeatureValue *operator+(const FeatureValueReal&) const ;
103   virtual FeatureValue *operator-(const FeatureValueReal&) const ;
104   virtual FeatureValue *operator*(const FeatureValueReal&) const ;
105   virtual FeatureValue *operator/(const FeatureValueReal&) const ;
106
107   virtual FeatureValue *operator+(const FeatureValueDimension&) const ;
108   virtual FeatureValue *operator-(const FeatureValueDimension&) const ;
109   virtual FeatureValue *operator*(const FeatureValueDimension&) const ;
110   virtual FeatureValue *operator/(const FeatureValueDimension&) const ;
111
112   virtual FeatureValue *operator+(const FeatureValueExpression&) const ;
113   virtual FeatureValue *operator-(const FeatureValueExpression&) const ;
114   virtual FeatureValue *operator*(const FeatureValueExpression&) const ;
115   virtual FeatureValue *operator/(const FeatureValueExpression&) const ;
116
117   virtual FeatureValue *operator+(const int i) const ; /* returns this + i */
118   virtual FeatureValue *operator-(const int i) const ; /* returns this - i */
119   virtual FeatureValue *operator*(const int i) const ; /* returns this * i */
120   virtual FeatureValue *operator/(const int i) const ; /* returns this / i */
121
122   virtual FeatureValue *operator+(const float f) const ; /* returns this + f */
123   virtual FeatureValue *operator-(const float f) const ; /* returns this - f */
124   virtual FeatureValue *operator*(const float f) const ; /* returns this * f */
125   virtual FeatureValue *operator/(const float f) const ; /* returns this / f */
126
127   virtual FeatureValue *rdiv(const FeatureValue &) const ;
128   virtual FeatureValue *rsub(const FeatureValue &) const ;
129
130   virtual FeatureValue *rdiv(const FeatureValueInt &) const ;
131   virtual FeatureValue *rsub(const FeatureValueInt &) const ;
132
133   virtual FeatureValue *rdiv(const FeatureValueReal &) const ;
134   virtual FeatureValue *rsub(const FeatureValueReal &) const ;
135
136   virtual FeatureValue *rdiv(const FeatureValueExpression &) const ;
137   virtual FeatureValue *rsub(const FeatureValueExpression &) const ;
138
139   virtual FeatureValue *rdiv(const FeatureValueDimension &) const ;
140   virtual FeatureValue *rsub(const FeatureValueDimension &) const ;
141
142   virtual FeatureValue *rdiv(const int) const ;
143   virtual FeatureValue *rsub(const int) const ;
144
145   virtual FeatureValue *rdiv(const float) const ;
146   virtual FeatureValue *rsub(const float) const ;
147
148
149   virtual operator float() const;
150   virtual operator int() const;
151   virtual operator const char *() const;
152
153   virtual operator const FeatureSet * () const ;
154
155   virtual ostream &print(ostream&) const = 0;
156
157
158   virtual FeatureValue *doConvert(Unit) const ;
159   virtual FeatureValue *convertTo(Unit) const ;
160   virtual FeatureValue *convertTo(Unit from,
161                                   Unit to) const ;
162
163
164 private:
165   FeatureType   f_type; 
166 };
167
168
169
170 class FeatureValueReal : public FeatureValue
171 {
172 public:
173   FeatureValueReal(float value)
174     : FeatureValue(real), f_value(value)
175     {}
176
177   FeatureValueReal(const FeatureValueReal &);
178
179   virtual FeatureValue *clone() const; /* deep copy */
180
181   // operators 
182   virtual unsigned int operator==(const FeatureValue &) const;
183   virtual unsigned int operator==(const FeatureValueInt &) const;
184   virtual unsigned int operator==(const FeatureValueString &) const;
185   virtual unsigned int operator==(const FeatureValueReal &) const;
186   virtual unsigned int operator==(const FeatureValueSymbol &) const;
187
188   virtual FeatureValue *operator+(const FeatureValueInt&) const ;
189   virtual FeatureValue *operator-(const FeatureValueInt&) const ;
190   virtual FeatureValue *operator*(const FeatureValueInt&) const ;
191   virtual FeatureValue *operator/(const FeatureValueInt&) const ;
192
193   virtual FeatureValue *operator+(const FeatureValueReal&) const ;
194   virtual FeatureValue *operator-(const FeatureValueReal&) const ;
195   virtual FeatureValue *operator*(const FeatureValueReal&) const ;
196   virtual FeatureValue *operator/(const FeatureValueReal&) const ;
197
198   virtual FeatureValue *operator+(const FeatureValueDimension&) const ;
199   virtual FeatureValue *operator-(const FeatureValueDimension&) const ;
200   virtual FeatureValue *operator*(const FeatureValueDimension&) const ;
201   virtual FeatureValue *operator/(const FeatureValueDimension&) const ;
202
203   virtual FeatureValue *operator+(const FeatureValueExpression&) const ;
204   virtual FeatureValue *operator-(const FeatureValueExpression&) const ;
205   virtual FeatureValue *operator*(const FeatureValueExpression&) const ;
206   virtual FeatureValue *operator/(const FeatureValueExpression&) const ;
207
208   virtual FeatureValue *operator+(const FeatureValue&) const ;
209   virtual FeatureValue *operator-(const FeatureValue&) const ;
210   virtual FeatureValue *operator*(const FeatureValue&) const ;
211   virtual FeatureValue *operator/(const FeatureValue&) const ;
212
213   virtual FeatureValue *operator+(const int i) const ; /* returns this + i */
214   virtual FeatureValue *operator-(const int i) const ; /* returns this - i */
215   virtual FeatureValue *operator*(const int i) const ; /* returns this * i */
216   virtual FeatureValue *operator/(const int i) const ; /* returns this / i */
217
218   virtual FeatureValue *operator+(const float f) const ; /* returns this + f */
219   virtual FeatureValue *operator-(const float f) const ; /* returns this - f */
220   virtual FeatureValue *operator*(const float f) const ; /* returns this * f */
221   virtual FeatureValue *operator/(const float f) const ; /* returns this / f */
222
223   virtual FeatureValue *rdiv(const FeatureValue &) const ;
224   virtual FeatureValue *rsub(const FeatureValue &) const ;
225
226   virtual FeatureValue *rdiv(const FeatureValueInt &) const ;
227   virtual FeatureValue *rsub(const FeatureValueInt &) const ;
228
229   virtual FeatureValue *rdiv(const FeatureValueReal &) const ;
230   virtual FeatureValue *rsub(const FeatureValueReal &) const ;
231
232   virtual FeatureValue *rdiv(const FeatureValueExpression &) const ;
233   virtual FeatureValue *rsub(const FeatureValueExpression &) const ;
234
235   virtual FeatureValue *rdiv(const FeatureValueDimension &) const ;
236   virtual FeatureValue *rsub(const FeatureValueDimension &) const ;
237
238   virtual FeatureValue *rdiv(const int) const ;
239   virtual FeatureValue *rsub(const int) const ;
240
241   virtual FeatureValue *rdiv(const float) const ;
242   virtual FeatureValue *rsub(const float) const ;
243   virtual FeatureValue *convertTo(Unit) const ;
244   virtual FeatureValue *convertTo(Unit from,
245                                   Unit to) const ;
246   virtual FeatureValue *doConvert(Unit) const ;
247
248   virtual operator float() const;
249   virtual operator int() const;
250   virtual operator const char *() const;
251
252   virtual ostream& print(ostream&) const;
253
254 private:
255   float         f_value ;
256     
257 };
258
259 class FeatureValueInt : public FeatureValue
260 {
261 public:
262   FeatureValueInt(int value)
263     : FeatureValue(integer), f_value(value)
264     {}
265
266   FeatureValueInt(const FeatureValueInt &);
267
268   virtual FeatureValue *clone() const; /* deep copy */
269
270   // operators 
271
272   virtual unsigned int operator==(const FeatureValue &) const;
273   virtual unsigned int operator==(const FeatureValueInt &) const;
274   virtual unsigned int operator==(const FeatureValueString &) const;
275   virtual unsigned int operator==(const FeatureValueReal &) const;
276   virtual unsigned int operator==(const FeatureValueSymbol &) const;
277
278   virtual FeatureValue *operator+(const FeatureValue&) const ;
279   virtual FeatureValue *operator-(const FeatureValue&) const ;
280   virtual FeatureValue *operator*(const FeatureValue&) const ;
281   virtual FeatureValue *operator/(const FeatureValue&) const ;
282
283   virtual FeatureValue *operator+(const FeatureValueInt&) const ;
284   virtual FeatureValue *operator-(const FeatureValueInt&) const ;
285   virtual FeatureValue *operator*(const FeatureValueInt&) const ;
286   virtual FeatureValue *operator/(const FeatureValueInt&) const ;
287
288   virtual FeatureValue *operator+(const FeatureValueReal&) const ;
289   virtual FeatureValue *operator-(const FeatureValueReal&) const ;
290   virtual FeatureValue *operator*(const FeatureValueReal&) const ;
291   virtual FeatureValue *operator/(const FeatureValueReal&) const ;
292
293   virtual FeatureValue *operator+(const FeatureValueDimension&) const ;
294   virtual FeatureValue *operator-(const FeatureValueDimension&) const ;
295   virtual FeatureValue *operator*(const FeatureValueDimension&) const ;
296   virtual FeatureValue *operator/(const FeatureValueDimension&) const ;
297
298   virtual FeatureValue *operator+(const FeatureValueExpression&) const ;
299   virtual FeatureValue *operator-(const FeatureValueExpression&) const ;
300   virtual FeatureValue *operator*(const FeatureValueExpression&) const ;
301   virtual FeatureValue *operator/(const FeatureValueExpression&) const ;
302
303   virtual FeatureValue *operator+(const int i) const ; /* returns this + i */
304   virtual FeatureValue *operator-(const int i) const ; /* returns this - i */
305   virtual FeatureValue *operator*(const int i) const ; /* returns this * i */
306   virtual FeatureValue *operator/(const int i) const ; /* returns this / i */
307
308   virtual FeatureValue *operator+(const float f) const ; /* returns this + f */
309   virtual FeatureValue *operator-(const float f) const ; /* returns this - f */
310   virtual FeatureValue *operator*(const float f) const ; /* returns this * f */
311   virtual FeatureValue *operator/(const float f) const ; /* returns this / f */
312
313   virtual FeatureValue *rdiv(const FeatureValue &) const ;
314   virtual FeatureValue *rsub(const FeatureValue &) const ;
315
316   virtual FeatureValue *rdiv(const FeatureValueInt &) const ;
317   virtual FeatureValue *rsub(const FeatureValueInt &) const ;
318
319   virtual FeatureValue *rdiv(const FeatureValueReal &) const ;
320   virtual FeatureValue *rsub(const FeatureValueReal &) const ;
321
322   virtual FeatureValue *rdiv(const FeatureValueExpression &) const ;
323   virtual FeatureValue *rsub(const FeatureValueExpression &) const ;
324
325   virtual FeatureValue *rdiv(const FeatureValueDimension &) const ;
326   virtual FeatureValue *rsub(const FeatureValueDimension &) const ;
327
328   virtual FeatureValue *rdiv(const int) const ;
329   virtual FeatureValue *rsub(const int) const ;
330
331   virtual FeatureValue *rdiv(const float) const ;
332   virtual FeatureValue *rsub(const float) const ;
333
334   virtual FeatureValue *convertTo(Unit) const ;
335   virtual FeatureValue *convertTo(Unit from, Unit to) const ;
336   virtual FeatureValue *doConvert(Unit) const ;
337
338   virtual operator float() const;
339   virtual operator int() const;
340   virtual operator const char *() const;
341
342   virtual ostream& print(ostream&) const;
343
344 private:
345   int           f_value ;
346     
347 };
348
349 class FeatureValueString : public FeatureValue
350 {
351 public:
352   FeatureValueString(const char *value)
353     : FeatureValue(string), f_value(value)
354     {}
355
356   FeatureValueString(const FeatureValueString &);
357   ~FeatureValueString();
358
359   virtual FeatureValue *clone() const ; /* deep copy */
360
361   virtual unsigned int operator==(const FeatureValue &) const;
362   virtual unsigned int operator==(const FeatureValueInt &) const;
363   virtual unsigned int operator==(const FeatureValueString &) const;
364   virtual unsigned int operator==(const FeatureValueReal &) const;
365   virtual unsigned int operator==(const FeatureValueSymbol &) const;
366
367 // ops for string concatenation
368 // this -> operator+(const FeatureValueExpression&) evaluates 
369 // the argument and then call this -> operator+(const FeatureValue&).
370   virtual FeatureValue *operator+(const FeatureValue&) const ;
371   virtual FeatureValue *operator+(const FeatureValueExpression&) const ;
372
373 // call FeatureValue::operator+ directly.
374   virtual FeatureValue *operator+(const FeatureValueInt&) const ;
375   virtual FeatureValue *operator+(const FeatureValueReal&) const ;
376   virtual FeatureValue *operator+(const FeatureValueDimension&) const ;
377
378   virtual FeatureValue *operator+(const int i) const ;
379   virtual FeatureValue *operator+(const float f) const ;
380
381   virtual operator float() const;
382   virtual operator int() const;
383   virtual operator const char *() const;
384
385   virtual ostream& print(ostream&) const;
386
387 private:
388
389 #ifndef CDE_NEXT
390   CC_String   f_value ;
391 #else
392   CC_String     f_value ;
393 #endif
394 };
395
396 class FeatureValueSymbol : public FeatureValue
397 {
398 public:
399   FeatureValueSymbol(const Symbol &value)
400     : FeatureValue(symbol), f_value(value)
401     {}
402   FeatureValueSymbol(const FeatureValueSymbol&);
403
404   virtual FeatureValue *clone() const ; /* deep copy */
405
406   virtual unsigned int operator==(const FeatureValue &) const;
407   virtual unsigned int operator==(const FeatureValueInt &) const;
408   virtual unsigned int operator==(const FeatureValueString &) const;
409   virtual unsigned int operator==(const FeatureValueReal &) const;
410   virtual unsigned int operator==(const FeatureValueSymbol &) const;
411
412   virtual operator float() const;
413   virtual operator int() const;
414   virtual operator const char *() const;
415
416   virtual ostream& print(ostream&) const;
417
418 private:
419   Symbol        f_value;
420     
421 };
422
423 class FeatureValueExpression : public FeatureValue
424 {
425 public:
426   FeatureValueExpression(Expression *);
427   FeatureValueExpression(const FeatureValueExpression&);
428   ~FeatureValueExpression();
429
430   virtual FeatureValue *clone() const ; /* deep copy */
431
432   virtual FeatureValue *evaluate() const;
433
434   // operators 
435
436   virtual FeatureValue *operator+(const FeatureValue&) const ;
437   virtual FeatureValue *operator-(const FeatureValue&) const ;
438   virtual FeatureValue *operator*(const FeatureValue&) const ;
439   virtual FeatureValue *operator/(const FeatureValue&) const ;
440
441   virtual FeatureValue *operator+(const FeatureValueInt&) const ;
442   virtual FeatureValue *operator-(const FeatureValueInt&) const ;
443   virtual FeatureValue *operator*(const FeatureValueInt&) const ;
444   virtual FeatureValue *operator/(const FeatureValueInt&) const ;
445
446   virtual FeatureValue *operator+(const FeatureValueReal&) const ;
447   virtual FeatureValue *operator-(const FeatureValueReal&) const ;
448   virtual FeatureValue *operator*(const FeatureValueReal&) const ;
449   virtual FeatureValue *operator/(const FeatureValueReal&) const ;
450
451   virtual FeatureValue *operator+(const FeatureValueDimension&) const ;
452   virtual FeatureValue *operator-(const FeatureValueDimension&) const ;
453   virtual FeatureValue *operator*(const FeatureValueDimension&) const ;
454   virtual FeatureValue *operator/(const FeatureValueDimension&) const ;
455
456   virtual FeatureValue *operator+(const FeatureValueExpression&) const ;
457   virtual FeatureValue *operator-(const FeatureValueExpression&) const ;
458   virtual FeatureValue *operator*(const FeatureValueExpression&) const ;
459   virtual FeatureValue *operator/(const FeatureValueExpression&) const ;
460
461   virtual FeatureValue *operator+(const int i) const ; /* returns this + i */
462   virtual FeatureValue *operator-(const int i) const ; /* returns this - i */
463   virtual FeatureValue *operator*(const int i) const ; /* returns this * i */
464   virtual FeatureValue *operator/(const int i) const ; /* returns this / i */
465
466   virtual FeatureValue *operator+(const float f) const ; /* returns this + f */
467   virtual FeatureValue *operator-(const float f) const ; /* returns this - f */
468   virtual FeatureValue *operator*(const float f) const ; /* returns this * f */
469   virtual FeatureValue *operator/(const float f) const ; /* returns this / f */
470
471   virtual FeatureValue *rdiv(const FeatureValue &) const ;
472   virtual FeatureValue *rsub(const FeatureValue &) const ;
473
474   virtual FeatureValue *rdiv(const FeatureValueInt &) const ;
475   virtual FeatureValue *rsub(const FeatureValueInt &) const ;
476
477   virtual FeatureValue *rdiv(const FeatureValueReal &) const ;
478   virtual FeatureValue *rsub(const FeatureValueReal &) const ;
479
480   virtual FeatureValue *rdiv(const FeatureValueExpression &) const ;
481   virtual FeatureValue *rsub(const FeatureValueExpression &) const ;
482
483   virtual FeatureValue *rdiv(const FeatureValueDimension &) const ;
484   virtual FeatureValue *rsub(const FeatureValueDimension &) const ;
485
486   virtual FeatureValue *rdiv(const int) const ;
487   virtual FeatureValue *rsub(const int) const ;
488
489   virtual FeatureValue *rdiv(const float) const ;
490   virtual FeatureValue *rsub(const float) const ;
491
492   virtual operator float() const;
493   virtual operator int() const;
494   virtual operator const char *() const;
495
496   virtual ostream& print(ostream&) const;
497
498 private:
499   Expression    *f_value;
500 };
501
502 class FeatureValueFeatureSet : public FeatureValue
503 {
504 public:
505   FeatureValueFeatureSet(FeatureSet *);
506   FeatureValueFeatureSet(const FeatureValueFeatureSet&);
507   ~FeatureValueFeatureSet();
508
509   const FeatureSet     *value() const { return f_value ; }
510
511   virtual FeatureValue *evaluate() const; 
512
513   virtual FeatureValue *clone() const; /* deep copy */
514
515   virtual FeatureValue *merge(const FeatureValue &f);
516
517   virtual ostream& print(ostream&) const;
518
519   virtual operator const FeatureSet *() const ;
520
521 private:
522   FeatureSet   *f_value;
523 };
524
525 #ifndef CDE_NEXT
526 typedef pointer_vector<FeatureValue> ArrayType;
527 #else
528 typedef pointer_vector<FeatureValue> ArrayType;
529 #endif
530
531 class FeatureValueArray: public FeatureValue,  public ArrayType
532 {
533 public:
534   FeatureValueArray(const char* array_name, int size);
535   FeatureValueArray(const FeatureValueArray&);
536   ~FeatureValueArray();
537
538   virtual FeatureValue *evaluate() const;
539
540   virtual FeatureValue *clone() const 
541      { return new FeatureValueArray(*this); }; /* deep copy */
542
543   virtual ostream& print(ostream&) const;
544
545   const char* name() { return f_name; };
546
547 private:
548   char* f_name;
549 };
550
551
552 class FeatureValueDimension : public FeatureValue
553 {
554 public:
555   
556   FeatureValueDimension(FeatureValue *value, const char* unit_string);
557   FeatureValueDimension(FeatureValue *value, Unit unit);
558
559   FeatureValueDimension(float value, const char* unit_string) ;
560   FeatureValueDimension(float value, Unit unit) :
561     FeatureValue(dimension), f_value(0),
562     f_cachedValue(value), f_unit(unit) {};
563
564
565
566   FeatureValueDimension(const FeatureValueDimension&);
567   ~FeatureValueDimension();
568
569   virtual FeatureValue *clone() const; /* deep copy */
570
571   virtual FeatureValue *evaluate() const ;
572
573   // operators 
574   virtual FeatureValue *operator+(const FeatureValue&) const ;
575   virtual FeatureValue *operator-(const FeatureValue&) const ;
576   virtual FeatureValue *operator*(const FeatureValue&) const ;
577   virtual FeatureValue *operator/(const FeatureValue&) const ;
578
579   virtual FeatureValue *operator+(const FeatureValueInt&) const ;
580   virtual FeatureValue *operator-(const FeatureValueInt&) const ;
581   virtual FeatureValue *operator*(const FeatureValueInt&) const ;
582   virtual FeatureValue *operator/(const FeatureValueInt&) const ;
583
584   virtual FeatureValue *operator+(const FeatureValueReal&) const ;
585   virtual FeatureValue *operator-(const FeatureValueReal&) const ;
586   virtual FeatureValue *operator*(const FeatureValueReal&) const ;
587   virtual FeatureValue *operator/(const FeatureValueReal&) const ;
588
589   virtual FeatureValue *operator+(const FeatureValueDimension&) const ;
590   virtual FeatureValue *operator-(const FeatureValueDimension&) const ;
591   virtual FeatureValue *operator*(const FeatureValueDimension&) const ;
592   virtual FeatureValue *operator/(const FeatureValueDimension&) const ;
593
594   virtual FeatureValue *operator+(const FeatureValueExpression&) const ;
595   virtual FeatureValue *operator-(const FeatureValueExpression&) const ;
596   virtual FeatureValue *operator*(const FeatureValueExpression&) const ;
597   virtual FeatureValue *operator/(const FeatureValueExpression&) const ;
598
599   virtual FeatureValue *operator+(const int i) const ; /* returns this + i */
600   virtual FeatureValue *operator-(const int i) const ; /* returns this - i */
601   virtual FeatureValue *operator*(const int i) const ; /* returns this * i */
602   virtual FeatureValue *operator/(const int i) const ; /* returns this / i */
603
604   virtual FeatureValue *operator+(const float f) const ; /* returns this + f */
605   virtual FeatureValue *operator-(const float f) const ; /* returns this - f */
606   virtual FeatureValue *operator*(const float f) const ; /* returns this * f */
607   virtual FeatureValue *operator/(const float f) const ; /* returns this / f */
608
609   virtual FeatureValue *rdiv(const FeatureValue &) const ;
610   virtual FeatureValue *rsub(const FeatureValue &) const ;
611
612   virtual FeatureValue *rdiv(const FeatureValueInt &) const ;
613   virtual FeatureValue *rsub(const FeatureValueInt &) const ;
614
615   virtual FeatureValue *rdiv(const FeatureValueReal &) const ;
616   virtual FeatureValue *rsub(const FeatureValueReal &) const ;
617
618   virtual FeatureValue *rdiv(const FeatureValueExpression &) const ;
619   virtual FeatureValue *rsub(const FeatureValueExpression &) const ;
620
621   virtual FeatureValue *rdiv(const FeatureValueDimension &) const ;
622   virtual FeatureValue *rsub(const FeatureValueDimension &) const ;
623
624   virtual FeatureValue *rdiv(const int) const ;
625   virtual FeatureValue *rsub(const int) const ;
626
627   virtual FeatureValue *rdiv(const float) const ;
628   virtual FeatureValue *rsub(const float) const ;
629
630   virtual FeatureValue *convertTo(Unit) const ;
631   virtual FeatureValue *convertTo(Unit from, Unit to) const ;
632   virtual FeatureValue *doConvert(Unit) const ;
633
634   virtual operator float()  const;
635   virtual operator int()  const;
636   virtual operator const char *()  const;
637
638   float getValue(Unit);
639
640   FeatureValue *value() { return f_value ; }
641   Unit          unit()  { return f_unit ; }
642
643   virtual ostream& print(ostream&) const;
644
645 private:
646   FeatureValue *f_value ;
647   float         f_cachedValue;
648   Unit          f_unit ;
649
650 private:
651   float convert(float y, Unit dimensionOfy, Unit dimensionOfReturn);
652   Unit convertToUnit(const char*);
653
654 };
655 #endif /* _FeatureValue_h */
656 /* DO NOT ADD ANY LINES AFTER THIS #endif */