Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/value

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/value (Version 11.3.0) and /externals/g4tools/include/tools/value (Version 11.2.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_value                                 4 #ifndef tools_value
  5 #define tools_value                                 5 #define tools_value
  6                                                     6 
  7 #include "array"                                    7 #include "array"
  8 #include "typedefs"                                 8 #include "typedefs"
  9 #include "num2s"                                    9 #include "num2s"
 10 #include "b2s"                                     10 #include "b2s"
 11                                                    11 
 12 #ifdef TOOLS_MEM                                   12 #ifdef TOOLS_MEM
 13 #include "mem"                                     13 #include "mem"
 14 #endif                                             14 #endif
 15                                                    15 
 16 namespace tools {                                  16 namespace tools {
 17                                                    17 
 18 class value {                                      18 class value {
 19   static const std::string& s_class() {            19   static const std::string& s_class() {
 20     static const std::string s_v("tools::value     20     static const std::string s_v("tools::value");
 21     return s_v;                                    21     return s_v;
 22   }                                                22   }
 23 public:                                            23 public:
 24   enum e_type {                                    24   enum e_type {
 25     NONE = 0,                                      25     NONE = 0,
 26     // integers :                                  26     // integers :
 27     //UNSIGNED_CHAR = 10,                          27     //UNSIGNED_CHAR = 10,
 28     //CHAR = 11,                                   28     //CHAR = 11,
 29     UNSIGNED_SHORT = 12,                           29     UNSIGNED_SHORT = 12,
 30     SHORT = 13,                                    30     SHORT = 13,
 31     UNSIGNED_INT = 14,                             31     UNSIGNED_INT = 14,
 32     INT = 15,                                      32     INT = 15,
 33     UNSIGNED_INT64 = 16,                           33     UNSIGNED_INT64 = 16,
 34     INT64 = 17,                                    34     INT64 = 17,
 35     // reals :                                     35     // reals :
 36     FLOAT = 30,                                    36     FLOAT = 30,
 37     DOUBLE = 31,                                   37     DOUBLE = 31,
 38     // else :                                      38     // else :
 39     BOOL = 50,                                     39     BOOL = 50,
 40     STRING = 51,                                   40     STRING = 51,
 41     // pointers :                                  41     // pointers :
 42     VOID_STAR = 100,                               42     VOID_STAR = 100,
 43     DOUBLE_STAR = 101,                             43     DOUBLE_STAR = 101,
 44     FLOAT_STAR = 102,                              44     FLOAT_STAR = 102,
 45     INT_STAR = 103,                                45     INT_STAR = 103,
 46                                                    46 
 47     // multidimensional vectors (1000+base typ     47     // multidimensional vectors (1000+base type) :
 48     //ARRAY_UNSIGNED_CHAR = 1010,                  48     //ARRAY_UNSIGNED_CHAR = 1010,
 49     //ARRAY_CHAR = 1011,                           49     //ARRAY_CHAR = 1011,
 50     ARRAY_UNSIGNED_SHORT = 1012,                   50     ARRAY_UNSIGNED_SHORT = 1012,
 51     ARRAY_SHORT = 1013,                            51     ARRAY_SHORT = 1013,
 52     ARRAY_UNSIGNED_INT = 1014,                     52     ARRAY_UNSIGNED_INT = 1014,
 53     ARRAY_INT = 1015,                              53     ARRAY_INT = 1015,
 54     ARRAY_UNSIGNED_INT64 = 1016,                   54     ARRAY_UNSIGNED_INT64 = 1016,
 55     ARRAY_INT64 = 1017,                            55     ARRAY_INT64 = 1017,
 56     ARRAY_FLOAT = 1030,                            56     ARRAY_FLOAT = 1030,
 57     ARRAY_DOUBLE = 1031,                           57     ARRAY_DOUBLE = 1031,
 58     ARRAY_BOOL = 1050,                             58     ARRAY_BOOL = 1050,
 59     ARRAY_STRING = 1051                            59     ARRAY_STRING = 1051
 60   };                                               60   };
 61                                                    61 
 62 /*                                                 62 /*
 63   static e_type type(unsigned short) {return U     63   static e_type type(unsigned short) {return UNSIGNED_SHORT;}
 64   static e_type type(short)          {return S     64   static e_type type(short)          {return SHORT;}
 65   static e_type type(unsigned int)   {return U     65   static e_type type(unsigned int)   {return UNSIGNED_INT;}
 66   static e_type type(int)            {return I     66   static e_type type(int)            {return INT;}
 67   static e_type type(uint64)         {return U     67   static e_type type(uint64)         {return UNSIGNED_INT64;}
 68   static e_type type(int64)          {return I     68   static e_type type(int64)          {return INT64;}
 69   static e_type type(float)          {return F     69   static e_type type(float)          {return FLOAT;}
 70   static e_type type(double)         {return D     70   static e_type type(double)         {return DOUBLE;}
 71   static e_type type(bool)           {return B     71   static e_type type(bool)           {return BOOL;}
 72   static e_type type(void*)          {return V     72   static e_type type(void*)          {return VOID_STAR;}
 73   static e_type type(double*)        {return D     73   static e_type type(double*)        {return DOUBLE_STAR;}
 74   static e_type type(float*)         {return F     74   static e_type type(float*)         {return FLOAT_STAR;}
 75   static e_type type(int*)           {return I     75   static e_type type(int*)           {return INT_STAR;}
 76   //static e_type type(const std::string&) {re     76   //static e_type type(const std::string&) {return STRING;}
 77 */                                                 77 */
 78 public:                                            78 public:
 79   value():m_label(0),m_itag(0){                    79   value():m_label(0),m_itag(0){
 80 #ifdef TOOLS_MEM                                   80 #ifdef TOOLS_MEM
 81     mem::increment(s_class().c_str());             81     mem::increment(s_class().c_str());
 82 #endif                                             82 #endif
 83     m_type = NONE;                                 83     m_type = NONE;
 84     u.m_unsigned_int64 = 0;                        84     u.m_unsigned_int64 = 0;
 85   }                                                85   }
 86                                                    86 
 87   value(bool a_value):m_label(0),m_itag(0) {       87   value(bool a_value):m_label(0),m_itag(0) {
 88 #ifdef TOOLS_MEM                                   88 #ifdef TOOLS_MEM
 89     mem::increment(s_class().c_str());             89     mem::increment(s_class().c_str());
 90 #endif                                             90 #endif
 91     m_type = BOOL;                                 91     m_type = BOOL;
 92     u.m_bool = a_value;                            92     u.m_bool = a_value;
 93   }                                                93   }
 94 //  value(char a_value):m_label(0),m_itag(0) {     94 //  value(char a_value):m_label(0),m_itag(0) {
 95 //#ifdef TOOLS_MEM                                 95 //#ifdef TOOLS_MEM
 96 //    mem::increment(s_class().c_str());           96 //    mem::increment(s_class().c_str());
 97 //#endif                                           97 //#endif
 98 //    m_type = CHAR;                               98 //    m_type = CHAR;
 99 //    u.m_char = a_value;                          99 //    u.m_char = a_value;
100 //  }                                             100 //  }
101   value(short a_value):m_label(0),m_itag(0) {     101   value(short a_value):m_label(0),m_itag(0) {
102 #ifdef TOOLS_MEM                                  102 #ifdef TOOLS_MEM
103     mem::increment(s_class().c_str());            103     mem::increment(s_class().c_str());
104 #endif                                            104 #endif
105     m_type = SHORT;                               105     m_type = SHORT;
106     u.m_short = a_value;                          106     u.m_short = a_value;
107   }                                               107   }
108   value(int a_value):m_label(0),m_itag(0) {       108   value(int a_value):m_label(0),m_itag(0) {
109 #ifdef TOOLS_MEM                                  109 #ifdef TOOLS_MEM
110     mem::increment(s_class().c_str());            110     mem::increment(s_class().c_str());
111 #endif                                            111 #endif
112     m_type = INT;                                 112     m_type = INT;
113     u.m_int = a_value;                            113     u.m_int = a_value;
114   }                                               114   }
115   value(int64 a_value):m_label(0),m_itag(0) {     115   value(int64 a_value):m_label(0),m_itag(0) {
116 #ifdef TOOLS_MEM                                  116 #ifdef TOOLS_MEM
117     mem::increment(s_class().c_str());            117     mem::increment(s_class().c_str());
118 #endif                                            118 #endif
119     m_type = INT64;                               119     m_type = INT64;
120     u.m_int64 = a_value;                          120     u.m_int64 = a_value;
121   }                                               121   }
122   value(uint64 a_value):m_label(0),m_itag(0) {    122   value(uint64 a_value):m_label(0),m_itag(0) {
123 #ifdef TOOLS_MEM                                  123 #ifdef TOOLS_MEM
124     mem::increment(s_class().c_str());            124     mem::increment(s_class().c_str());
125 #endif                                            125 #endif
126     m_type = UNSIGNED_INT64;                      126     m_type = UNSIGNED_INT64;
127     u.m_unsigned_int64 = a_value;                 127     u.m_unsigned_int64 = a_value;
128   }                                               128   }
129   value(float a_value):m_label(0),m_itag(0) {     129   value(float a_value):m_label(0),m_itag(0) {
130 #ifdef TOOLS_MEM                                  130 #ifdef TOOLS_MEM
131     mem::increment(s_class().c_str());            131     mem::increment(s_class().c_str());
132 #endif                                            132 #endif
133     m_type = FLOAT;                               133     m_type = FLOAT;
134     u.m_float = a_value;                          134     u.m_float = a_value;
135   }                                               135   }
136   value(double a_value):m_label(0),m_itag(0) {    136   value(double a_value):m_label(0),m_itag(0) {
137 #ifdef TOOLS_MEM                                  137 #ifdef TOOLS_MEM
138     mem::increment(s_class().c_str());            138     mem::increment(s_class().c_str());
139 #endif                                            139 #endif
140     m_type = DOUBLE;                              140     m_type = DOUBLE;
141     u.m_double = a_value;                         141     u.m_double = a_value;
142   }                                               142   }
143                                                   143 
144 //  value(unsigned char a_value):m_label(0),m_    144 //  value(unsigned char a_value):m_label(0),m_itag(0) {
145 //#ifdef TOOLS_MEM                                145 //#ifdef TOOLS_MEM
146 //    mem::increment(s_class().c_str());          146 //    mem::increment(s_class().c_str());
147 //#endif                                          147 //#endif
148 //    m_type = UNSIGNED_CHAR;                     148 //    m_type = UNSIGNED_CHAR;
149 //    u.m_unsigned_char = a_value;                149 //    u.m_unsigned_char = a_value;
150 //  }                                             150 //  }
151   value(unsigned short a_value):m_label(0),m_i    151   value(unsigned short a_value):m_label(0),m_itag(0) {
152 #ifdef TOOLS_MEM                                  152 #ifdef TOOLS_MEM
153     mem::increment(s_class().c_str());            153     mem::increment(s_class().c_str());
154 #endif                                            154 #endif
155     m_type = UNSIGNED_SHORT;                      155     m_type = UNSIGNED_SHORT;
156     u.m_unsigned_short = a_value;                 156     u.m_unsigned_short = a_value;
157   }                                               157   }
158   value(unsigned int a_value):m_label(0),m_ita    158   value(unsigned int a_value):m_label(0),m_itag(0) {
159 #ifdef TOOLS_MEM                                  159 #ifdef TOOLS_MEM
160     mem::increment(s_class().c_str());            160     mem::increment(s_class().c_str());
161 #endif                                            161 #endif
162     m_type = UNSIGNED_INT;                        162     m_type = UNSIGNED_INT;
163     u.m_unsigned_int = a_value;                   163     u.m_unsigned_int = a_value;
164   }                                               164   }
165   value(void* a_value):m_label(0),m_itag(0) {     165   value(void* a_value):m_label(0),m_itag(0) {
166 #ifdef TOOLS_MEM                                  166 #ifdef TOOLS_MEM
167     mem::increment(s_class().c_str());            167     mem::increment(s_class().c_str());
168 #endif                                            168 #endif
169     m_type = VOID_STAR;                           169     m_type = VOID_STAR;
170     u.m_void_star = a_value;                      170     u.m_void_star = a_value;
171   }                                               171   }
172   value(double* a_value):m_label(0),m_itag(0)     172   value(double* a_value):m_label(0),m_itag(0) {
173 #ifdef TOOLS_MEM                                  173 #ifdef TOOLS_MEM
174     mem::increment(s_class().c_str());            174     mem::increment(s_class().c_str());
175 #endif                                            175 #endif
176     m_type = DOUBLE_STAR;                         176     m_type = DOUBLE_STAR;
177     u.m_double_star = a_value;                    177     u.m_double_star = a_value;
178   }                                               178   }
179   value(float* a_value):m_label(0),m_itag(0) {    179   value(float* a_value):m_label(0),m_itag(0) {
180 #ifdef TOOLS_MEM                                  180 #ifdef TOOLS_MEM
181     mem::increment(s_class().c_str());            181     mem::increment(s_class().c_str());
182 #endif                                            182 #endif
183     m_type = FLOAT_STAR;                          183     m_type = FLOAT_STAR;
184     u.m_float_star = a_value;                     184     u.m_float_star = a_value;
185   }                                               185   }
186   value(int* a_value):m_label(0),m_itag(0) {      186   value(int* a_value):m_label(0),m_itag(0) {
187 #ifdef TOOLS_MEM                                  187 #ifdef TOOLS_MEM
188     mem::increment(s_class().c_str());            188     mem::increment(s_class().c_str());
189 #endif                                            189 #endif
190     m_type = INT_STAR;                            190     m_type = INT_STAR;
191     u.m_int_star = a_value;                       191     u.m_int_star = a_value;
192   }                                               192   }
193                                                   193 
194   value(const char* a_value):m_label(0),m_itag    194   value(const char* a_value):m_label(0),m_itag(0) {
195 #ifdef TOOLS_MEM                                  195 #ifdef TOOLS_MEM
196     mem::increment(s_class().c_str());            196     mem::increment(s_class().c_str());
197 #endif                                            197 #endif
198     m_type = STRING;                              198     m_type = STRING;
199     u.m_string = new std::string(a_value?a_val    199     u.m_string = new std::string(a_value?a_value:"");
200   }                                               200   }
201   value(const std::string& a_value):m_label(0)    201   value(const std::string& a_value):m_label(0),m_itag(0) {
202 #ifdef TOOLS_MEM                                  202 #ifdef TOOLS_MEM
203     mem::increment(s_class().c_str());            203     mem::increment(s_class().c_str());
204 #endif                                            204 #endif
205     m_type = STRING;                              205     m_type = STRING;
206     u.m_string = new std::string(a_value);        206     u.m_string = new std::string(a_value);
207   }                                               207   }
208                                                   208 
209 #ifdef TOOLS_MEM                                  209 #ifdef TOOLS_MEM
210 #define TOOLS_VALUE_CSTOR(a_what,a_m_what,a_ty    210 #define TOOLS_VALUE_CSTOR(a_what,a_m_what,a_type) \
211   value(const std::vector<a_what>& a_v):m_labe    211   value(const std::vector<a_what>& a_v):m_label(0),m_itag(0){\
212     mem::increment(s_class().c_str());\           212     mem::increment(s_class().c_str());\
213     m_type = a_type;\                             213     m_type = a_type;\
214     std::vector<unsigned int> is(1);\             214     std::vector<unsigned int> is(1);\
215     is[0] = (unsigned int)a_v.size();\            215     is[0] = (unsigned int)a_v.size();\
216     u.a_m_what = new array<a_what>(is);\          216     u.a_m_what = new array<a_what>(is);\
217     u.a_m_what->fill(a_v);\                       217     u.a_m_what->fill(a_v);\
218   }                                               218   }
219 #else                                             219 #else
220 #define TOOLS_VALUE_CSTOR(a_what,a_m_what,a_ty    220 #define TOOLS_VALUE_CSTOR(a_what,a_m_what,a_type) \
221   value(const std::vector<a_what>& a_v):m_labe    221   value(const std::vector<a_what>& a_v):m_label(0),m_itag(0){\
222     m_type = a_type;\                             222     m_type = a_type;\
223     std::vector<unsigned int> is(1);\             223     std::vector<unsigned int> is(1);\
224     is[0] = (unsigned int)a_v.size();\            224     is[0] = (unsigned int)a_v.size();\
225     u.a_m_what = new array<a_what>(is);\          225     u.a_m_what = new array<a_what>(is);\
226     u.a_m_what->fill(a_v);\                       226     u.a_m_what->fill(a_v);\
227   }                                               227   }
228 #endif                                            228 #endif
229                                                   229 
230 //TOOLS_VALUE_CSTOR(unsigned char,m_array_unsi    230 //TOOLS_VALUE_CSTOR(unsigned char,m_array_unsigned_char,ARRAY_UNSIGNED_CHAR)
231 //TOOLS_VALUE_CSTOR(char,m_array_char,ARRAY_CH    231 //TOOLS_VALUE_CSTOR(char,m_array_char,ARRAY_CHAR)
232   TOOLS_VALUE_CSTOR(unsigned short,m_array_uns    232   TOOLS_VALUE_CSTOR(unsigned short,m_array_unsigned_short,ARRAY_UNSIGNED_SHORT)
233   TOOLS_VALUE_CSTOR(short,m_array_short,ARRAY_    233   TOOLS_VALUE_CSTOR(short,m_array_short,ARRAY_SHORT)
234   TOOLS_VALUE_CSTOR(unsigned int,m_array_unsig    234   TOOLS_VALUE_CSTOR(unsigned int,m_array_unsigned_int,ARRAY_UNSIGNED_INT)
235   TOOLS_VALUE_CSTOR(int,m_array_int,ARRAY_INT)    235   TOOLS_VALUE_CSTOR(int,m_array_int,ARRAY_INT)
236   TOOLS_VALUE_CSTOR(uint64,m_array_unsigned_in    236   TOOLS_VALUE_CSTOR(uint64,m_array_unsigned_int64,ARRAY_UNSIGNED_INT64)
237   TOOLS_VALUE_CSTOR(int64,m_array_int64,ARRAY_    237   TOOLS_VALUE_CSTOR(int64,m_array_int64,ARRAY_INT64)
238   TOOLS_VALUE_CSTOR(float,m_array_float,ARRAY_    238   TOOLS_VALUE_CSTOR(float,m_array_float,ARRAY_FLOAT)
239   TOOLS_VALUE_CSTOR(double,m_array_double,ARRA    239   TOOLS_VALUE_CSTOR(double,m_array_double,ARRAY_DOUBLE)
240   TOOLS_VALUE_CSTOR(bool,m_array_bool,ARRAY_BO    240   TOOLS_VALUE_CSTOR(bool,m_array_bool,ARRAY_BOOL)
241   TOOLS_VALUE_CSTOR(std::string,m_array_string    241   TOOLS_VALUE_CSTOR(std::string,m_array_string,ARRAY_STRING)
242                                                   242 
243 #undef TOOLS_VALUE_CSTOR                          243 #undef TOOLS_VALUE_CSTOR
244                                                   244 
245 #ifdef TOOLS_MEM                                  245 #ifdef TOOLS_MEM
246 #define TOOLS_VALUE_CSTORA(a_what,a_m_what,a_t    246 #define TOOLS_VALUE_CSTORA(a_what,a_m_what,a_type) \
247   value(const array<a_what>& a_a):m_label(0),m    247   value(const array<a_what>& a_a):m_label(0),m_itag(0){\
248     mem::increment(s_class().c_str());\           248     mem::increment(s_class().c_str());\
249     m_type = a_type;\                             249     m_type = a_type;\
250     u.a_m_what = new array<a_what>(a_a);\         250     u.a_m_what = new array<a_what>(a_a);\
251   }                                               251   }
252 #else                                             252 #else
253 #define TOOLS_VALUE_CSTORA(a_what,a_m_what,a_t    253 #define TOOLS_VALUE_CSTORA(a_what,a_m_what,a_type) \
254   value(const array<a_what>& a_a):m_label(0),m    254   value(const array<a_what>& a_a):m_label(0),m_itag(0){\
255     m_type = a_type;\                             255     m_type = a_type;\
256     u.a_m_what = new array<a_what>(a_a);\         256     u.a_m_what = new array<a_what>(a_a);\
257   }                                               257   }
258 #endif                                            258 #endif
259                                                   259 
260 //TOOLS_VALUE_CSTORA(unsigned char,m_array_uns    260 //TOOLS_VALUE_CSTORA(unsigned char,m_array_unsigned_char,ARRAY_UNSIGNED_CHAR)
261 //TOOLS_VALUE_CSTORA(char,m_array_char,ARRAY_C    261 //TOOLS_VALUE_CSTORA(char,m_array_char,ARRAY_CHAR)
262   TOOLS_VALUE_CSTORA(unsigned short,m_array_un    262   TOOLS_VALUE_CSTORA(unsigned short,m_array_unsigned_short,ARRAY_UNSIGNED_SHORT)
263   TOOLS_VALUE_CSTORA(short,m_array_short,ARRAY    263   TOOLS_VALUE_CSTORA(short,m_array_short,ARRAY_SHORT)
264   TOOLS_VALUE_CSTORA(unsigned int,m_array_unsi    264   TOOLS_VALUE_CSTORA(unsigned int,m_array_unsigned_int,ARRAY_UNSIGNED_INT)
265   TOOLS_VALUE_CSTORA(int,m_array_int,ARRAY_INT    265   TOOLS_VALUE_CSTORA(int,m_array_int,ARRAY_INT)
266   TOOLS_VALUE_CSTORA(uint64,m_array_unsigned_i    266   TOOLS_VALUE_CSTORA(uint64,m_array_unsigned_int64,ARRAY_UNSIGNED_INT64)
267   TOOLS_VALUE_CSTORA(int64,m_array_int64,ARRAY    267   TOOLS_VALUE_CSTORA(int64,m_array_int64,ARRAY_INT64)
268   TOOLS_VALUE_CSTORA(float,m_array_float,ARRAY    268   TOOLS_VALUE_CSTORA(float,m_array_float,ARRAY_FLOAT)
269   TOOLS_VALUE_CSTORA(double,m_array_double,ARR    269   TOOLS_VALUE_CSTORA(double,m_array_double,ARRAY_DOUBLE)
270   TOOLS_VALUE_CSTORA(bool,m_array_bool,ARRAY_B    270   TOOLS_VALUE_CSTORA(bool,m_array_bool,ARRAY_BOOL)
271   TOOLS_VALUE_CSTORA(std::string,m_array_strin    271   TOOLS_VALUE_CSTORA(std::string,m_array_string,ARRAY_STRING)
272                                                   272 
273 #undef TOOLS_VALUE_CSTORA                         273 #undef TOOLS_VALUE_CSTORA
274                                                   274 
275   virtual ~value() {                              275   virtual ~value() {
276     delete m_label;                               276     delete m_label;
277     reset();                                      277     reset();
278 #ifdef TOOLS_MEM                                  278 #ifdef TOOLS_MEM
279     mem::decrement(s_class().c_str());            279     mem::decrement(s_class().c_str());
280 #endif                                            280 #endif
281   }                                               281   }
282 public:                                           282 public:
283   value(const value& a_from):m_label(0),m_itag    283   value(const value& a_from):m_label(0),m_itag(a_from.m_itag){
284 #ifdef TOOLS_MEM                                  284 #ifdef TOOLS_MEM
285     mem::increment(s_class().c_str());            285     mem::increment(s_class().c_str());
286 #endif                                            286 #endif
287                                                   287 
288     if(a_from.m_label) m_label = new std::stri    288     if(a_from.m_label) m_label = new std::string(*a_from.m_label);
289     m_type = a_from.m_type;                       289     m_type = a_from.m_type;
290                                                   290 
291     if(a_from.m_type==STRING) {                   291     if(a_from.m_type==STRING) {
292       u.m_string = new std::string(*a_from.u.m    292       u.m_string = new std::string(*a_from.u.m_string);
293                                                   293 
294     //} else if(a_from.m_type==ARRAY_UNSIGNED_    294     //} else if(a_from.m_type==ARRAY_UNSIGNED_CHAR) {
295     //  u.m_array_unsigned_char =                 295     //  u.m_array_unsigned_char =
296     //    new array<unsigned char>(*a_from.u.m    296     //    new array<unsigned char>(*a_from.u.m_array_unsigned_char);
297                                                   297 
298     //} else if(a_from.m_type==ARRAY_CHAR) {      298     //} else if(a_from.m_type==ARRAY_CHAR) {
299     //  u.m_array_char = new array<char>(*a_fr    299     //  u.m_array_char = new array<char>(*a_from.u.m_array_char);
300                                                   300 
301     } else if(a_from.m_type==ARRAY_UNSIGNED_SH    301     } else if(a_from.m_type==ARRAY_UNSIGNED_SHORT) {
302       u.m_array_unsigned_short =                  302       u.m_array_unsigned_short =
303         new array<unsigned short>(*a_from.u.m_    303         new array<unsigned short>(*a_from.u.m_array_unsigned_short);
304                                                   304 
305     } else if(a_from.m_type==ARRAY_SHORT) {       305     } else if(a_from.m_type==ARRAY_SHORT) {
306       u.m_array_short = new array<short>(*a_fr    306       u.m_array_short = new array<short>(*a_from.u.m_array_short);
307                                                   307 
308     } else if(a_from.m_type==ARRAY_UNSIGNED_IN    308     } else if(a_from.m_type==ARRAY_UNSIGNED_INT) {
309       u.m_array_unsigned_int = new array<unsig    309       u.m_array_unsigned_int = new array<unsigned int>(*a_from.u.m_array_unsigned_int);
310                                                   310 
311     } else if(a_from.m_type==ARRAY_INT) {         311     } else if(a_from.m_type==ARRAY_INT) {
312       u.m_array_int = new array<int>(*a_from.u    312       u.m_array_int = new array<int>(*a_from.u.m_array_int);
313                                                   313 
314     } else if(a_from.m_type==ARRAY_UNSIGNED_IN    314     } else if(a_from.m_type==ARRAY_UNSIGNED_INT64) {
315       u.m_array_unsigned_int64 = new array<uin    315       u.m_array_unsigned_int64 = new array<uint64>(*a_from.u.m_array_unsigned_int64);
316                                                   316 
317     } else if(a_from.m_type==ARRAY_INT64) {       317     } else if(a_from.m_type==ARRAY_INT64) {
318       u.m_array_int64 = new array<int64>(*a_fr    318       u.m_array_int64 = new array<int64>(*a_from.u.m_array_int64);
319                                                   319 
320     } else if(a_from.m_type==ARRAY_FLOAT) {       320     } else if(a_from.m_type==ARRAY_FLOAT) {
321       u.m_array_float = new array<float>(*a_fr    321       u.m_array_float = new array<float>(*a_from.u.m_array_float);
322                                                   322 
323     } else if(a_from.m_type==ARRAY_DOUBLE) {      323     } else if(a_from.m_type==ARRAY_DOUBLE) {
324       u.m_array_double = new array<double>(*a_    324       u.m_array_double = new array<double>(*a_from.u.m_array_double);
325                                                   325 
326     } else if(a_from.m_type==ARRAY_BOOL) {        326     } else if(a_from.m_type==ARRAY_BOOL) {
327       u.m_array_bool = new array<bool>(*a_from    327       u.m_array_bool = new array<bool>(*a_from.u.m_array_bool);
328                                                   328 
329     } else if(a_from.m_type==ARRAY_STRING) {      329     } else if(a_from.m_type==ARRAY_STRING) {
330       u.m_array_string = new array<std::string    330       u.m_array_string = new array<std::string>(*a_from.u.m_array_string);
331                                                   331 
332     } else {                                      332     } else {
333       u = a_from.u;                               333       u = a_from.u;
334     }                                             334     }
335   }                                               335   }
336                                                   336 
337   value& operator=(const value& a_from) {         337   value& operator=(const value& a_from) {
338     if(&a_from==this) return *this;               338     if(&a_from==this) return *this;
339                                                   339 
340     delete m_label;m_label = 0;                   340     delete m_label;m_label = 0;
341     if(a_from.m_label) m_label = new std::stri    341     if(a_from.m_label) m_label = new std::string(*a_from.m_label);
342                                                   342 
343     m_itag = a_from.m_itag;                       343     m_itag = a_from.m_itag;
344                                                   344 
345     reset();                                      345     reset();
346                                                   346 
347     m_type = a_from.m_type;                       347     m_type = a_from.m_type;
348                                                   348 
349     if(a_from.m_type==STRING) {                   349     if(a_from.m_type==STRING) {
350       u.m_string = new std::string(*a_from.u.m    350       u.m_string = new std::string(*a_from.u.m_string);
351                                                   351 
352     //} else if(a_from.m_type==ARRAY_UNSIGNED_    352     //} else if(a_from.m_type==ARRAY_UNSIGNED_CHAR) {
353     //  u.m_array_unsigned_char =                 353     //  u.m_array_unsigned_char =
354     //    new array<unsigned char>(*a_from.u.m    354     //    new array<unsigned char>(*a_from.u.m_array_unsigned_char);
355                                                   355 
356     //} else if(a_from.m_type==ARRAY_CHAR) {      356     //} else if(a_from.m_type==ARRAY_CHAR) {
357     //  u.m_array_char = new array<char>(*a_fr    357     //  u.m_array_char = new array<char>(*a_from.u.m_array_char);
358                                                   358 
359     } else if(a_from.m_type==ARRAY_UNSIGNED_SH    359     } else if(a_from.m_type==ARRAY_UNSIGNED_SHORT) {
360       u.m_array_unsigned_short = new array<uns    360       u.m_array_unsigned_short = new array<unsigned short>(*a_from.u.m_array_unsigned_short);
361                                                   361 
362     } else if(a_from.m_type==ARRAY_SHORT) {       362     } else if(a_from.m_type==ARRAY_SHORT) {
363       u.m_array_short = new array<short>(*a_fr    363       u.m_array_short = new array<short>(*a_from.u.m_array_short);
364                                                   364 
365     } else if(a_from.m_type==ARRAY_UNSIGNED_IN    365     } else if(a_from.m_type==ARRAY_UNSIGNED_INT) {
366       u.m_array_unsigned_int = new array<unsig    366       u.m_array_unsigned_int = new array<unsigned int>(*a_from.u.m_array_unsigned_int);
367                                                   367 
368     } else if(a_from.m_type==ARRAY_INT) {         368     } else if(a_from.m_type==ARRAY_INT) {
369       u.m_array_int = new array<int>(*a_from.u    369       u.m_array_int = new array<int>(*a_from.u.m_array_int);
370                                                   370 
371     } else if(a_from.m_type==ARRAY_UNSIGNED_IN    371     } else if(a_from.m_type==ARRAY_UNSIGNED_INT64) {
372       u.m_array_unsigned_int64 = new array<uin    372       u.m_array_unsigned_int64 = new array<uint64>(*a_from.u.m_array_unsigned_int64);
373                                                   373 
374     } else if(a_from.m_type==ARRAY_INT64) {       374     } else if(a_from.m_type==ARRAY_INT64) {
375       u.m_array_int64 = new array<int64>(*a_fr    375       u.m_array_int64 = new array<int64>(*a_from.u.m_array_int64);
376                                                   376 
377     } else if(a_from.m_type==ARRAY_FLOAT) {       377     } else if(a_from.m_type==ARRAY_FLOAT) {
378       u.m_array_float = new array<float>(*a_fr    378       u.m_array_float = new array<float>(*a_from.u.m_array_float);
379                                                   379 
380     } else if(a_from.m_type==ARRAY_DOUBLE) {      380     } else if(a_from.m_type==ARRAY_DOUBLE) {
381       u.m_array_double = new array<double>(*a_    381       u.m_array_double = new array<double>(*a_from.u.m_array_double);
382                                                   382 
383     } else if(a_from.m_type==ARRAY_BOOL) {        383     } else if(a_from.m_type==ARRAY_BOOL) {
384       u.m_array_bool = new array<bool>(*a_from    384       u.m_array_bool = new array<bool>(*a_from.u.m_array_bool);
385                                                   385 
386     } else if(a_from.m_type==ARRAY_STRING) {      386     } else if(a_from.m_type==ARRAY_STRING) {
387       u.m_array_string = new array<std::string    387       u.m_array_string = new array<std::string>(*a_from.u.m_array_string);
388                                                   388 
389     } else {                                      389     } else {
390       u = a_from.u;                               390       u = a_from.u;
391     }                                             391     }
392                                                   392 
393     return *this;                                 393     return *this;
394   }                                               394   }
395 /* for tests/symbolic.cpp.                        395 /* for tests/symbolic.cpp.
396 public:                                           396 public:
397   value operator*(const value& a_from) const {    397   value operator*(const value& a_from) const {
398     value tmp(*this);                             398     value tmp(*this);
399     std::string serr;                             399     std::string serr;
400     multiply(tmp,a_from,serr);                    400     multiply(tmp,a_from,serr);
401     return tmp;                                   401     return tmp;
402   }                                               402   }
403   value operator+(const value& a_from) const {    403   value operator+(const value& a_from) const {
404     value tmp(*this);                             404     value tmp(*this);
405     std::string serr;                             405     std::string serr;
406     add(tmp,a_from,serr);                         406     add(tmp,a_from,serr);
407     return tmp;                                   407     return tmp;
408   }                                               408   }
409   value operator-(const value& a_from) const {    409   value operator-(const value& a_from) const {
410     value tmp(*this);                             410     value tmp(*this);
411     std::string serr;                             411     std::string serr;
412     subtract(tmp,a_from,serr);                    412     subtract(tmp,a_from,serr);
413     return tmp;                                   413     return tmp;
414   }                                               414   }
415   value operator+=(const value& a_from) {         415   value operator+=(const value& a_from) {
416     value _s = operator+(a_from);                 416     value _s = operator+(a_from);
417     *this = _s;                                   417     *this = _s;
418     return _s;                                    418     return _s;
419   }                                               419   }
420   value operator-=(const value& a_from) {         420   value operator-=(const value& a_from) {
421     value _s = operator-(a_from);                 421     value _s = operator-(a_from);
422     *this = _s;                                   422     *this = _s;
423     return _s;                                    423     return _s;
424   }                                               424   }
425 */                                                425 */
426 private:                                          426 private:
427   static const std::string& s_empty() {           427   static const std::string& s_empty() {
428     static const std::string s_v("");             428     static const std::string s_v("");
429     return s_v;                                   429     return s_v;
430   }                                               430   }
431 public:                                           431 public:
432   void set_itag(unsigned int a_itag) {m_itag =    432   void set_itag(unsigned int a_itag) {m_itag = a_itag;} //gopaw
433   unsigned int itag() const {return m_itag;} /    433   unsigned int itag() const {return m_itag;} //gopaw
434   void set_label(const std::string& a_s) {        434   void set_label(const std::string& a_s) {
435     delete m_label;                               435     delete m_label;
436     m_label = new std::string(a_s);               436     m_label = new std::string(a_s);
437   }                                               437   }
438   const std::string& label() const {return m_l    438   const std::string& label() const {return m_label?(*m_label):s_empty();}
439                                                   439 
440   e_type type() const {return m_type;}            440   e_type type() const {return m_type;}
441   void set_type(e_type a_type) {                  441   void set_type(e_type a_type) {
442     reset();                                      442     reset();
443     m_type = a_type;                              443     m_type = a_type;
444     switch(a_type) {                              444     switch(a_type) {
445     case NONE:      u.m_unsigned_int64 = 0;bre    445     case NONE:      u.m_unsigned_int64 = 0;break;
446     //case UNSIGNED_CHAR:    u.m_unsigned_char    446     //case UNSIGNED_CHAR:    u.m_unsigned_char = 0;break;
447     //case CHAR:      u.m_char = 0;break;         447     //case CHAR:      u.m_char = 0;break;
448     case UNSIGNED_SHORT:   u.m_unsigned_short     448     case UNSIGNED_SHORT:   u.m_unsigned_short = 0;break;
449     case SHORT:     u.m_short = 0;break;          449     case SHORT:     u.m_short = 0;break;
450     case UNSIGNED_INT:     u.m_unsigned_int =     450     case UNSIGNED_INT:     u.m_unsigned_int = 0;break;
451     case INT:       u.m_int = 0;break;            451     case INT:       u.m_int = 0;break;
452     case UNSIGNED_INT64:   u.m_unsigned_int64     452     case UNSIGNED_INT64:   u.m_unsigned_int64 =0;break;
453     case INT64:     u.m_int64 = 0;break;          453     case INT64:     u.m_int64 = 0;break;
454     case FLOAT:     u.m_float = 0;break;          454     case FLOAT:     u.m_float = 0;break;
455     case DOUBLE:    u.m_double = 0;break;         455     case DOUBLE:    u.m_double = 0;break;
456     case BOOL:      u.m_bool = false;break;       456     case BOOL:      u.m_bool = false;break;
457     case VOID_STAR:        u.m_void_star = 0;b    457     case VOID_STAR:        u.m_void_star = 0;break;
458     case DOUBLE_STAR:      u.m_double_star = 0    458     case DOUBLE_STAR:      u.m_double_star = 0;break;
459     case FLOAT_STAR:       u.m_float_star = 0;    459     case FLOAT_STAR:       u.m_float_star = 0;break;
460     case INT_STAR:         u.m_int_star = 0;br    460     case INT_STAR:         u.m_int_star = 0;break;
461     case STRING:       u.m_string = new std::s    461     case STRING:       u.m_string = new std::string("");break;
462     //case ARRAY_UNSIGNED_CHAR:                   462     //case ARRAY_UNSIGNED_CHAR:
463     //  u.m_array_unsigned_char = new array<un    463     //  u.m_array_unsigned_char = new array<unsigned char>();break;
464     //case ARRAY_CHAR:u.m_array_char = new arr    464     //case ARRAY_CHAR:u.m_array_char = new array<char>();break;
465                                                   465 
466     case ARRAY_UNSIGNED_SHORT:                    466     case ARRAY_UNSIGNED_SHORT:
467       u.m_array_unsigned_short = new array<uns    467       u.m_array_unsigned_short = new array<unsigned short>();break;
468     case ARRAY_SHORT:u.m_array_short = new arr    468     case ARRAY_SHORT:u.m_array_short = new array<short>();break;
469                                                   469 
470     case ARRAY_UNSIGNED_INT:                      470     case ARRAY_UNSIGNED_INT:
471       u.m_array_unsigned_int = new array<unsig    471       u.m_array_unsigned_int = new array<unsigned int>();break;
472     case ARRAY_INT:u.m_array_int = new array<i    472     case ARRAY_INT:u.m_array_int = new array<int>();break;
473     case ARRAY_UNSIGNED_INT64:                    473     case ARRAY_UNSIGNED_INT64:
474       u.m_array_unsigned_int64 = new array<uin    474       u.m_array_unsigned_int64 = new array<uint64>();break;
475     case ARRAY_INT64:u.m_array_int64 = new arr    475     case ARRAY_INT64:u.m_array_int64 = new array<int64>();break;
476                                                   476 
477     case ARRAY_FLOAT:u.m_array_float = new arr    477     case ARRAY_FLOAT:u.m_array_float = new array<float>();break;
478     case ARRAY_DOUBLE:u.m_array_double = new a    478     case ARRAY_DOUBLE:u.m_array_double = new array<double>();break;
479     case ARRAY_BOOL:u.m_array_bool = new array    479     case ARRAY_BOOL:u.m_array_bool = new array<bool>();break;
480     case ARRAY_STRING:u.m_array_string = new a    480     case ARRAY_STRING:u.m_array_string = new array<std::string>();break;
481     }                                             481     }
482   }                                               482   }
483                                                   483 
484   void set_none() {                               484   void set_none() {
485     reset();                                      485     reset();
486     m_type = NONE;                                486     m_type = NONE;
487     u.m_unsigned_int64 = 0;                       487     u.m_unsigned_int64 = 0;
488   }                                               488   }
489   //void set(char a_value) {                      489   //void set(char a_value) {
490   //  reset();                                    490   //  reset();
491   //  m_type = CHAR;                              491   //  m_type = CHAR;
492   //  u.m_char = a_value;                         492   //  u.m_char = a_value;
493   //}                                             493   //}
494   //void set(unsigned char a_value) {             494   //void set(unsigned char a_value) {
495   //  reset();                                    495   //  reset();
496   //  m_type = UNSIGNED_CHAR;                     496   //  m_type = UNSIGNED_CHAR;
497   //  u.m_unsigned_char = a_value;                497   //  u.m_unsigned_char = a_value;
498   //}                                             498   //}
499   void set(short a_value) {                       499   void set(short a_value) {
500     reset();                                      500     reset();
501     m_type = SHORT;                               501     m_type = SHORT;
502     u.m_short = a_value;                          502     u.m_short = a_value;
503   }                                               503   }
504   void set(unsigned short a_value) {              504   void set(unsigned short a_value) {
505     reset();                                      505     reset();
506     m_type = UNSIGNED_SHORT;                      506     m_type = UNSIGNED_SHORT;
507     u.m_unsigned_short  = a_value;                507     u.m_unsigned_short  = a_value;
508   }                                               508   }
509   void set(int a_value) {                         509   void set(int a_value) {
510     reset();                                      510     reset();
511     m_type = INT;                                 511     m_type = INT;
512     u.m_int = a_value;                            512     u.m_int = a_value;
513   }                                               513   }
514   void set(unsigned int a_value) {                514   void set(unsigned int a_value) {
515     reset();                                      515     reset();
516     m_type = UNSIGNED_INT;                        516     m_type = UNSIGNED_INT;
517     u.m_unsigned_int  = a_value;                  517     u.m_unsigned_int  = a_value;
518   }                                               518   }
519   void set(int64 a_value) {                       519   void set(int64 a_value) {
520     reset();                                      520     reset();
521     m_type = INT64;                               521     m_type = INT64;
522     u.m_int64 = a_value;                          522     u.m_int64 = a_value;
523   }                                               523   }
524   void set(uint64 a_value) {                      524   void set(uint64 a_value) {
525     reset();                                      525     reset();
526     m_type = UNSIGNED_INT64;                      526     m_type = UNSIGNED_INT64;
527     u.m_unsigned_int64 = a_value;                 527     u.m_unsigned_int64 = a_value;
528   }                                               528   }
529   void set(float a_value) {                       529   void set(float a_value) {
530     reset();                                      530     reset();
531     m_type = FLOAT;                               531     m_type = FLOAT;
532     u.m_float = a_value;                          532     u.m_float = a_value;
533   }                                               533   }
534   void set(double a_value) {                      534   void set(double a_value) {
535     reset();                                      535     reset();
536     m_type = DOUBLE;                              536     m_type = DOUBLE;
537     u.m_double = a_value;                         537     u.m_double = a_value;
538   }                                               538   }
539   void set(bool a_value) {                        539   void set(bool a_value) {
540     reset();                                      540     reset();
541     m_type = BOOL;                                541     m_type = BOOL;
542     u.m_bool = a_value;                           542     u.m_bool = a_value;
543   }                                               543   }
544                                                   544 
545   void set(const std::string& a_value) {          545   void set(const std::string& a_value) {
546     reset();                                      546     reset();
547     m_type = STRING;                              547     m_type = STRING;
548     u.m_string = new std::string(a_value);        548     u.m_string = new std::string(a_value);
549   }                                               549   }
550   void set(const char* a_value) {                 550   void set(const char* a_value) {
551     // To avoid the bool, const std::string& a    551     // To avoid the bool, const std::string& and passing "text" problem.
552     reset();                                      552     reset();
553     m_type = STRING;                              553     m_type = STRING;
554     u.m_string = new std::string(a_value);        554     u.m_string = new std::string(a_value);
555   }                                               555   }
556                                                   556 
557   void set(void* a_value) {                       557   void set(void* a_value) {
558     reset();                                      558     reset();
559     m_type = VOID_STAR;                           559     m_type = VOID_STAR;
560     u.m_void_star = a_value;                      560     u.m_void_star = a_value;
561   }                                               561   }
562                                                   562 
563   void set(double* a_value) {                     563   void set(double* a_value) {
564     reset();                                      564     reset();
565     m_type = DOUBLE_STAR;                         565     m_type = DOUBLE_STAR;
566     u.m_double_star = a_value;                    566     u.m_double_star = a_value;
567   }                                               567   }
568   void set(float* a_value) {                      568   void set(float* a_value) {
569     reset();                                      569     reset();
570     m_type = FLOAT_STAR;                          570     m_type = FLOAT_STAR;
571     u.m_float_star = a_value;                     571     u.m_float_star = a_value;
572   }                                               572   }
573   void set(int* a_value) {                        573   void set(int* a_value) {
574     reset();                                      574     reset();
575     m_type = INT_STAR;                            575     m_type = INT_STAR;
576     u.m_int_star = a_value;                       576     u.m_int_star = a_value;
577   }                                               577   }
578                                                   578 
579   //unsigned char get_unsigned_char() const {r    579   //unsigned char get_unsigned_char() const {return u.m_unsigned_char;}
580   //char get_char() const {return u.m_char;}      580   //char get_char() const {return u.m_char;}
581   unsigned int get_unsigned_int() const {retur    581   unsigned int get_unsigned_int() const {return u.m_unsigned_int;}
582   int get_int() const {return u.m_int;}           582   int get_int() const {return u.m_int;}
583                                                   583 
584   int64 get_int64() const {return u.m_int64;}     584   int64 get_int64() const {return u.m_int64;}
585   uint64 get_unsigned_int64() const {return u.    585   uint64 get_unsigned_int64() const {return u.m_unsigned_int64;}
586                                                   586 
587   unsigned short get_unsigned_short() const{re    587   unsigned short get_unsigned_short() const{return u.m_unsigned_short;}
588   short get_short() const {return u.m_short;}     588   short get_short() const {return u.m_short;}
589   float get_float() const {return u.m_float;}     589   float get_float() const {return u.m_float;}
590   double get_double() const {return u.m_double    590   double get_double() const {return u.m_double;}
591   void* get_void_star() const {return u.m_void    591   void* get_void_star() const {return u.m_void_star;}
592   double* get_double_star() const {return u.m_    592   double* get_double_star() const {return u.m_double_star;}
593   float* get_float_star() const {return u.m_fl    593   float* get_float_star() const {return u.m_float_star;}
594   int* get_int_star() const {return u.m_int_st    594   int* get_int_star() const {return u.m_int_star;}
595   bool get_bool() const {return u.m_bool;}        595   bool get_bool() const {return u.m_bool;}
596                                                   596 
597   const std::string& get_string() const {retur    597   const std::string& get_string() const {return *u.m_string;}
598                                                   598 
599 #define TOOLS_VALUE_SET(a_what,a_m_what,a_type    599 #define TOOLS_VALUE_SET(a_what,a_m_what,a_type) \
600   void set(const std::vector<unsigned int>& a_    600   void set(const std::vector<unsigned int>& a_orders,const std::vector<a_what>& a_v){\
601     reset();\                                     601     reset();\
602     m_type = a_type;\                             602     m_type = a_type;\
603     u.a_m_what = new array<a_what>(a_orders);\    603     u.a_m_what = new array<a_what>(a_orders);\
604     u.a_m_what->fill(a_v);\                       604     u.a_m_what->fill(a_v);\
605   }                                               605   }
606                                                   606 
607 //TOOLS_VALUE_SET(unsigned char,m_array_unsign    607 //TOOLS_VALUE_SET(unsigned char,m_array_unsigned_char,ARRAY_UNSIGNED_CHAR)
608 //TOOLS_VALUE_SET(char,m_array_char,ARRAY_CHAR    608 //TOOLS_VALUE_SET(char,m_array_char,ARRAY_CHAR)
609   TOOLS_VALUE_SET(unsigned short,m_array_unsig    609   TOOLS_VALUE_SET(unsigned short,m_array_unsigned_short,ARRAY_UNSIGNED_SHORT)
610   TOOLS_VALUE_SET(short,m_array_short,ARRAY_SH    610   TOOLS_VALUE_SET(short,m_array_short,ARRAY_SHORT)
611   TOOLS_VALUE_SET(unsigned int,m_array_unsigne    611   TOOLS_VALUE_SET(unsigned int,m_array_unsigned_int,ARRAY_UNSIGNED_INT)
612   TOOLS_VALUE_SET(int,m_array_int,ARRAY_INT)      612   TOOLS_VALUE_SET(int,m_array_int,ARRAY_INT)
613   TOOLS_VALUE_SET(uint64,m_array_unsigned_int6    613   TOOLS_VALUE_SET(uint64,m_array_unsigned_int64,ARRAY_UNSIGNED_INT64)
614   TOOLS_VALUE_SET(int64,m_array_int64,ARRAY_IN    614   TOOLS_VALUE_SET(int64,m_array_int64,ARRAY_INT64)
615   TOOLS_VALUE_SET(float,m_array_float,ARRAY_FL    615   TOOLS_VALUE_SET(float,m_array_float,ARRAY_FLOAT)
616   TOOLS_VALUE_SET(double,m_array_double,ARRAY_    616   TOOLS_VALUE_SET(double,m_array_double,ARRAY_DOUBLE)
617   TOOLS_VALUE_SET(bool,m_array_bool,ARRAY_BOOL    617   TOOLS_VALUE_SET(bool,m_array_bool,ARRAY_BOOL)
618   TOOLS_VALUE_SET(std::string,m_array_string,A    618   TOOLS_VALUE_SET(std::string,m_array_string,ARRAY_STRING)
619                                                   619 
620 #undef TOOLS_VALUE_SET                            620 #undef TOOLS_VALUE_SET
621                                                   621 
622 #define TOOLS_VALUE_SET2(a_what,a_m_what,a_typ    622 #define TOOLS_VALUE_SET2(a_what,a_m_what,a_type) \
623   void set(const std::vector<a_what>& a_v){\      623   void set(const std::vector<a_what>& a_v){\
624     reset();\                                     624     reset();\
625     m_type = a_type;\                             625     m_type = a_type;\
626     std::vector<unsigned int> is(1);\             626     std::vector<unsigned int> is(1);\
627     is[0] = (unsigned int)a_v.size();\            627     is[0] = (unsigned int)a_v.size();\
628     u.a_m_what = new array<a_what>(is);\          628     u.a_m_what = new array<a_what>(is);\
629     u.a_m_what->fill(a_v);\                       629     u.a_m_what->fill(a_v);\
630   }                                               630   }
631                                                   631 
632 //TOOLS_VALUE_SET2(unsigned char,m_array_unsig    632 //TOOLS_VALUE_SET2(unsigned char,m_array_unsigned_char,ARRAY_UNSIGNED_CHAR)
633 //TOOLS_VALUE_SET2(char,m_array_char,ARRAY_CHA    633 //TOOLS_VALUE_SET2(char,m_array_char,ARRAY_CHAR)
634   TOOLS_VALUE_SET2(unsigned short,m_array_unsi    634   TOOLS_VALUE_SET2(unsigned short,m_array_unsigned_short,ARRAY_UNSIGNED_SHORT)
635   TOOLS_VALUE_SET2(short,m_array_short,ARRAY_S    635   TOOLS_VALUE_SET2(short,m_array_short,ARRAY_SHORT)
636   TOOLS_VALUE_SET2(unsigned int,m_array_unsign    636   TOOLS_VALUE_SET2(unsigned int,m_array_unsigned_int,ARRAY_UNSIGNED_INT)
637   TOOLS_VALUE_SET2(int,m_array_int,ARRAY_INT)     637   TOOLS_VALUE_SET2(int,m_array_int,ARRAY_INT)
638   TOOLS_VALUE_SET2(uint64,m_array_unsigned_int    638   TOOLS_VALUE_SET2(uint64,m_array_unsigned_int64,ARRAY_UNSIGNED_INT64)
639   TOOLS_VALUE_SET2(int64,m_array_int64,ARRAY_I    639   TOOLS_VALUE_SET2(int64,m_array_int64,ARRAY_INT64)
640   TOOLS_VALUE_SET2(float,m_array_float,ARRAY_F    640   TOOLS_VALUE_SET2(float,m_array_float,ARRAY_FLOAT)
641   TOOLS_VALUE_SET2(double,m_array_double,ARRAY    641   TOOLS_VALUE_SET2(double,m_array_double,ARRAY_DOUBLE)
642   TOOLS_VALUE_SET2(bool,m_array_bool,ARRAY_BOO    642   TOOLS_VALUE_SET2(bool,m_array_bool,ARRAY_BOOL)
643   TOOLS_VALUE_SET2(std::string,m_array_string,    643   TOOLS_VALUE_SET2(std::string,m_array_string,ARRAY_STRING)
644                                                   644 
645 #undef TOOLS_VALUE_SET2                           645 #undef TOOLS_VALUE_SET2
646                                                   646 
647 #define TOOLS_VALUE_GET(a_what,a_get_what,a_m_    647 #define TOOLS_VALUE_GET(a_what,a_get_what,a_m_what) \
648   const std::vector<a_what>& a_get_what(std::v    648   const std::vector<a_what>& a_get_what(std::vector<unsigned int>& a_orders) const {\
649     a_orders = u.a_m_what->orders();\             649     a_orders = u.a_m_what->orders();\
650     return u.a_m_what->vector();\                 650     return u.a_m_what->vector();\
651   }                                               651   }
652                                                   652 
653 //TOOLS_VALUE_GET(unsigned char,get_array_unsi    653 //TOOLS_VALUE_GET(unsigned char,get_array_unsigned_char,m_array_unsigned_char)
654 //TOOLS_VALUE_GET(char,get_array_char,m_array_    654 //TOOLS_VALUE_GET(char,get_array_char,m_array_char)
655   TOOLS_VALUE_GET(unsigned short,get_array_uns    655   TOOLS_VALUE_GET(unsigned short,get_array_unsigned_short,m_array_unsigned_short)
656   TOOLS_VALUE_GET(short,get_array_short,m_arra    656   TOOLS_VALUE_GET(short,get_array_short,m_array_short)
657   TOOLS_VALUE_GET(unsigned int,get_array_unsig    657   TOOLS_VALUE_GET(unsigned int,get_array_unsigned_int,m_array_unsigned_int)
658   TOOLS_VALUE_GET(int,get_array_int,m_array_in    658   TOOLS_VALUE_GET(int,get_array_int,m_array_int)
659   TOOLS_VALUE_GET(uint64,get_array_unsigned_in    659   TOOLS_VALUE_GET(uint64,get_array_unsigned_int64,m_array_unsigned_int64)
660   TOOLS_VALUE_GET(int64,get_array_int64,m_arra    660   TOOLS_VALUE_GET(int64,get_array_int64,m_array_int64)
661   TOOLS_VALUE_GET(float,get_array_float,m_arra    661   TOOLS_VALUE_GET(float,get_array_float,m_array_float)
662   TOOLS_VALUE_GET(double,get_array_double,m_ar    662   TOOLS_VALUE_GET(double,get_array_double,m_array_double)
663   TOOLS_VALUE_GET(bool,get_array_bool,m_array_    663   TOOLS_VALUE_GET(bool,get_array_bool,m_array_bool)
664   TOOLS_VALUE_GET(std::string,get_array_string    664   TOOLS_VALUE_GET(std::string,get_array_string,m_array_string)
665                                                   665 
666 #undef TOOLS_VALUE_GET                            666 #undef TOOLS_VALUE_GET
667                                                   667 
668                                                   668 
669 public:                                           669 public:
670   bool s_type(std::string& a_s) const {return     670   bool s_type(std::string& a_s) const {return s_type(m_type,a_s);}
671                                                   671 
672   static bool s_type(value::e_type a_type,std:    672   static bool s_type(value::e_type a_type,std::string& a_s){
673     switch(a_type) {                              673     switch(a_type) {
674     case NONE:a_s = "NONE";return true;           674     case NONE:a_s = "NONE";return true;
675     case INT:a_s = "INT";return true;             675     case INT:a_s = "INT";return true;
676     case INT64:a_s = "INT64";return true;         676     case INT64:a_s = "INT64";return true;
677     case DOUBLE:a_s = "DOUBLE";return true;       677     case DOUBLE:a_s = "DOUBLE";return true;
678     case STRING:a_s = "STRING";return true;       678     case STRING:a_s = "STRING";return true;
679     case VOID_STAR:a_s = "VOID_STAR";return tr    679     case VOID_STAR:a_s = "VOID_STAR";return true;
680     case DOUBLE_STAR:a_s = "DOUBLE_STAR";retur    680     case DOUBLE_STAR:a_s = "DOUBLE_STAR";return true;
681     case FLOAT_STAR:a_s = "FLOAT_STAR";return     681     case FLOAT_STAR:a_s = "FLOAT_STAR";return true;
682     case INT_STAR:a_s = "INT_STAR";return true    682     case INT_STAR:a_s = "INT_STAR";return true;
683     case BOOL:a_s = "BOOL";return true;           683     case BOOL:a_s = "BOOL";return true;
684     case SHORT:a_s = "SHORT";return true;         684     case SHORT:a_s = "SHORT";return true;
685     case FLOAT:a_s = "FLOAT";return true;         685     case FLOAT:a_s = "FLOAT";return true;
686     //case CHAR:a_s = "CHAR";return true;         686     //case CHAR:a_s = "CHAR";return true;
687     //case UNSIGNED_CHAR:a_s = "UNSIGNED_CHAR"    687     //case UNSIGNED_CHAR:a_s = "UNSIGNED_CHAR";return true;
688     case UNSIGNED_SHORT:a_s = "UNSIGNED_SHORT"    688     case UNSIGNED_SHORT:a_s = "UNSIGNED_SHORT";return true;
689     case UNSIGNED_INT:a_s = "UNSIGNED_INT";ret    689     case UNSIGNED_INT:a_s = "UNSIGNED_INT";return true;
690     case UNSIGNED_INT64:a_s = "UNSIGNED_INT64"    690     case UNSIGNED_INT64:a_s = "UNSIGNED_INT64";return true;
691     //case ARRAY_UNSIGNED_CHAR:a_s = "ARRAY_UN    691     //case ARRAY_UNSIGNED_CHAR:a_s = "ARRAY_UNSIGNED_CHAR";return true;
692     //case ARRAY_CHAR:a_s = "ARRAY_CHAR";retur    692     //case ARRAY_CHAR:a_s = "ARRAY_CHAR";return true;
693     case ARRAY_UNSIGNED_SHORT:a_s = "ARRAY_UNS    693     case ARRAY_UNSIGNED_SHORT:a_s = "ARRAY_UNSIGNED_SHORT";return true;
694     case ARRAY_SHORT:a_s = "ARRAY_SHORT";retur    694     case ARRAY_SHORT:a_s = "ARRAY_SHORT";return true;
695     case ARRAY_UNSIGNED_INT:a_s = "ARRAY_UNSIG    695     case ARRAY_UNSIGNED_INT:a_s = "ARRAY_UNSIGNED_INT";return true;
696     case ARRAY_INT:a_s = "ARRAY_INT";return tr    696     case ARRAY_INT:a_s = "ARRAY_INT";return true;
697     case ARRAY_UNSIGNED_INT64:a_s = "ARRAY_UNS    697     case ARRAY_UNSIGNED_INT64:a_s = "ARRAY_UNSIGNED_INT64";return true;
698     case ARRAY_INT64:a_s = "ARRAY_INT64";retur    698     case ARRAY_INT64:a_s = "ARRAY_INT64";return true;
699     case ARRAY_FLOAT:a_s = "ARRAY_FLOAT";retur    699     case ARRAY_FLOAT:a_s = "ARRAY_FLOAT";return true;
700     case ARRAY_DOUBLE:a_s = "ARRAY_DOUBLE";ret    700     case ARRAY_DOUBLE:a_s = "ARRAY_DOUBLE";return true;
701     case ARRAY_BOOL:a_s = "ARRAY_BOOL";return     701     case ARRAY_BOOL:a_s = "ARRAY_BOOL";return true;
702     case ARRAY_STRING:a_s = "ARRAY_STRING";ret    702     case ARRAY_STRING:a_s = "ARRAY_STRING";return true;
703     default:a_s.clear();return false;             703     default:a_s.clear();return false;
704     }                                             704     }
705                                                   705 
706   }                                               706   }
707   bool tos(std::string& a_s) const {return tos    707   bool tos(std::string& a_s) const {return tos(*this,a_s);}
708                                                   708 
709   static bool tos(const value& a_v,std::string    709   static bool tos(const value& a_v,std::string& a_s){
710     switch(a_v.m_type) {                          710     switch(a_v.m_type) {
711     case NONE:                                    711     case NONE:
712       sprintf(a_s,5,"(nil)");                     712       sprintf(a_s,5,"(nil)");
713       return true;                                713       return true;
714     case BOOL:                                    714     case BOOL:
715       sprintf(a_s,5,"%s",a_v.u.m_bool?"true":"    715       sprintf(a_s,5,"%s",a_v.u.m_bool?"true":"false");
716       return true;                                716       return true;
717   //case UNSIGNED_CHAR:                           717   //case UNSIGNED_CHAR:
718   //  sprintf(a_s,32,"%c",a_v.u.m_unsigned_cha    718   //  sprintf(a_s,32,"%c",a_v.u.m_unsigned_char);
719   //  return true;                                719   //  return true;
720   //case CHAR:                                    720   //case CHAR:
721   //  sprintf(a_s,32,"%c",a_v.u.m_char);          721   //  sprintf(a_s,32,"%c",a_v.u.m_char);
722   //  return true;                                722   //  return true;
723     case UNSIGNED_SHORT:                          723     case UNSIGNED_SHORT:
724       sprintf(a_s,32,"%u",a_v.u.m_unsigned_sho    724       sprintf(a_s,32,"%u",a_v.u.m_unsigned_short);
725       return true;                                725       return true;
726     case SHORT:                                   726     case SHORT:
727       sprintf(a_s,32,"%d",a_v.u.m_short);         727       sprintf(a_s,32,"%d",a_v.u.m_short);
728       return true;                                728       return true;
729     case UNSIGNED_INT:                            729     case UNSIGNED_INT:
730       sprintf(a_s,32,"%u",a_v.u.m_unsigned_int    730       sprintf(a_s,32,"%u",a_v.u.m_unsigned_int);
731       return true;                                731       return true;
732     case INT:                                     732     case INT:
733       sprintf(a_s,32,"%d",a_v.u.m_int);           733       sprintf(a_s,32,"%d",a_v.u.m_int);
734       return true;                                734       return true;
735     case UNSIGNED_INT64:                          735     case UNSIGNED_INT64:
736       sprintf(a_s,32,int64_format(),a_v.u.m_un    736       sprintf(a_s,32,int64_format(),a_v.u.m_unsigned_int64);
737       return true;                                737       return true;
738     case INT64:                                   738     case INT64:
739       sprintf(a_s,32,int64_format(),a_v.u.m_in    739       sprintf(a_s,32,int64_format(),a_v.u.m_int64);
740       return true;                                740       return true;
741     case FLOAT:                                   741     case FLOAT:
742       sprintf(a_s,32,"%g",a_v.u.m_float);         742       sprintf(a_s,32,"%g",a_v.u.m_float);
743       return true;                                743       return true;
744     case DOUBLE:                                  744     case DOUBLE:
745       sprintf(a_s,32,"%g",a_v.u.m_double);        745       sprintf(a_s,32,"%g",a_v.u.m_double);
746       return true;                                746       return true;
747     case VOID_STAR:                               747     case VOID_STAR:
748       sprintf(a_s,32,upointer_format_x(),(upoi    748       sprintf(a_s,32,upointer_format_x(),(upointer)a_v.u.m_void_star);
749       return true;                                749       return true;
750     case DOUBLE_STAR:                             750     case DOUBLE_STAR:
751       sprintf(a_s,32,upointer_format_x(),(upoi    751       sprintf(a_s,32,upointer_format_x(),(upointer)a_v.u.m_double_star);
752       return true;                                752       return true;
753     case FLOAT_STAR:                              753     case FLOAT_STAR:
754       sprintf(a_s,32,upointer_format_x(),(upoi    754       sprintf(a_s,32,upointer_format_x(),(upointer)a_v.u.m_float_star);
755       return true;                                755       return true;
756     case INT_STAR:                                756     case INT_STAR:
757       sprintf(a_s,32,upointer_format_x(),(upoi    757       sprintf(a_s,32,upointer_format_x(),(upointer)a_v.u.m_int_star);
758       return true;                                758       return true;
759     case STRING:                                  759     case STRING:
760       a_s = *a_v.u.m_string;                      760       a_s = *a_v.u.m_string;
761       return true;                                761       return true;
762                                                   762 
763     //case ARRAY_UNSIGNED_CHAR:                   763     //case ARRAY_UNSIGNED_CHAR:
764     //  a_s = tos<unsigned char>(a_v.u.m_array    764     //  a_s = tos<unsigned char>(a_v.u.m_array_unsigned_char->vector());
765     //  return true;                              765     //  return true;
766     //case ARRAY_CHAR:                            766     //case ARRAY_CHAR:
767     //  a_s = tos<char>(a_v.u.m_array_char->ve    767     //  a_s = tos<char>(a_v.u.m_array_char->vector());
768     //  return true;                              768     //  return true;
769                                                   769 
770     case ARRAY_UNSIGNED_SHORT:                    770     case ARRAY_UNSIGNED_SHORT:
771       return nums2s<unsigned short>(a_v.u.m_ar    771       return nums2s<unsigned short>(a_v.u.m_array_unsigned_short->vector(),a_s);
772     case ARRAY_SHORT:                             772     case ARRAY_SHORT:
773       return nums2s<short>(a_v.u.m_array_short    773       return nums2s<short>(a_v.u.m_array_short->vector(),a_s);
774                                                   774 
775     case ARRAY_UNSIGNED_INT:                      775     case ARRAY_UNSIGNED_INT:
776       return nums2s<unsigned int>(a_v.u.m_arra    776       return nums2s<unsigned int>(a_v.u.m_array_unsigned_int->vector(),a_s);
777     case ARRAY_INT:                               777     case ARRAY_INT:
778       return nums2s<int>(a_v.u.m_array_int->ve    778       return nums2s<int>(a_v.u.m_array_int->vector(),a_s);
779                                                   779 
780     case ARRAY_UNSIGNED_INT64:                    780     case ARRAY_UNSIGNED_INT64:
781       return nums2s<uint64>(a_v.u.m_array_unsi    781       return nums2s<uint64>(a_v.u.m_array_unsigned_int64->vector(),a_s);
782     case ARRAY_INT64:                             782     case ARRAY_INT64:
783       return nums2s<int64>(a_v.u.m_array_int64    783       return nums2s<int64>(a_v.u.m_array_int64->vector(),a_s);
784                                                   784 
785     case ARRAY_FLOAT:                             785     case ARRAY_FLOAT:
786       return nums2s<float>(a_v.u.m_array_float    786       return nums2s<float>(a_v.u.m_array_float->vector(),a_s);
787     case ARRAY_DOUBLE:                            787     case ARRAY_DOUBLE:
788       return nums2s<double>(a_v.u.m_array_doub    788       return nums2s<double>(a_v.u.m_array_double->vector(),a_s);
789     case ARRAY_BOOL:                              789     case ARRAY_BOOL:
790       b2s(a_v.u.m_array_bool->vector(),a_s);      790       b2s(a_v.u.m_array_bool->vector(),a_s);
791       return true;                                791       return true;
792     case ARRAY_STRING:                            792     case ARRAY_STRING:
793       return nums2s<std::string>(a_v.u.m_array    793       return nums2s<std::string>(a_v.u.m_array_string->vector(),a_s);
794     default:                                      794     default:
795       a_s.clear();                                795       a_s.clear();
796       return false;                               796       return false;
797     }                                             797     }
798   }                                               798   }
799                                                   799 
800 /*                                                800 /*
801   size_t header_size() const {return header_si    801   size_t header_size() const {return header_size(*this);} //used in base_evaluator::dump()
802   static size_t header_size(const value& a_v){    802   static size_t header_size(const value& a_v){
803     switch(a_v.m_type) {                          803     switch(a_v.m_type) {
804     case NONE:           return 5;                804     case NONE:           return 5;
805                                                   805 
806     case BOOL:           return 5;                806     case BOOL:           return 5;
807   //case UNSIGNED_CHAR:  return 1;                807   //case UNSIGNED_CHAR:  return 1;
808   //case CHAR:           return 1;                808   //case CHAR:           return 1;
809                                                   809 
810     case INT:                                     810     case INT:
811     case UNSIGNED_SHORT:                          811     case UNSIGNED_SHORT:
812     case SHORT:                                   812     case SHORT:
813     case FLOAT:                                   813     case FLOAT:
814     case UNSIGNED_INT:   return 8;                814     case UNSIGNED_INT:   return 8;
815                                                   815 
816                                                   816 
817     case DOUBLE:                                  817     case DOUBLE:
818     case INT64:                                   818     case INT64:
819     case UNSIGNED_INT64:                          819     case UNSIGNED_INT64:
820     case VOID_STAR:                               820     case VOID_STAR:
821     case DOUBLE_STAR:                             821     case DOUBLE_STAR:
822     case FLOAT_STAR:                              822     case FLOAT_STAR:
823     case INT_STAR:                                823     case INT_STAR:
824     case STRING:         return 12;               824     case STRING:         return 12;
825                                                   825 
826     //case ARRAY_UNSIGNED_CHAR:                   826     //case ARRAY_UNSIGNED_CHAR:
827     //case ARRAY_CHAR:                            827     //case ARRAY_CHAR:
828                                                   828 
829     case ARRAY_UNSIGNED_SHORT:                    829     case ARRAY_UNSIGNED_SHORT:
830     case ARRAY_SHORT:                             830     case ARRAY_SHORT:
831     case ARRAY_UNSIGNED_INT:                      831     case ARRAY_UNSIGNED_INT:
832     case ARRAY_INT:                               832     case ARRAY_INT:
833     case ARRAY_UNSIGNED_INT64:                    833     case ARRAY_UNSIGNED_INT64:
834     case ARRAY_INT64:                             834     case ARRAY_INT64:
835     case ARRAY_FLOAT:                             835     case ARRAY_FLOAT:
836     case ARRAY_DOUBLE:                            836     case ARRAY_DOUBLE:
837     case ARRAY_BOOL:                              837     case ARRAY_BOOL:
838     case ARRAY_STRING:   return 5; //size("arr    838     case ARRAY_STRING:   return 5; //size("array")
839     default: return 8;                            839     default: return 8;
840     }                                             840     }
841   }                                               841   }
842 */                                                842 */
843                                                   843 
844   bool to_double(double& a_d) const {             844   bool to_double(double& a_d) const {
845     switch(m_type) {                              845     switch(m_type) {
846     case INT:                                     846     case INT:
847       a_d = u.m_int;                              847       a_d = u.m_int;
848       return true;                                848       return true;
849     case DOUBLE:                                  849     case DOUBLE:
850       a_d = u.m_double;                           850       a_d = u.m_double;
851       return true;                                851       return true;
852     case UNSIGNED_SHORT:                          852     case UNSIGNED_SHORT:
853       a_d = u.m_unsigned_short;                   853       a_d = u.m_unsigned_short;
854       return true;                                854       return true;
855     case UNSIGNED_INT:                            855     case UNSIGNED_INT:
856       a_d = u.m_unsigned_int;                     856       a_d = u.m_unsigned_int;
857       return true;                                857       return true;
858     case SHORT:                                   858     case SHORT:
859       a_d = u.m_short;                            859       a_d = u.m_short;
860       return true;                                860       return true;
861     case INT64:                                   861     case INT64:
862       a_d = (double)u.m_int64;                    862       a_d = (double)u.m_int64;
863       return true;                                863       return true;
864     case UNSIGNED_INT64:                          864     case UNSIGNED_INT64:
865       a_d = (double)u.m_unsigned_int64;           865       a_d = (double)u.m_unsigned_int64;
866       return true;                                866       return true;
867     case FLOAT:                                   867     case FLOAT:
868       a_d = u.m_float;                            868       a_d = u.m_float;
869       return true;                                869       return true;
870     //case UNSIGNED_CHAR:                         870     //case UNSIGNED_CHAR:
871     //  a_d = u.m_unsigned_char;                  871     //  a_d = u.m_unsigned_char;
872     //  return true;                              872     //  return true;
873     //case CHAR:                                  873     //case CHAR:
874     //  a_d = u.m_char;                           874     //  a_d = u.m_char;
875     //  return true;                              875     //  return true;
876     case BOOL:                                    876     case BOOL:
877       a_d = u.m_bool?1:0;                         877       a_d = u.m_bool?1:0;
878       return true;                                878       return true;
879     case NONE:                                    879     case NONE:
880     case STRING:                                  880     case STRING:
881     case VOID_STAR:                               881     case VOID_STAR:
882     case DOUBLE_STAR:                             882     case DOUBLE_STAR:
883     case FLOAT_STAR:                              883     case FLOAT_STAR:
884     case INT_STAR:                                884     case INT_STAR:
885     //case ARRAY_UNSIGNED_CHAR:                   885     //case ARRAY_UNSIGNED_CHAR:
886     //case ARRAY_CHAR:                            886     //case ARRAY_CHAR:
887     case ARRAY_UNSIGNED_SHORT:                    887     case ARRAY_UNSIGNED_SHORT:
888     case ARRAY_SHORT:                             888     case ARRAY_SHORT:
889     case ARRAY_UNSIGNED_INT:                      889     case ARRAY_UNSIGNED_INT:
890     case ARRAY_INT:                               890     case ARRAY_INT:
891     case ARRAY_UNSIGNED_INT64:                    891     case ARRAY_UNSIGNED_INT64:
892     case ARRAY_INT64:                             892     case ARRAY_INT64:
893     case ARRAY_FLOAT:                             893     case ARRAY_FLOAT:
894     case ARRAY_DOUBLE:                            894     case ARRAY_DOUBLE:
895     case ARRAY_BOOL:                              895     case ARRAY_BOOL:
896     case ARRAY_STRING:                            896     case ARRAY_STRING:
897       break;                                      897       break;
898     }                                             898     }
899     a_d = 0;                                      899     a_d = 0;
900     return false;                                 900     return false;
901   }                                               901   }
902                                                   902 
903   bool is_array() const {                         903   bool is_array() const {
904     switch(m_type) {                              904     switch(m_type) {
905     case INT:                                     905     case INT:
906     case DOUBLE:                                  906     case DOUBLE:
907     case UNSIGNED_SHORT:                          907     case UNSIGNED_SHORT:
908     case UNSIGNED_INT:                            908     case UNSIGNED_INT:
909     case SHORT:                                   909     case SHORT:
910     case INT64:                                   910     case INT64:
911     case UNSIGNED_INT64:                          911     case UNSIGNED_INT64:
912     case FLOAT:                                   912     case FLOAT:
913     //case UNSIGNED_CHAR:                         913     //case UNSIGNED_CHAR:
914     //case CHAR:                                  914     //case CHAR:
915     case BOOL:                                    915     case BOOL:
916     case NONE:                                    916     case NONE:
917     case STRING:                                  917     case STRING:
918     case VOID_STAR:                               918     case VOID_STAR:
919     case DOUBLE_STAR:                             919     case DOUBLE_STAR:
920     case FLOAT_STAR:                              920     case FLOAT_STAR:
921     case INT_STAR:                                921     case INT_STAR:
922       return false;                               922       return false;
923                                                   923 
924     //case ARRAY_UNSIGNED_CHAR:                   924     //case ARRAY_UNSIGNED_CHAR:
925     //case ARRAY_CHAR:                            925     //case ARRAY_CHAR:
926     case ARRAY_UNSIGNED_SHORT:                    926     case ARRAY_UNSIGNED_SHORT:
927     case ARRAY_SHORT:                             927     case ARRAY_SHORT:
928     case ARRAY_UNSIGNED_INT:                      928     case ARRAY_UNSIGNED_INT:
929     case ARRAY_INT:                               929     case ARRAY_INT:
930     case ARRAY_UNSIGNED_INT64:                    930     case ARRAY_UNSIGNED_INT64:
931     case ARRAY_INT64:                             931     case ARRAY_INT64:
932     case ARRAY_FLOAT:                             932     case ARRAY_FLOAT:
933     case ARRAY_DOUBLE:                            933     case ARRAY_DOUBLE:
934     case ARRAY_BOOL:                              934     case ARRAY_BOOL:
935     case ARRAY_STRING:                            935     case ARRAY_STRING:
936       return true;                                936       return true;
937     }                                             937     }
938     return false;                                 938     return false;
939   }                                               939   }
940                                                   940 
941   size_t array_size() const {                     941   size_t array_size() const {
942     switch(m_type) {                              942     switch(m_type) {
943     case INT:                                     943     case INT:
944     case DOUBLE:                                  944     case DOUBLE:
945     case UNSIGNED_SHORT:                          945     case UNSIGNED_SHORT:
946     case UNSIGNED_INT:                            946     case UNSIGNED_INT:
947     case SHORT:                                   947     case SHORT:
948     case INT64:                                   948     case INT64:
949     case UNSIGNED_INT64:                          949     case UNSIGNED_INT64:
950     case FLOAT:                                   950     case FLOAT:
951     //case UNSIGNED_CHAR:                         951     //case UNSIGNED_CHAR:
952     //case CHAR:                                  952     //case CHAR:
953     case BOOL:                                    953     case BOOL:
954     case NONE:                                    954     case NONE:
955     case STRING:                                  955     case STRING:
956     case VOID_STAR:                               956     case VOID_STAR:
957     case DOUBLE_STAR:                             957     case DOUBLE_STAR:
958     case FLOAT_STAR:                              958     case FLOAT_STAR:
959     case INT_STAR:                                959     case INT_STAR:
960       return 0;                                   960       return 0;
961                                                   961 
962     //case ARRAY_UNSIGNED_CHAR:                   962     //case ARRAY_UNSIGNED_CHAR:
963     //case ARRAY_CHAR:                            963     //case ARRAY_CHAR:
964     case ARRAY_UNSIGNED_SHORT:                    964     case ARRAY_UNSIGNED_SHORT:
965       return u.m_array_unsigned_short->size();    965       return u.m_array_unsigned_short->size();
966     case ARRAY_SHORT:                             966     case ARRAY_SHORT:
967       return u.m_array_short->size();             967       return u.m_array_short->size();
968     case ARRAY_UNSIGNED_INT:                      968     case ARRAY_UNSIGNED_INT:
969       return u.m_array_unsigned_int->size();      969       return u.m_array_unsigned_int->size();
970     case ARRAY_INT:                               970     case ARRAY_INT:
971       return u.m_array_int->size();               971       return u.m_array_int->size();
972     case ARRAY_UNSIGNED_INT64:                    972     case ARRAY_UNSIGNED_INT64:
973       return u.m_array_unsigned_int64->size();    973       return u.m_array_unsigned_int64->size();
974     case ARRAY_INT64:                             974     case ARRAY_INT64:
975       return u.m_array_int64->size();             975       return u.m_array_int64->size();
976     case ARRAY_FLOAT:                             976     case ARRAY_FLOAT:
977       return u.m_array_float->size();             977       return u.m_array_float->size();
978     case ARRAY_DOUBLE:                            978     case ARRAY_DOUBLE:
979       return u.m_array_double->size();            979       return u.m_array_double->size();
980     case ARRAY_BOOL:                              980     case ARRAY_BOOL:
981       return u.m_array_bool->size();              981       return u.m_array_bool->size();
982     case ARRAY_STRING:                            982     case ARRAY_STRING:
983       return u.m_array_string->size();            983       return u.m_array_string->size();
984     }                                             984     }
985     return 0;                                     985     return 0;
986   }                                               986   }
987                                                   987 
988 #define TOOLS_ARRAY_VEC(a_what,a_get_what,a_m_    988 #define TOOLS_ARRAY_VEC(a_what,a_get_what,a_m_what) \
989   const std::vector<a_what>& a_get_what() cons    989   const std::vector<a_what>& a_get_what() const {return u.a_m_what->vector();}\
990   std::vector<a_what>& a_get_what() {return u.    990   std::vector<a_what>& a_get_what() {return u.a_m_what->vector();}
991                                                   991 
992 //TOOLS_ARRAY_VEC(unsigned char,array_unsigned    992 //TOOLS_ARRAY_VEC(unsigned char,array_unsigned_char,m_array_unsigned_char)
993 //TOOLS_ARRAY_VEC(char,array_char,m_array_char    993 //TOOLS_ARRAY_VEC(char,array_char,m_array_char)
994   TOOLS_ARRAY_VEC(unsigned short,array_unsigne    994   TOOLS_ARRAY_VEC(unsigned short,array_unsigned_short,m_array_unsigned_short)
995   TOOLS_ARRAY_VEC(short,array_short,m_array_sh    995   TOOLS_ARRAY_VEC(short,array_short,m_array_short)
996   TOOLS_ARRAY_VEC(unsigned int,array_unsigned_    996   TOOLS_ARRAY_VEC(unsigned int,array_unsigned_int,m_array_unsigned_int)
997   TOOLS_ARRAY_VEC(int,array_int,m_array_int)      997   TOOLS_ARRAY_VEC(int,array_int,m_array_int)
998   TOOLS_ARRAY_VEC(uint64,array_unsigned_int64,    998   TOOLS_ARRAY_VEC(uint64,array_unsigned_int64,m_array_unsigned_int64)
999   TOOLS_ARRAY_VEC(int64,array_int64,m_array_in    999   TOOLS_ARRAY_VEC(int64,array_int64,m_array_int64)
1000   TOOLS_ARRAY_VEC(float,array_float,m_array_f    1000   TOOLS_ARRAY_VEC(float,array_float,m_array_float)
1001   TOOLS_ARRAY_VEC(double,array_double,m_array    1001   TOOLS_ARRAY_VEC(double,array_double,m_array_double)
1002   TOOLS_ARRAY_VEC(bool,array_bool,m_array_boo    1002   TOOLS_ARRAY_VEC(bool,array_bool,m_array_bool)
1003   TOOLS_ARRAY_VEC(std::string,array_string,m_    1003   TOOLS_ARRAY_VEC(std::string,array_string,m_array_string)
1004                                                  1004 
1005 #undef TOOLS_ARRAY_VEC                           1005 #undef TOOLS_ARRAY_VEC
1006                                                  1006 
1007 public: // for valop :                           1007 public: // for valop :
1008                                                  1008 
1009   std::string stype() const {                    1009   std::string stype() const {
1010     std::string _s;                              1010     std::string _s;
1011     if(!s_type(_s)) return "unknown";            1011     if(!s_type(_s)) return "unknown";
1012     return _s;                                   1012     return _s;
1013   }                                              1013   }
1014                                                  1014 
1015   static std::string stype(e_type a_type) {      1015   static std::string stype(e_type a_type) {
1016     std::string _s;                              1016     std::string _s;
1017     if(!s_type(a_type,_s)) return "unknown";     1017     if(!s_type(a_type,_s)) return "unknown";
1018     return _s;                                   1018     return _s;
1019   }                                              1019   }
1020                                                  1020 
1021   static std::string error_div_zero() {return    1021   static std::string error_div_zero() {return "divide by zero.";}
1022                                                  1022 
1023   static bool assign(value&,const value&,std:    1023   static bool assign(value&,const value&,std::string&);
1024                                                  1024 
1025   // operations in Expression.cxx :              1025   // operations in Expression.cxx :
1026   static bool minus(value&,std::string&);        1026   static bool minus(value&,std::string&);
1027   static bool do_not(value&,std::string&);       1027   static bool do_not(value&,std::string&);
1028                                                  1028 
1029   static bool add(value&,const value&,std::st    1029   static bool add(value&,const value&,std::string&);
1030   static bool subtract(value&,const value&,st    1030   static bool subtract(value&,const value&,std::string&);
1031   static bool multiply(value&,const value&,st    1031   static bool multiply(value&,const value&,std::string&);
1032   static bool divide(value&,const value&,std:    1032   static bool divide(value&,const value&,std::string&);
1033                                                  1033 
1034   static bool if_gt(value&,const value&,std::    1034   static bool if_gt(value&,const value&,std::string&);
1035   static bool if_eq(value&,const value&,std::    1035   static bool if_eq(value&,const value&,std::string&);
1036                                                  1036 
1037   static bool if_ne(value& aThis,const value&    1037   static bool if_ne(value& aThis,const value& aV,
1038                            std::string& aErro    1038                            std::string& aError) {
1039     if(!if_eq(aThis,aV,aError)) return false;    1039     if(!if_eq(aThis,aV,aError)) return false;
1040     aThis.u.m_bool = (aThis.u.m_bool?false:tr    1040     aThis.u.m_bool = (aThis.u.m_bool?false:true);
1041     return true;                                 1041     return true;
1042   }                                              1042   }
1043   static bool if_ge(value& aThis,const value&    1043   static bool if_ge(value& aThis,const value& aV,
1044                            std::string& aErro    1044                            std::string& aError){
1045     value tmp(aThis);                            1045     value tmp(aThis);
1046     if(!if_eq(aThis,aV,aError)) return false;    1046     if(!if_eq(aThis,aV,aError)) return false;
1047     if(aThis.u.m_bool) return true;              1047     if(aThis.u.m_bool) return true;
1048     // then not equal, check gt :                1048     // then not equal, check gt :
1049     if(!if_gt(tmp,aV,aError)) return false;      1049     if(!if_gt(tmp,aV,aError)) return false;
1050     aThis.u.m_bool = tmp.u.m_bool;               1050     aThis.u.m_bool = tmp.u.m_bool;
1051     return true;                                 1051     return true;
1052   }                                              1052   }
1053                                                  1053 
1054   static bool if_lt(value& aThis,const value&    1054   static bool if_lt(value& aThis,const value& aV,
1055                     std::string& aError){        1055                     std::string& aError){
1056     if(!if_ge(aThis,aV,aError)) return false;    1056     if(!if_ge(aThis,aV,aError)) return false;
1057     aThis.u.m_bool = (aThis.u.m_bool?false:tr    1057     aThis.u.m_bool = (aThis.u.m_bool?false:true);
1058     return true;                                 1058     return true;
1059   }                                              1059   }
1060                                                  1060 
1061   static bool if_le(value& aThis,const value&    1061   static bool if_le(value& aThis,const value& aV,
1062                     std::string& aError){        1062                     std::string& aError){
1063     if(!if_gt(aThis,aV,aError)) return false;    1063     if(!if_gt(aThis,aV,aError)) return false;
1064     aThis.u.m_bool = (aThis.u.m_bool?false:tr    1064     aThis.u.m_bool = (aThis.u.m_bool?false:true);
1065     return true;                                 1065     return true;
1066   }                                              1066   }
1067                                                  1067 
1068   static bool if_and(value&,const value&,std:    1068   static bool if_and(value&,const value&,std::string&);
1069   static bool if_or(value&,const value&,std::    1069   static bool if_or(value&,const value&,std::string&);
1070                                                  1070 
1071   static bool to_double(const value&,double&)    1071   static bool to_double(const value&,double&);
1072   static bool cxx_type(const value&,std::stri    1072   static bool cxx_type(const value&,std::string&);
1073                                                  1073 
1074   //static bool i_set(value&,const Slash::Cor    1074   //static bool i_set(value&,const Slash::Core::Ivalue&);
1075   static std::string to_string(const value&);    1075   static std::string to_string(const value&);
1076                                                  1076 
1077 protected:                                       1077 protected:
1078   void reset() {                                 1078   void reset() {
1079     if(m_type==STRING) {                         1079     if(m_type==STRING) {
1080       delete u.m_string;                         1080       delete u.m_string;
1081       u.m_string = 0;                            1081       u.m_string = 0;
1082                                                  1082 
1083     //} else if(m_type==ARRAY_UNSIGNED_CHAR)     1083     //} else if(m_type==ARRAY_UNSIGNED_CHAR) {
1084     //  delete u.m_array_unsigned_char;u.m_ar    1084     //  delete u.m_array_unsigned_char;u.m_array_unsigned_char = 0;
1085                                                  1085 
1086     //} else if(m_type==ARRAY_CHAR) {            1086     //} else if(m_type==ARRAY_CHAR) {
1087     //  delete u.m_array_char;u.m_array_char     1087     //  delete u.m_array_char;u.m_array_char = 0;
1088                                                  1088 
1089     } else if(m_type==ARRAY_UNSIGNED_SHORT) {    1089     } else if(m_type==ARRAY_UNSIGNED_SHORT) {
1090       delete u.m_array_unsigned_short;u.m_arr    1090       delete u.m_array_unsigned_short;u.m_array_unsigned_short = 0;
1091                                                  1091 
1092     } else if(m_type==ARRAY_SHORT) {             1092     } else if(m_type==ARRAY_SHORT) {
1093       delete u.m_array_short;u.m_array_short     1093       delete u.m_array_short;u.m_array_short = 0;
1094                                                  1094 
1095     } else if(m_type==ARRAY_UNSIGNED_INT) {      1095     } else if(m_type==ARRAY_UNSIGNED_INT) {
1096       delete u.m_array_unsigned_int;u.m_array    1096       delete u.m_array_unsigned_int;u.m_array_unsigned_int = 0;
1097                                                  1097 
1098     } else if(m_type==ARRAY_INT) {               1098     } else if(m_type==ARRAY_INT) {
1099       delete u.m_array_int;u.m_array_int = 0;    1099       delete u.m_array_int;u.m_array_int = 0;
1100                                                  1100 
1101     } else if(m_type==ARRAY_UNSIGNED_INT64) {    1101     } else if(m_type==ARRAY_UNSIGNED_INT64) {
1102       delete u.m_array_unsigned_int64;u.m_arr    1102       delete u.m_array_unsigned_int64;u.m_array_unsigned_int64 = 0;
1103                                                  1103 
1104     } else if(m_type==ARRAY_INT64) {             1104     } else if(m_type==ARRAY_INT64) {
1105       delete u.m_array_int64;u.m_array_int64     1105       delete u.m_array_int64;u.m_array_int64 = 0;
1106                                                  1106 
1107     } else if(m_type==ARRAY_FLOAT) {             1107     } else if(m_type==ARRAY_FLOAT) {
1108       delete u.m_array_float;u.m_array_float     1108       delete u.m_array_float;u.m_array_float = 0;
1109                                                  1109 
1110     } else if(m_type==ARRAY_DOUBLE) {            1110     } else if(m_type==ARRAY_DOUBLE) {
1111       delete u.m_array_double;u.m_array_doubl    1111       delete u.m_array_double;u.m_array_double = 0;
1112                                                  1112 
1113     } else if(m_type==ARRAY_BOOL) {              1113     } else if(m_type==ARRAY_BOOL) {
1114       delete u.m_array_bool;u.m_array_bool =     1114       delete u.m_array_bool;u.m_array_bool = 0;
1115                                                  1115 
1116     } else if(m_type==ARRAY_STRING) {            1116     } else if(m_type==ARRAY_STRING) {
1117       delete u.m_array_string;u.m_array_strin    1117       delete u.m_array_string;u.m_array_string = 0;
1118                                                  1118 
1119     } else {                                     1119     } else {
1120       u.m_unsigned_int64 = 0;                    1120       u.m_unsigned_int64 = 0;
1121     }                                            1121     }
1122   }                                              1122   }
1123 protected:                                       1123 protected:
1124   std::string* m_label;                          1124   std::string* m_label;
1125   unsigned int m_itag;                           1125   unsigned int m_itag;
1126 protected:                                       1126 protected:
1127   e_type m_type;                                 1127   e_type m_type;
1128   union {                                        1128   union {
1129     bool m_bool;                                 1129     bool m_bool;
1130     //char m_char;                               1130     //char m_char;
1131     int m_int;                                   1131     int m_int;
1132     short m_short;                               1132     short m_short;
1133     int64 m_int64;                               1133     int64 m_int64;
1134     float m_float;                               1134     float m_float;
1135     double m_double;                             1135     double m_double;
1136     //unsigned char m_unsigned_char;             1136     //unsigned char m_unsigned_char;
1137     unsigned short m_unsigned_short;             1137     unsigned short m_unsigned_short;
1138     unsigned int m_unsigned_int;                 1138     unsigned int m_unsigned_int;
1139     uint64 m_unsigned_int64;                     1139     uint64 m_unsigned_int64;
1140     void* m_void_star;                           1140     void* m_void_star;
1141     double* m_double_star;                       1141     double* m_double_star;
1142     float* m_float_star;                         1142     float* m_float_star;
1143     int* m_int_star;                             1143     int* m_int_star;
1144     std::string* m_string;                       1144     std::string* m_string;
1145                                                  1145 
1146     array<unsigned char>* m_array_unsigned_ch    1146     array<unsigned char>* m_array_unsigned_char;
1147     array<char>* m_array_char;                   1147     array<char>* m_array_char;
1148     array<unsigned short>* m_array_unsigned_s    1148     array<unsigned short>* m_array_unsigned_short;
1149     array<short>* m_array_short;                 1149     array<short>* m_array_short;
1150     array<uint64>* m_array_unsigned_int64;       1150     array<uint64>* m_array_unsigned_int64;
1151     array<int64>* m_array_int64;                 1151     array<int64>* m_array_int64;
1152     array<unsigned int>* m_array_unsigned_int    1152     array<unsigned int>* m_array_unsigned_int;
1153     array<int>* m_array_int;                     1153     array<int>* m_array_int;
1154     array<float>* m_array_float;                 1154     array<float>* m_array_float;
1155     array<double>* m_array_double;               1155     array<double>* m_array_double;
1156     array<bool>* m_array_bool;                   1156     array<bool>* m_array_bool;
1157     array<std::string>* m_array_string;          1157     array<std::string>* m_array_string;
1158   } u;                                           1158   } u;
1159 };                                               1159 };
1160                                                  1160 
1161 }                                                1161 }
1162                                                  1162 
1163 #include "value.icc"                             1163 #include "value.icc"
1164                                                  1164 
1165 #endif                                           1165 #endif