Geant4  10.01.p02
value.icc
Go to the documentation of this file.
1 
2 #include "sto"
3 
4 namespace tools {
5 
6 inline bool value::assign(value& aThis,const value& aV,std::string& aError){
7  if(aThis.m_type==aV.m_type) {
8  aThis.reset();
9  if(aV.m_type==value::STRING) {
10  aThis.u.m_string = new std::string(*aV.u.m_string);
11 
12  //} else if(aV.m_type==value::ARRAY_UNSIGNED_CHAR) {
13  // aThis.u.m_array_unsigned_char =
14  // new tools::array<unsigned char>(*aV.u.m_array_unsigned_char);
15  //} else if(aV.m_type==value::ARRAY_CHAR) {
16  // aThis.u.m_array_char = new tools::array<char>(*aV.u.m_array_char);
17 
18  } else if(aV.m_type==value::ARRAY_UNSIGNED_SHORT) {
19  aThis.u.m_array_unsigned_short =
20  new tools::array<unsigned short>(*aV.u.m_array_unsigned_short);
21  } else if(aV.m_type==value::ARRAY_SHORT) {
22  aThis.u.m_array_short = new tools::array<short>(*aV.u.m_array_short);
23 
24  } else if(aV.m_type==value::ARRAY_UNSIGNED_INT) {
25  aThis.u.m_array_unsigned_int =
26  new tools::array<unsigned int>(*aV.u.m_array_unsigned_int);
27  } else if(aV.m_type==value::ARRAY_INT) {
28  aThis.u.m_array_int = new tools::array<int>(*aV.u.m_array_int);
29 
30  } else if(aV.m_type==value::ARRAY_UNSIGNED_INT64) {
31  aThis.u.m_array_unsigned_int64 =
32  new tools::array<uint64>(*aV.u.m_array_unsigned_int64);
33  } else if(aV.m_type==value::ARRAY_INT64) {
34  aThis.u.m_array_int64 =
35  new tools::array<int64>(*aV.u.m_array_int64);
36 
37  } else if(aV.m_type==value::ARRAY_FLOAT) {
38  aThis.u.m_array_float = new tools::array<float>(*aV.u.m_array_float);
39  } else if(aV.m_type==value::ARRAY_DOUBLE) {
40  aThis.u.m_array_double = new tools::array<double>(*aV.u.m_array_double);
41  } else if(aV.m_type==value::ARRAY_BOOL) {
42  aThis.u.m_array_bool = new tools::array<bool>(*aV.u.m_array_bool);
43 
44  } else if(aV.m_type==value::ARRAY_STRING) {
45  aThis.u.m_array_string =
46  new tools::array<std::string>(*aV.u.m_array_string);
47 
48  } else {
49  aThis.u = aV.u;
50  }
51  return true;
52  } else {
53  switch(aThis.m_type) {
54  case value::INT:
55  break;
56  case value::DOUBLE:
57  switch(aV.m_type) {
58  case value::INT:
59  aThis.u.m_double = aV.u.m_int;
60  return true;
61  case value::UNSIGNED_SHORT :
62  aThis.u.m_double = aV.u.m_unsigned_short;
63  return true;
64  case value::UNSIGNED_INT:
65  aThis.u.m_double = aV.u.m_unsigned_int;
66  return true;
67  case value::NONE:
68  case value::DOUBLE:
69  case value::VOID_STAR:
70  case value::BOOL:
71  case value::SHORT:
72  case value::INT64:
73  case value::FLOAT:
74  //case value::UNSIGNED_CHAR:
75  //case value::CHAR:
76  case value::UNSIGNED_INT64 :
77  case value::DOUBLE_STAR:
78  case value::FLOAT_STAR:
79  case value::INT_STAR:
80  case value::STRING:
81  //case value::ARRAY_UNSIGNED_CHAR:
82  //case value::ARRAY_CHAR:
83  case value::ARRAY_UNSIGNED_SHORT:
84  case value::ARRAY_SHORT:
85  case value::ARRAY_UNSIGNED_INT:
86  case value::ARRAY_INT:
87  case value::ARRAY_UNSIGNED_INT64:
88  case value::ARRAY_INT64:
89  case value::ARRAY_FLOAT:
90  case value::ARRAY_DOUBLE:
91  case value::ARRAY_BOOL:
92  case value::ARRAY_STRING:
93  break;
94  }
95  break;
96  case value::STRING:
97  break;
98  case value::VOID_STAR:
99  break;
100  case value::UNSIGNED_INT:
101  break;
102  case value::BOOL:
103  break;
104  case value::SHORT:
105  switch(aV.m_type) {
106  case value::INT:
107  aThis.u.m_short = (short)aV.u.m_int;
108  return true;
109  case value::NONE:
110  case value::DOUBLE:
111  case value::VOID_STAR:
112  case value::BOOL:
113  case value::SHORT:
114  case value::INT64:
115  case value::FLOAT:
116  //case value::UNSIGNED_CHAR:
117  //case value::CHAR:
118  case value::UNSIGNED_SHORT :
119  case value::UNSIGNED_INT:
120  case value::UNSIGNED_INT64 :
121  case value::DOUBLE_STAR:
122  case value::FLOAT_STAR:
123  case value::INT_STAR:
124  case value::STRING:
125  //case value::ARRAY_UNSIGNED_CHAR:
126  //case value::ARRAY_CHAR:
127  case value::ARRAY_UNSIGNED_SHORT:
128  case value::ARRAY_SHORT:
129  case value::ARRAY_UNSIGNED_INT:
130  case value::ARRAY_INT:
131  case value::ARRAY_UNSIGNED_INT64:
132  case value::ARRAY_INT64:
133  case value::ARRAY_FLOAT:
134  case value::ARRAY_DOUBLE:
135  case value::ARRAY_BOOL:
136  case value::ARRAY_STRING:
137  break;
138  }
139  break;
140  case value::FLOAT:
141  switch(aV.m_type) {
142  case value::INT:
143  aThis.u.m_float = (float)aV.u.m_int;
144  return true;
145  case value::DOUBLE:
146  aThis.u.m_float = (float)aV.u.m_double;
147  return true;
148  case value::NONE:
149  case value::VOID_STAR:
150  case value::BOOL:
151  case value::SHORT:
152  case value::INT64:
153  case value::FLOAT:
154  //case value::UNSIGNED_CHAR:
155  //case value::CHAR:
156  case value::UNSIGNED_SHORT :
157  case value::UNSIGNED_INT:
158  case value::UNSIGNED_INT64 :
159  case value::DOUBLE_STAR:
160  case value::FLOAT_STAR:
161  case value::INT_STAR:
162  case value::STRING:
163  //case value::ARRAY_UNSIGNED_CHAR:
164  //case value::ARRAY_CHAR:
165  case value::ARRAY_UNSIGNED_SHORT:
166  case value::ARRAY_SHORT:
167  case value::ARRAY_UNSIGNED_INT:
168  case value::ARRAY_INT:
169  case value::ARRAY_UNSIGNED_INT64:
170  case value::ARRAY_INT64:
171  case value::ARRAY_FLOAT:
172  case value::ARRAY_DOUBLE:
173  case value::ARRAY_BOOL:
174  case value::ARRAY_STRING:
175  break;
176  }
177  break;
178 /*
179  case value::UNSIGNED_CHAR:
180  switch(aV.m_type) {
181  case value::INT:
182  aThis.u.m_unsigned_char = (unsigned char)aV.u.m_int;
183  return true;
184  case value::NONE:
185  case value::DOUBLE:
186  case value::VOID_STAR:
187  case value::BOOL:
188  case value::SHORT:
189  case value::INT64:
190  case value::FLOAT:
191  case value::UNSIGNED_CHAR:
192  case value::CHAR:
193  case value::UNSIGNED_SHORT :
194  case value::UNSIGNED_INT:
195  case value::UNSIGNED_INT64 :
196  case value::DOUBLE_STAR:
197  case value::FLOAT_STAR:
198  case value::INT_STAR:
199  case value::STRING:
200  case value::ARRAY_UNSIGNED_CHAR:
201  case value::ARRAY_CHAR:
202  case value::ARRAY_UNSIGNED_SHORT:
203  case value::ARRAY_SHORT:
204  case value::ARRAY_UNSIGNED_INT:
205  case value::ARRAY_INT:
206  case value::ARRAY_UNSIGNED_INT64:
207  case value::ARRAY_INT64:
208  case value::ARRAY_FLOAT:
209  case value::ARRAY_DOUBLE:
210  case value::ARRAY_BOOL:
211  case value::ARRAY_STRING:
212  break;
213  }
214  break;
215  case value::CHAR:
216  switch(aV.m_type) {
217  case value::INT:
218  aThis.u.m_char = (char)aV.u.m_int;
219  return true;
220  case value::STRING:
221  if(aV.u.m_string->size()!=1) break;
222  aThis.u.m_char = (*aV.u.m_string)[0];
223  return true;
224  case value::NONE:
225  case value::DOUBLE:
226  case value::VOID_STAR:
227  case value::BOOL:
228  case value::SHORT:
229  case value::INT64:
230  case value::FLOAT:
231  case value::UNSIGNED_CHAR:
232  case value::CHAR:
233  case value::UNSIGNED_SHORT :
234  case value::UNSIGNED_INT:
235  case value::UNSIGNED_INT64 :
236  case value::DOUBLE_STAR:
237  case value::FLOAT_STAR:
238  case value::INT_STAR:
239  case value::ARRAY_UNSIGNED_CHAR:
240  case value::ARRAY_CHAR:
241  case value::ARRAY_UNSIGNED_SHORT:
242  case value::ARRAY_SHORT:
243  case value::ARRAY_UNSIGNED_INT:
244  case value::ARRAY_INT:
245  case value::ARRAY_UNSIGNED_INT64:
246  case value::ARRAY_INT64:
247  case value::ARRAY_FLOAT:
248  case value::ARRAY_DOUBLE:
249  case value::ARRAY_BOOL:
250  case value::ARRAY_STRING:
251  break;
252  }
253  break;
254 */
255  case value::NONE:
256  case value::INT64:
257  case value::UNSIGNED_SHORT :
258  case value::UNSIGNED_INT64 :
259  switch(aV.m_type) {
260  case value::INT:
261  aThis.u.m_int64 = aV.u.m_int;
262  return true;
263  case value::UNSIGNED_SHORT :
264  aThis.u.m_int64 = aV.u.m_unsigned_short;
265  return true;
266  case value::UNSIGNED_INT:
267  aThis.u.m_int64 = aV.u.m_unsigned_int;
268  return true;
269  case value::NONE:
270  case value::DOUBLE:
271  case value::VOID_STAR:
272  case value::BOOL:
273  case value::SHORT:
274  case value::INT64:
275  case value::FLOAT:
276  //case value::UNSIGNED_CHAR:
277  //case value::CHAR:
278  case value::UNSIGNED_INT64 :
279  case value::DOUBLE_STAR:
280  case value::FLOAT_STAR:
281  case value::INT_STAR:
282  case value::STRING:
283  //case value::ARRAY_UNSIGNED_CHAR:
284  //case value::ARRAY_CHAR:
285  case value::ARRAY_UNSIGNED_SHORT:
286  case value::ARRAY_SHORT:
287  case value::ARRAY_UNSIGNED_INT:
288  case value::ARRAY_INT:
289  case value::ARRAY_UNSIGNED_INT64:
290  case value::ARRAY_INT64:
291  case value::ARRAY_FLOAT:
292  case value::ARRAY_DOUBLE:
293  case value::ARRAY_BOOL:
294  case value::ARRAY_STRING:
295  break;
296  }
297  break;
298  case value::DOUBLE_STAR:
299  case value::FLOAT_STAR:
300  case value::INT_STAR:
301  //case value::ARRAY_UNSIGNED_CHAR:
302  //case value::ARRAY_CHAR:
303  case value::ARRAY_UNSIGNED_SHORT:
304  case value::ARRAY_SHORT:
305  case value::ARRAY_UNSIGNED_INT:
306  case value::ARRAY_INT:
307  case value::ARRAY_UNSIGNED_INT64:
308  case value::ARRAY_INT64:
309  case value::ARRAY_FLOAT:
310  case value::ARRAY_DOUBLE:
311  case value::ARRAY_BOOL:
312  case value::ARRAY_STRING:
313  break;
314  }
315  aError = std::string("value::assign :")
316  + " unable to assign " + aV.stype()
317  + " to " + aThis.stype();
318  aThis.set_none();
319  return false;
320  }
321 }
322 
323 inline bool value::minus(value& aThis,std::string& aError){
324  value::e_type oType = aThis.m_type;
325  switch(aThis.m_type) {
326  case value::INT:
327  aThis.u.m_int = -aThis.u.m_int;
328  return true;
329  case value::DOUBLE:
330  aThis.u.m_double = -aThis.u.m_double;
331  return true;
332  case value::SHORT:
333  aThis.u.m_short = -aThis.u.m_short;
334  return true;
335  case value::INT64:
336  aThis.u.m_int64 = -aThis.u.m_int64;
337  return true;
338  case value::FLOAT:
339  aThis.u.m_float = -1.0F * aThis.u.m_float;
340  return true;
341  case value::ARRAY_DOUBLE:{
342  std::vector<double>& stdv = aThis.u.m_array_double->vector();
343  unsigned int number = stdv.size();
344  for(unsigned int index=0;index<number;index++) stdv[index] = -stdv[index];
345  return true;}
346  //case value::CHAR:
347  // aThis.u.m_char = -aThis.u.m_char;
348  // return true;
349  //case value::UNSIGNED_CHAR:{
350  // char tmp = -1*aThis.u.m_unsigned_char;
351  // aThis.set(tmp); //this becomes a value::CHAR.
352  // return true;}
353  case value::UNSIGNED_SHORT:{
354  short tmp = -1*aThis.u.m_unsigned_short;
355  aThis.set(tmp); //this becomes a value::SHORT.
356  return true;}
357  case value::UNSIGNED_INT:{
358  int tmp = -1*aThis.u.m_unsigned_int;
359  aThis.set(tmp); //this becomes a value::INT.
360  return true;}
361  case value::UNSIGNED_INT64 :{
362  int64 tmp = -1*aThis.u.m_unsigned_int64;
363  aThis.set(tmp); //this becomes a value::INT64.
364  return true;}
365  case value::BOOL:
366  case value::NONE:
367  case value::STRING:
368  case value::VOID_STAR:
369  case value::DOUBLE_STAR:
370  case value::FLOAT_STAR:
371  case value::INT_STAR:
372  //case value::ARRAY_UNSIGNED_CHAR:
373  //case value::ARRAY_CHAR:
374  case value::ARRAY_UNSIGNED_SHORT:
375  case value::ARRAY_SHORT:
376  case value::ARRAY_UNSIGNED_INT:
377  case value::ARRAY_INT:
378  case value::ARRAY_UNSIGNED_INT64:
379  case value::ARRAY_INT64:
380  case value::ARRAY_FLOAT:
381  //case value::ARRAY_DOUBLE:
382  case value::ARRAY_BOOL:
383  case value::ARRAY_STRING:
384  break;
385  }
386  aError = std::string("value::minus :")
387  + " can't apply on type " + value::stype(oType);
388  aThis.set_none();
389  return false;
390 }
391 
392 inline bool value::do_not(value& aThis,std::string& aError){
393  value::e_type oType = aThis.m_type;
394  switch(aThis.m_type) {
395  case value::BOOL:
396  aThis.u.m_bool = aThis.u.m_bool?false:true;
397  return true;
398  case value::INT:
399  case value::DOUBLE:
400  case value::STRING:
401  case value::VOID_STAR:
402  case value::UNSIGNED_SHORT :
403  case value::UNSIGNED_INT:
404  case value::SHORT:
405  case value::FLOAT:
406  //case value::UNSIGNED_CHAR:
407  //case value::CHAR:
408  case value::NONE:
409  case value::INT64:
410  case value::UNSIGNED_INT64 :
411  case value::DOUBLE_STAR:
412  case value::FLOAT_STAR:
413  case value::INT_STAR:
414  //case value::ARRAY_UNSIGNED_CHAR:
415  //case value::ARRAY_CHAR:
416  case value::ARRAY_UNSIGNED_SHORT:
417  case value::ARRAY_SHORT:
418  case value::ARRAY_UNSIGNED_INT:
419  case value::ARRAY_INT:
420  case value::ARRAY_UNSIGNED_INT64:
421  case value::ARRAY_INT64:
422  case value::ARRAY_FLOAT:
423  case value::ARRAY_DOUBLE:
424  case value::ARRAY_BOOL:
425  case value::ARRAY_STRING:
426  break;
427  }
428  aError = std::string("value::do_not :")
429  + " can't apply on type " + value::stype(oType);
430  aThis.set_none();
431  return false;
432 }
433 
434 //////////////////////////////////////////////////////////////////////////////
435 //////////////////////////////////////////////////////////////////////////////
436 //////////////////////////////////////////////////////////////////////////////
437 
438 inline bool value::add(value& aThis,const value& aV,std::string& aError){
439  value::e_type oType = aThis.m_type;
440  switch(aThis.m_type) {
441  case value::INT:
442  switch(aV.m_type) {
443  case value::INT:
444  aThis.u.m_int += aV.u.m_int;
445  return true;
446  case value::FLOAT:{
447  float tmp = aThis.u.m_int + aV.u.m_float;
448  aThis.set(tmp);
449  return true;}
450  case value::DOUBLE:{
451  double tmp = aThis.u.m_int + aV.u.m_double;
452  aThis.set(tmp);
453  return true;}
454  case value::ARRAY_DOUBLE:{
455  int tmp = aThis.u.m_int;
456  //In the below, this becomes a value::ARRAY_DOUBLE.
457  aThis.set(aV.u.m_array_double->orders(),
458  aV.u.m_array_double->vector());
459  aThis.u.m_array_double->add(double(tmp));
460  return true;}
461  case value::NONE:
462  case value::STRING:
463  case value::VOID_STAR:
464  case value::BOOL:
465  case value::SHORT:
466  case value::INT64:
467  //case value::UNSIGNED_CHAR:
468  //case value::CHAR:
469  case value::UNSIGNED_SHORT :
470  case value::UNSIGNED_INT64 :
471  case value::DOUBLE_STAR:
472  case value::FLOAT_STAR:
473  case value::INT_STAR:
474  case value::UNSIGNED_INT:
475  //case value::ARRAY_UNSIGNED_CHAR:
476  //case value::ARRAY_CHAR:
477  case value::ARRAY_UNSIGNED_SHORT:
478  case value::ARRAY_SHORT:
479  case value::ARRAY_UNSIGNED_INT:
480  case value::ARRAY_INT:
481  case value::ARRAY_UNSIGNED_INT64:
482  case value::ARRAY_INT64:
483  case value::ARRAY_FLOAT:
484  //case value::ARRAY_DOUBLE:
485  case value::ARRAY_BOOL:
486  case value::ARRAY_STRING:
487  break;
488  }
489  break;
490  case value::FLOAT:
491  switch(aV.m_type) {
492  case value::UNSIGNED_SHORT :
493  aThis.u.m_float += aV.u.m_unsigned_short;
494  return true;
495  case value::UNSIGNED_INT:
496  aThis.u.m_float += aV.u.m_unsigned_int;
497  return true;
498  case value::SHORT:
499  aThis.u.m_float += aV.u.m_short;
500  return true;
501  case value::INT:
502  aThis.u.m_float += aV.u.m_int;
503  return true;
504  case value::FLOAT:
505  aThis.u.m_float += aV.u.m_float;
506  return true;
507  case value::DOUBLE:
508  aThis.u.m_float += (float)aV.u.m_double;
509  return true;
510  case value::ARRAY_DOUBLE:{
511  double tmp = aThis.u.m_float;
512  //In the below this becomes a value::ARRAY_DOUBLE.
513  aThis.set(aV.u.m_array_double->orders(),
514  aV.u.m_array_double->vector());
515  aThis.u.m_array_double->add(tmp);
516  return true;}
517  case value::NONE:
518  case value::STRING:
519  case value::VOID_STAR:
520  case value::BOOL:
521  case value::INT64:
522  //case value::UNSIGNED_CHAR:
523  //case value::CHAR:
524  case value::UNSIGNED_INT64 :
525  case value::DOUBLE_STAR:
526  case value::FLOAT_STAR:
527  case value::INT_STAR:
528  //case value::ARRAY_UNSIGNED_CHAR:
529  //case value::ARRAY_CHAR:
530  case value::ARRAY_UNSIGNED_SHORT:
531  case value::ARRAY_SHORT:
532  case value::ARRAY_UNSIGNED_INT:
533  case value::ARRAY_INT:
534  case value::ARRAY_UNSIGNED_INT64:
535  case value::ARRAY_INT64:
536  case value::ARRAY_FLOAT:
537  //case value::ARRAY_DOUBLE:
538  case value::ARRAY_BOOL:
539  case value::ARRAY_STRING:
540  break;
541  }
542  break;
543  case value::DOUBLE:
544  switch(aV.m_type) {
545  case value::SHORT:
546  aThis.u.m_double += aV.u.m_short;
547  return true;
548  case value::INT:
549  aThis.u.m_double += aV.u.m_int;
550  return true;
551  case value::FLOAT:
552  aThis.u.m_double += aV.u.m_float;
553  return true;
554  case value::DOUBLE:
555  aThis.u.m_double += aV.u.m_double;
556  return true;
557  case value::UNSIGNED_SHORT :
558  aThis.u.m_double += aV.u.m_unsigned_short;
559  return true;
560  case value::UNSIGNED_INT:
561  aThis.u.m_double += aV.u.m_unsigned_int;
562  return true;
563  case value::ARRAY_DOUBLE:{
564  double tmp = aThis.u.m_double;
565  //In the below this becomes a value::ARRAY_DOUBLE.
566  aThis.set(aV.u.m_array_double->orders(),
567  aV.u.m_array_double->vector());
568  aThis.u.m_array_double->add(tmp);
569  return true;}
570  case value::NONE:
571  case value::STRING:
572  case value::VOID_STAR:
573  case value::BOOL:
574  case value::INT64:
575  //case value::UNSIGNED_CHAR:
576  //case value::CHAR:
577  case value::UNSIGNED_INT64 :
578  case value::DOUBLE_STAR:
579  case value::FLOAT_STAR:
580  case value::INT_STAR:
581  //case value::ARRAY_UNSIGNED_CHAR:
582  //case value::ARRAY_CHAR:
583  case value::ARRAY_UNSIGNED_SHORT:
584  case value::ARRAY_SHORT:
585  case value::ARRAY_UNSIGNED_INT:
586  case value::ARRAY_INT:
587  case value::ARRAY_UNSIGNED_INT64:
588  case value::ARRAY_INT64:
589  case value::ARRAY_FLOAT:
590  //case value::ARRAY_DOUBLE:
591  case value::ARRAY_BOOL:
592  case value::ARRAY_STRING:
593  break;
594  }
595  break;
596  case value::UNSIGNED_INT:
597  switch(aV.m_type) {
598  case value::UNSIGNED_INT:
599  aThis.u.m_unsigned_int += aV.u.m_unsigned_int;
600  return true;
601  case value::INT:{
602  int tmp = aThis.u.m_unsigned_int + aV.u.m_int;
603  aThis.set(tmp);
604  return true;}
605  case value::FLOAT:{
606  float tmp = float(aThis.u.m_unsigned_int) + aV.u.m_float;
607  aThis.set(tmp);
608  return true;}
609  case value::DOUBLE:{
610  double tmp = double(aThis.u.m_unsigned_int) + aV.u.m_double;
611  aThis.set(tmp);
612  return true;}
613  case value::ARRAY_DOUBLE:{
614  unsigned int tmp = aThis.u.m_unsigned_int;
615  //In the below this becomes a value::ARRAY_DOUBLE.
616  aThis.set(aV.u.m_array_double->orders(),
617  aV.u.m_array_double->vector());
618  aThis.u.m_array_double->add(double(tmp));
619  return true;}
620  case value::NONE:
621  case value::STRING:
622  case value::VOID_STAR:
623  case value::BOOL:
624  case value::SHORT:
625  case value::INT64:
626  //case value::UNSIGNED_CHAR:
627  //case value::CHAR:
628  case value::UNSIGNED_SHORT :
629  case value::UNSIGNED_INT64 :
630  case value::DOUBLE_STAR:
631  case value::FLOAT_STAR:
632  case value::INT_STAR:
633  //case value::ARRAY_UNSIGNED_CHAR:
634  //case value::ARRAY_CHAR:
635  case value::ARRAY_UNSIGNED_SHORT:
636  case value::ARRAY_SHORT:
637  case value::ARRAY_UNSIGNED_INT:
638  case value::ARRAY_INT:
639  case value::ARRAY_UNSIGNED_INT64:
640  case value::ARRAY_INT64:
641  case value::ARRAY_FLOAT:
642  //case value::ARRAY_DOUBLE:
643  case value::ARRAY_BOOL:
644  case value::ARRAY_STRING:
645  break;
646  }
647  break;
648  case value::STRING:
649  switch(aV.m_type) {
650  case value::STRING:
651  aThis.set((*aThis.u.m_string)+(*aV.u.m_string));
652  return true;
653  case value::NONE:
654  case value::INT:
655  case value::DOUBLE:
656  case value::VOID_STAR:
657  case value::BOOL:
658  case value::SHORT:
659  case value::INT64:
660  case value::FLOAT:
661  //case value::UNSIGNED_CHAR:
662  //case value::CHAR:
663  case value::UNSIGNED_SHORT :
664  case value::UNSIGNED_INT:
665  case value::UNSIGNED_INT64 :
666  case value::DOUBLE_STAR:
667  case value::FLOAT_STAR:
668  case value::INT_STAR:
669  //case value::ARRAY_UNSIGNED_CHAR:
670  //case value::ARRAY_CHAR:
671  case value::ARRAY_UNSIGNED_SHORT:
672  case value::ARRAY_SHORT:
673  case value::ARRAY_UNSIGNED_INT:
674  case value::ARRAY_INT:
675  case value::ARRAY_UNSIGNED_INT64:
676  case value::ARRAY_INT64:
677  case value::ARRAY_FLOAT:
678  case value::ARRAY_DOUBLE:
679  case value::ARRAY_BOOL:
680  case value::ARRAY_STRING:
681  break;
682  }
683  break;
684  case value::ARRAY_DOUBLE:
685  switch(aV.m_type) {
686  case value::INT:
687  aThis.u.m_array_double->add(aV.u.m_int);
688  return true;
689  case value::UNSIGNED_INT:
690  aThis.u.m_array_double->add(aV.u.m_unsigned_int);
691  return true;
692  case value::DOUBLE:
693  aThis.u.m_array_double->add(aV.u.m_double);
694  return true;
695  case value::ARRAY_DOUBLE:
696  if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) {
697  aError = "Value::add : vector orders mismatch.";
698  aThis.set_none();
699  return false;
700  }
701  aThis.u.m_array_double->add(*aV.u.m_array_double);
702  return true;
703  case value::NONE:
704  case value::VOID_STAR:
705  case value::BOOL:
706  case value::SHORT:
707  case value::INT64:
708  case value::FLOAT:
709  //case value::UNSIGNED_CHAR:
710  //case value::CHAR:
711  case value::UNSIGNED_SHORT :
712  case value::UNSIGNED_INT64 :
713  case value::DOUBLE_STAR:
714  case value::FLOAT_STAR:
715  case value::INT_STAR:
716  case value::STRING:
717  //case value::ARRAY_UNSIGNED_CHAR:
718  //case value::ARRAY_CHAR:
719  case value::ARRAY_UNSIGNED_SHORT:
720  case value::ARRAY_SHORT:
721  case value::ARRAY_UNSIGNED_INT:
722  case value::ARRAY_INT:
723  case value::ARRAY_UNSIGNED_INT64:
724  case value::ARRAY_INT64:
725  case value::ARRAY_FLOAT:
726  //case value::ARRAY_DOUBLE:
727  case value::ARRAY_BOOL:
728  case value::ARRAY_STRING:
729  break;
730  }
731  break;
732  case value::NONE:
733  case value::VOID_STAR:
734  case value::BOOL:
735  case value::SHORT:
736  case value::INT64:
737  //case value::UNSIGNED_CHAR:
738  //case value::CHAR:
739  case value::UNSIGNED_SHORT :
740  case value::UNSIGNED_INT64 :
741  case value::DOUBLE_STAR:
742  case value::FLOAT_STAR:
743  case value::INT_STAR:
744  //case value::ARRAY_UNSIGNED_CHAR:
745  //case value::ARRAY_CHAR:
746  case value::ARRAY_UNSIGNED_SHORT:
747  case value::ARRAY_SHORT:
748  case value::ARRAY_UNSIGNED_INT:
749  case value::ARRAY_INT:
750  case value::ARRAY_UNSIGNED_INT64:
751  case value::ARRAY_INT64:
752  case value::ARRAY_FLOAT:
753  //case value::ARRAY_DOUBLE:
754  case value::ARRAY_BOOL:
755  case value::ARRAY_STRING:
756  break;
757  }
758  aError = std::string("Value::add :" )
759  + " can't apply on type " + value::stype(oType)
760  + " and type " + aV.stype();
761  aThis.set_none();
762  return false;
763 }
764 
765 inline bool value::subtract(value& aThis,const value& aV,std::string& aError){
766  value::e_type oType = aThis.m_type;
767  switch(aThis.m_type) {
768  case value::INT:
769  switch(aV.m_type) {
770  case value::INT:
771  aThis.u.m_int -= aV.u.m_int;
772  return true;
773  case value::DOUBLE:{
774  double tmp = aThis.u.m_int - aV.u.m_double;
775  aThis.set(tmp);
776  return true;}
777  case value::FLOAT:{
778  float tmp = aThis.u.m_int - aV.u.m_float;
779  aThis.set(tmp);
780  return true;}
781  case value::ARRAY_DOUBLE:{
782  int tmp = aThis.u.m_int;
783  //In the below, this becomes a value::ARRAY_DOUBLE.
784  aThis.set(aV.u.m_array_double->orders(),
785  aV.u.m_array_double->vector());
786  aThis.u.m_array_double->multiply(-1);
787  aThis.u.m_array_double->add(double(tmp));
788  return true;}
789  case value::NONE:
790  case value::VOID_STAR:
791  case value::BOOL:
792  case value::SHORT:
793  case value::INT64:
794  //case value::UNSIGNED_CHAR:
795  //case value::CHAR:
796  case value::UNSIGNED_SHORT :
797  case value::UNSIGNED_INT:
798  case value::UNSIGNED_INT64 :
799  case value::DOUBLE_STAR:
800  case value::FLOAT_STAR:
801  case value::INT_STAR:
802  case value::STRING:
803  //case value::ARRAY_UNSIGNED_CHAR:
804  //case value::ARRAY_CHAR:
805  case value::ARRAY_UNSIGNED_SHORT:
806  case value::ARRAY_SHORT:
807  case value::ARRAY_UNSIGNED_INT:
808  case value::ARRAY_INT:
809  case value::ARRAY_UNSIGNED_INT64:
810  case value::ARRAY_INT64:
811  case value::ARRAY_FLOAT:
812  //case value::ARRAY_DOUBLE:
813  case value::ARRAY_BOOL:
814  case value::ARRAY_STRING:
815  break;
816  }
817  break;
818  case value::FLOAT:
819  switch(aV.m_type) {
820  case value::DOUBLE:
821  aThis.u.m_float -= (float)aV.u.m_double;
822  return true;
823  case value::UNSIGNED_SHORT :
824  aThis.u.m_float -= aV.u.m_unsigned_short;
825  return true;
826  case value::UNSIGNED_INT:
827  aThis.u.m_float -= aV.u.m_unsigned_int;
828  return true;
829  case value::ARRAY_DOUBLE:{
830  double tmp = aThis.u.m_float;
831  //In the below, this becomes a value::ARRAY_DOUBLE.
832  aThis.set(aV.u.m_array_double->orders(),
833  aV.u.m_array_double->vector());
834  aThis.u.m_array_double->multiply(-1);
835  aThis.u.m_array_double->add(tmp);
836  return true;}
837  case value::NONE:
838  case value::INT:
839  case value::VOID_STAR:
840  case value::BOOL:
841  case value::SHORT:
842  case value::INT64:
843  case value::FLOAT:
844  //case value::UNSIGNED_CHAR:
845  //case value::CHAR:
846  case value::UNSIGNED_INT64 :
847  case value::DOUBLE_STAR:
848  case value::FLOAT_STAR:
849  case value::INT_STAR:
850  case value::STRING:
851  //case value::ARRAY_UNSIGNED_CHAR:
852  //case value::ARRAY_CHAR:
853  case value::ARRAY_UNSIGNED_SHORT:
854  case value::ARRAY_SHORT:
855  case value::ARRAY_UNSIGNED_INT:
856  case value::ARRAY_INT:
857  case value::ARRAY_UNSIGNED_INT64:
858  case value::ARRAY_INT64:
859  case value::ARRAY_FLOAT:
860  //case value::ARRAY_DOUBLE:
861  case value::ARRAY_BOOL:
862  case value::ARRAY_STRING:
863  break;
864  }
865  break;
866  case value::DOUBLE:
867  switch(aV.m_type) {
868  case value::DOUBLE:
869  aThis.u.m_double -= aV.u.m_double;
870  return true;
871  case value::UNSIGNED_SHORT :
872  aThis.u.m_double -= aV.u.m_unsigned_short;
873  return true;
874  case value::UNSIGNED_INT:
875  aThis.u.m_double -= aV.u.m_unsigned_int;
876  return true;
877  case value::ARRAY_DOUBLE:{
878  double tmp = aThis.u.m_double;
879  //In the below, this becomes a value::ARRAY_DOUBLE.
880  aThis.set(aV.u.m_array_double->orders(),
881  aV.u.m_array_double->vector());
882  aThis.u.m_array_double->multiply(-1);
883  aThis.u.m_array_double->add(tmp);
884  return true;}
885  case value::NONE:
886  case value::INT:
887  case value::VOID_STAR:
888  case value::BOOL:
889  case value::SHORT:
890  case value::INT64:
891  case value::FLOAT:
892  //case value::UNSIGNED_CHAR:
893  //case value::CHAR:
894  case value::UNSIGNED_INT64 :
895  case value::DOUBLE_STAR:
896  case value::FLOAT_STAR:
897  case value::INT_STAR:
898  case value::STRING:
899  //case value::ARRAY_UNSIGNED_CHAR:
900  //case value::ARRAY_CHAR:
901  case value::ARRAY_UNSIGNED_SHORT:
902  case value::ARRAY_SHORT:
903  case value::ARRAY_UNSIGNED_INT:
904  case value::ARRAY_INT:
905  case value::ARRAY_UNSIGNED_INT64:
906  case value::ARRAY_INT64:
907  case value::ARRAY_FLOAT:
908  //case value::ARRAY_DOUBLE:
909  case value::ARRAY_BOOL:
910  case value::ARRAY_STRING:
911  break;
912  }
913  break;
914  case value::UNSIGNED_INT:
915  switch(aV.m_type) {
916 //uuu
917  //case value::UNSIGNED_INT:
918  // aThis.u.m_unsigned_int -= aV.u.m_unsigned_int;
919  // return true;
920  case value::ARRAY_DOUBLE:{
921  unsigned int tmp = aThis.u.m_unsigned_int;
922  //In the below, this becomes a value::ARRAY_DOUBLE.
923  aThis.set(aV.u.m_array_double->orders(),
924  aV.u.m_array_double->vector());
925  aThis.u.m_array_double->multiply(-1);
926  aThis.u.m_array_double->add(double(tmp));
927  return true;}
928  case value::DOUBLE:{
929  double d = double(aThis.u.m_unsigned_int) - aV.u.m_double;
930  aThis.set(d); //this becomes a value::DOUBLE.
931  return true;}
932  case value::NONE:
933  case value::INT:
934  case value::VOID_STAR:
935  case value::BOOL:
936  case value::SHORT:
937  case value::INT64:
938  case value::FLOAT:
939  //case value::UNSIGNED_CHAR:
940  //case value::CHAR:
941  case value::UNSIGNED_SHORT :
942  case value::UNSIGNED_INT:
943  case value::UNSIGNED_INT64 :
944  case value::DOUBLE_STAR:
945  case value::FLOAT_STAR:
946  case value::INT_STAR:
947  case value::STRING:
948  //case value::ARRAY_UNSIGNED_CHAR:
949  //case value::ARRAY_CHAR:
950  case value::ARRAY_UNSIGNED_SHORT:
951  case value::ARRAY_SHORT:
952  case value::ARRAY_UNSIGNED_INT:
953  case value::ARRAY_INT:
954  case value::ARRAY_UNSIGNED_INT64:
955  case value::ARRAY_INT64:
956  case value::ARRAY_FLOAT:
957  //case value::ARRAY_DOUBLE:
958  case value::ARRAY_BOOL:
959  case value::ARRAY_STRING:
960  break;
961  }
962  break;
963  case value::ARRAY_DOUBLE:
964  switch(aV.m_type) {
965  case value::INT:
966  aThis.u.m_array_double->add(-aV.u.m_int);
967  return true;
968  case value::UNSIGNED_INT:
969  aThis.u.m_array_double->add(-((double)aV.u.m_unsigned_int));
970  return true;
971  case value::DOUBLE:
972  aThis.u.m_array_double->add(-aV.u.m_double);
973  return true;
974  case value::ARRAY_DOUBLE:{
975  if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) {
976  aError = "Value::subtract : vector orders mismatch.";
977  aThis.set_none();
978  return false;
979  }
980  std::vector<double>& stdv = aThis.u.m_array_double->vector();
981  const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
982  unsigned int number = stdv.size();
983  for(unsigned int index=0;index<number;index++) {
984  stdv[index] -= stdv2[index];
985  }
986  return true;}
987  case value::NONE:
988  case value::VOID_STAR:
989  case value::BOOL:
990  case value::SHORT:
991  case value::INT64:
992  case value::FLOAT:
993  //case value::UNSIGNED_CHAR:
994  //case value::CHAR:
995  case value::UNSIGNED_SHORT :
996  case value::UNSIGNED_INT64 :
997  case value::DOUBLE_STAR:
998  case value::FLOAT_STAR:
999  case value::INT_STAR:
1000  case value::STRING:
1001  //case value::ARRAY_UNSIGNED_CHAR:
1002  //case value::ARRAY_CHAR:
1003  case value::ARRAY_UNSIGNED_SHORT:
1004  case value::ARRAY_SHORT:
1005  case value::ARRAY_UNSIGNED_INT:
1006  case value::ARRAY_INT:
1007  case value::ARRAY_UNSIGNED_INT64:
1008  case value::ARRAY_INT64:
1009  case value::ARRAY_FLOAT:
1010  //case value::ARRAY_DOUBLE:
1011  case value::ARRAY_BOOL:
1012  case value::ARRAY_STRING:
1013  break;
1014  }
1015  break;
1016  case value::NONE:
1017  case value::VOID_STAR:
1018  case value::BOOL:
1019  case value::SHORT:
1020  case value::INT64:
1021  //case value::UNSIGNED_CHAR:
1022  //case value::CHAR:
1023  case value::UNSIGNED_SHORT :
1024  case value::UNSIGNED_INT64 :
1025  case value::DOUBLE_STAR:
1026  case value::FLOAT_STAR:
1027  case value::INT_STAR:
1028  case value::STRING:
1029  //case value::ARRAY_UNSIGNED_CHAR:
1030  //case value::ARRAY_CHAR:
1031  case value::ARRAY_UNSIGNED_SHORT:
1032  case value::ARRAY_SHORT:
1033  case value::ARRAY_UNSIGNED_INT:
1034  case value::ARRAY_INT:
1035  case value::ARRAY_UNSIGNED_INT64:
1036  case value::ARRAY_INT64:
1037  case value::ARRAY_FLOAT:
1038  //case value::ARRAY_DOUBLE:
1039  case value::ARRAY_BOOL:
1040  case value::ARRAY_STRING:
1041  break;
1042  }
1043  aError = std::string("Value::subtract :" )
1044  + " can't apply on type " + value::stype(oType)
1045  + " and type " + aV.stype();
1046  aThis.set_none();
1047  return false;
1048 }
1049 
1050 inline bool value::multiply(value& aThis,const value& aV,std::string& aError){
1051  value::e_type oType = aThis.m_type;
1052  switch(aThis.m_type) {
1053  case value::INT:
1054  switch(aV.m_type) {
1055  case value::INT:
1056  aThis.u.m_int *= aV.u.m_int;
1057  return true;
1058  case value::DOUBLE:
1059  aThis.u.m_int *= (int)aV.u.m_double;
1060  return true;
1061  case value::FLOAT:
1062  aThis.u.m_int *= (int)aV.u.m_float;
1063  return true;
1064  case value::ARRAY_DOUBLE:{
1065  int tmp = aThis.u.m_int;
1066  //In the below, this becomes a value::ARRAY_DOUBLE.
1067  aThis.set(aV.u.m_array_double->orders(),
1068  aV.u.m_array_double->vector());
1069  aThis.u.m_array_double->multiply(double(tmp));
1070  return true;}
1071  case value::NONE:
1072  case value::VOID_STAR:
1073  case value::BOOL:
1074  case value::SHORT:
1075  case value::INT64:
1076  //case value::UNSIGNED_CHAR:
1077  //case value::CHAR:
1078  case value::UNSIGNED_SHORT :
1079  case value::UNSIGNED_INT64 :
1080  case value::DOUBLE_STAR:
1081  case value::FLOAT_STAR:
1082  case value::INT_STAR:
1083  case value::UNSIGNED_INT:
1084  case value::STRING:
1085  //case value::ARRAY_UNSIGNED_CHAR:
1086  //case value::ARRAY_CHAR:
1087  case value::ARRAY_UNSIGNED_SHORT:
1088  case value::ARRAY_SHORT:
1089  case value::ARRAY_UNSIGNED_INT:
1090  case value::ARRAY_INT:
1091  case value::ARRAY_UNSIGNED_INT64:
1092  case value::ARRAY_INT64:
1093  case value::ARRAY_FLOAT:
1094  //case value::ARRAY_DOUBLE:
1095  case value::ARRAY_BOOL:
1096  case value::ARRAY_STRING:
1097  break;
1098  }
1099  break;
1100  case value::FLOAT:
1101  switch(aV.m_type) {
1102  case value::SHORT:
1103  aThis.u.m_float *= aV.u.m_short;
1104  return true;
1105  case value::INT:
1106  aThis.u.m_float *= aV.u.m_int;
1107  return true;
1108  case value::FLOAT:
1109  aThis.u.m_float *= aV.u.m_float;
1110  return true;
1111  case value::DOUBLE:
1112  aThis.u.m_float *= (float)aV.u.m_double;
1113  return true;
1114  case value::UNSIGNED_SHORT :
1115  aThis.u.m_float *= aV.u.m_unsigned_short;
1116  return true;
1117  case value::UNSIGNED_INT:
1118  aThis.u.m_float *= aV.u.m_unsigned_int;
1119  return true;
1120  case value::ARRAY_DOUBLE:{
1121  double tmp = aThis.u.m_float;
1122  //In the below, this becomes a value::ARRAY_DOUBLE.
1123  aThis.set(aV.u.m_array_double->orders(),
1124  aV.u.m_array_double->vector());
1125  aThis.u.m_array_double->multiply(tmp);
1126  return true;}
1127  case value::NONE:
1128  case value::VOID_STAR:
1129  case value::BOOL:
1130  case value::INT64:
1131  //case value::UNSIGNED_CHAR:
1132  //case value::CHAR:
1133  case value::UNSIGNED_INT64 :
1134  case value::DOUBLE_STAR:
1135  case value::FLOAT_STAR:
1136  case value::INT_STAR:
1137  case value::STRING:
1138  //case value::ARRAY_UNSIGNED_CHAR:
1139  //case value::ARRAY_CHAR:
1140  case value::ARRAY_UNSIGNED_SHORT:
1141  case value::ARRAY_SHORT:
1142  case value::ARRAY_UNSIGNED_INT:
1143  case value::ARRAY_INT:
1144  case value::ARRAY_UNSIGNED_INT64:
1145  case value::ARRAY_INT64:
1146  case value::ARRAY_FLOAT:
1147  //case value::ARRAY_DOUBLE:
1148  case value::ARRAY_BOOL:
1149  case value::ARRAY_STRING:
1150  break;
1151  }
1152  break;
1153  case value::DOUBLE:
1154  switch(aV.m_type) {
1155  case value::SHORT:
1156  aThis.u.m_double *= aV.u.m_short;
1157  return true;
1158  case value::INT:
1159  aThis.u.m_double *= aV.u.m_int;
1160  return true;
1161  case value::INT64:
1162  aThis.u.m_double *= aV.u.m_int64;
1163  return true;
1164  case value::FLOAT:
1165  aThis.u.m_double *= aV.u.m_float;
1166  return true;
1167  case value::DOUBLE:
1168  aThis.u.m_double *= aV.u.m_double;
1169  return true;
1170  case value::UNSIGNED_SHORT :
1171  aThis.u.m_double *= aV.u.m_unsigned_short;
1172  return true;
1173  case value::UNSIGNED_INT:
1174  aThis.u.m_double *= aV.u.m_unsigned_int;
1175  return true;
1176  case value::ARRAY_DOUBLE:{
1177  double tmp = aThis.u.m_double;
1178  //In the below, this becomes a value::ARRAY_DOUBLE.
1179  aThis.set(aV.u.m_array_double->orders(),
1180  aV.u.m_array_double->vector());
1181  aThis.u.m_array_double->multiply(tmp);
1182  return true;}
1183  case value::NONE:
1184  case value::VOID_STAR:
1185  case value::BOOL:
1186  //case value::UNSIGNED_CHAR:
1187  //case value::CHAR:
1188  case value::UNSIGNED_INT64 :
1189  case value::DOUBLE_STAR:
1190  case value::FLOAT_STAR:
1191  case value::INT_STAR:
1192  case value::STRING:
1193  //case value::ARRAY_UNSIGNED_CHAR:
1194  //case value::ARRAY_CHAR:
1195  case value::ARRAY_UNSIGNED_SHORT:
1196  case value::ARRAY_SHORT:
1197  case value::ARRAY_UNSIGNED_INT:
1198  case value::ARRAY_INT:
1199  case value::ARRAY_UNSIGNED_INT64:
1200  case value::ARRAY_INT64:
1201  case value::ARRAY_FLOAT:
1202  //case value::ARRAY_DOUBLE:
1203  case value::ARRAY_BOOL:
1204  case value::ARRAY_STRING:
1205  break;
1206  }
1207  break;
1208  case value::UNSIGNED_INT:
1209  switch(aV.m_type) {
1210  case value::FLOAT:{
1211  float tmp = aThis.u.m_unsigned_int * aV.u.m_float;
1212  aThis.set(tmp); //this becomes a value::FLOAT.
1213  return true;}
1214  case value::DOUBLE:{
1215  double tmp = aThis.u.m_unsigned_int * aV.u.m_double;
1216  aThis.set(tmp); //this becomes a value::DOUBLE.
1217  return true;}
1218  case value::INT:{
1219  int tmp = aThis.u.m_unsigned_int * aV.u.m_int;
1220  aThis.set(tmp); //this becomes a value::INT.
1221  return true;}
1222  case value::INT64:{
1223  int64 tmp = aThis.u.m_unsigned_int * aV.u.m_int64;
1224  aThis.set(tmp); //this becomes a value::INT64.
1225  return true;}
1226  case value::UNSIGNED_INT:
1227  aThis.u.m_unsigned_int *= aV.u.m_unsigned_int;
1228  return true;
1229  case value::ARRAY_DOUBLE:{
1230  unsigned int tmp = aThis.u.m_unsigned_int;
1231  //In the below, this becomes a value::ARRAY_DOUBLE.
1232  aThis.set(aV.u.m_array_double->orders(),
1233  aV.u.m_array_double->vector());
1234  aThis.u.m_array_double->multiply(double(tmp));
1235  return true;}
1236  case value::NONE:
1237  case value::VOID_STAR:
1238  case value::BOOL:
1239  case value::SHORT:
1240  //case value::UNSIGNED_CHAR:
1241  //case value::CHAR:
1242  case value::UNSIGNED_SHORT :
1243  case value::UNSIGNED_INT64 :
1244  case value::DOUBLE_STAR:
1245  case value::FLOAT_STAR:
1246  case value::INT_STAR:
1247  case value::STRING:
1248  //case value::ARRAY_UNSIGNED_CHAR:
1249  //case value::ARRAY_CHAR:
1250  case value::ARRAY_UNSIGNED_SHORT:
1251  case value::ARRAY_SHORT:
1252  case value::ARRAY_UNSIGNED_INT:
1253  case value::ARRAY_INT:
1254  case value::ARRAY_UNSIGNED_INT64:
1255  case value::ARRAY_INT64:
1256  case value::ARRAY_FLOAT:
1257  //case value::ARRAY_DOUBLE:
1258  case value::ARRAY_BOOL:
1259  case value::ARRAY_STRING:
1260  break;
1261  }
1262  break;
1263  case value::ARRAY_DOUBLE:
1264  switch(aV.m_type) {
1265  case value::INT:
1266  aThis.u.m_array_double->multiply(aV.u.m_int);
1267  return true;
1268  case value::UNSIGNED_INT:
1269  aThis.u.m_array_double->multiply(aV.u.m_unsigned_int);
1270  return true;
1271  case value::DOUBLE:
1272  aThis.u.m_array_double->multiply(aV.u.m_double);
1273  return true;
1274  case value::ARRAY_DOUBLE:{
1275  if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) {
1276  aError = "Value::multiply : vector orders mismatch.";
1277  aThis.set_none();
1278  return false;
1279  }
1280  std::vector<double>& stdv = aThis.u.m_array_double->vector();
1281  const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
1282  unsigned int number = stdv.size();
1283  for(unsigned int index=0;index<number;index++) {
1284  stdv[index] *= stdv2[index];
1285  }
1286  return true;}
1287  case value::NONE:
1288  case value::VOID_STAR:
1289  case value::BOOL:
1290  case value::SHORT:
1291  case value::INT64:
1292  case value::FLOAT:
1293  //case value::UNSIGNED_CHAR:
1294  //case value::CHAR:
1295  case value::UNSIGNED_SHORT :
1296  case value::UNSIGNED_INT64 :
1297  case value::DOUBLE_STAR:
1298  case value::FLOAT_STAR:
1299  case value::INT_STAR:
1300  case value::STRING:
1301  //case value::ARRAY_UNSIGNED_CHAR:
1302  //case value::ARRAY_CHAR:
1303  case value::ARRAY_UNSIGNED_SHORT:
1304  case value::ARRAY_SHORT:
1305  case value::ARRAY_UNSIGNED_INT:
1306  case value::ARRAY_INT:
1307  case value::ARRAY_UNSIGNED_INT64:
1308  case value::ARRAY_INT64:
1309  case value::ARRAY_FLOAT:
1310  //case value::ARRAY_DOUBLE:
1311  case value::ARRAY_BOOL:
1312  case value::ARRAY_STRING:
1313  break;
1314  }
1315  break;
1316  case value::NONE:
1317  case value::STRING:
1318  case value::VOID_STAR:
1319  case value::BOOL:
1320  case value::SHORT:
1321  case value::INT64:
1322  //case value::UNSIGNED_CHAR:
1323  //case value::CHAR:
1324  case value::UNSIGNED_SHORT :
1325  case value::UNSIGNED_INT64 :
1326  case value::DOUBLE_STAR:
1327  case value::FLOAT_STAR:
1328  case value::INT_STAR:
1329  //case value::ARRAY_UNSIGNED_CHAR:
1330  //case value::ARRAY_CHAR:
1331  case value::ARRAY_UNSIGNED_SHORT:
1332  case value::ARRAY_SHORT:
1333  case value::ARRAY_UNSIGNED_INT:
1334  case value::ARRAY_INT:
1335  case value::ARRAY_UNSIGNED_INT64:
1336  case value::ARRAY_INT64:
1337  case value::ARRAY_FLOAT:
1338  //case value::ARRAY_DOUBLE:
1339  case value::ARRAY_BOOL:
1340  case value::ARRAY_STRING:
1341  break;
1342  }
1343  aError = std::string("Value::multiply :" )
1344  + " can't apply on type " + value::stype(oType)
1345  + " and type " + aV.stype();
1346  aThis.set_none();
1347  return false;
1348 }
1349 
1350 inline bool value::divide(value& aThis,const value& aV,std::string& aError){
1351  value::e_type oType = aThis.m_type;
1352  switch(aThis.m_type) {
1353  case value::INT:
1354  switch(aV.m_type) {
1355  case value::FLOAT:
1356  if(aV.u.m_float==0.0F) {
1357  aError = value::error_div_zero();
1358  aThis.set_none();
1359  return false;
1360  } else {
1361  float tmp = float(aThis.u.m_int)/aV.u.m_float;
1362  aThis.set(tmp);
1363  return true;
1364  }
1365  case value::DOUBLE:
1366  if(aV.u.m_double==0) {
1367  aError = value::error_div_zero();
1368  aThis.set_none();
1369  return false;
1370  } else {
1371  double tmp = double(aThis.u.m_int)/aV.u.m_double;
1372  aThis.set(tmp);
1373  return true;
1374  }
1375  case value::ARRAY_DOUBLE:{
1376  int tmp = aThis.u.m_int;
1377  //In the below, this becomes a value::ARRAY_DOUBLE.
1378  aThis.set(aV.u.m_array_double->orders(),
1379  aV.u.m_array_double->vector());
1380  if(!aThis.u.m_array_double->invert()) {
1381  aError = value::error_div_zero();
1382  aThis.set_none();
1383  return false;
1384  }
1385  aThis.u.m_array_double->multiply((double)tmp);
1386  return true;}
1387  case value::NONE:
1388  case value::INT:
1389  case value::VOID_STAR:
1390  case value::BOOL:
1391  case value::SHORT:
1392  case value::INT64:
1393  //case value::UNSIGNED_CHAR:
1394  //case value::CHAR:
1395  case value::UNSIGNED_SHORT :
1396  case value::UNSIGNED_INT:
1397  case value::UNSIGNED_INT64 :
1398  case value::DOUBLE_STAR:
1399  case value::FLOAT_STAR:
1400  case value::INT_STAR:
1401  case value::STRING:
1402  //case value::ARRAY_UNSIGNED_CHAR:
1403  //case value::ARRAY_CHAR:
1404  case value::ARRAY_UNSIGNED_SHORT:
1405  case value::ARRAY_SHORT:
1406  case value::ARRAY_UNSIGNED_INT:
1407  case value::ARRAY_INT:
1408  case value::ARRAY_UNSIGNED_INT64:
1409  case value::ARRAY_INT64:
1410  case value::ARRAY_FLOAT:
1411  //case value::ARRAY_DOUBLE:
1412  case value::ARRAY_BOOL:
1413  case value::ARRAY_STRING:
1414  break;
1415  }
1416  break;
1417  case value::FLOAT:
1418  switch(aV.m_type) {
1419  case value::INT:
1420  if(aV.u.m_int==0) {
1421  aError = value::error_div_zero();
1422  aThis.set_none();
1423  return false;
1424  } else {
1425  aThis.u.m_float /= aV.u.m_int;
1426  return true;
1427  }
1428  case value::FLOAT:
1429  if(aV.u.m_float==0.0F) {
1430  aError = value::error_div_zero();
1431  aThis.set_none();
1432  return false;
1433  } else {
1434  aThis.u.m_float /= aV.u.m_float;
1435  return true;
1436  }
1437  case value::DOUBLE:
1438  if(aV.u.m_float==0.0F) {
1439  aError = value::error_div_zero();
1440  aThis.set_none();
1441  return false;
1442  } else {
1443  aThis.u.m_float /= (float)aV.u.m_double;
1444  return true;
1445  }
1446  case value::UNSIGNED_INT:
1447  if(aV.u.m_unsigned_int==0) {
1448  aError = value::error_div_zero();
1449  aThis.set_none();
1450  return false;
1451  } else {
1452  aThis.u.m_float /= aV.u.m_unsigned_int;
1453  return true;
1454  }
1455  case value::ARRAY_DOUBLE:{
1456  double tmp = aThis.u.m_float;
1457  //In the below, this becomes a value::ARRAY_DOUBLE.
1458  aThis.set(aV.u.m_array_double->orders(),
1459  aV.u.m_array_double->vector());
1460  if(!aThis.u.m_array_double->invert()) {
1461  aError = value::error_div_zero();
1462  aThis.set_none();
1463  return false;
1464  }
1465  aThis.u.m_array_double->multiply(tmp);
1466  return true;}
1467 
1468  case value::NONE:
1469  case value::VOID_STAR:
1470  case value::BOOL:
1471  case value::SHORT:
1472  case value::INT64:
1473  //case value::UNSIGNED_CHAR:
1474  //case value::CHAR:
1475  case value::UNSIGNED_SHORT :
1476  case value::UNSIGNED_INT64 :
1477  case value::DOUBLE_STAR:
1478  case value::FLOAT_STAR:
1479  case value::INT_STAR:
1480  case value::STRING:
1481  //case value::ARRAY_UNSIGNED_CHAR:
1482  //case value::ARRAY_CHAR:
1483  case value::ARRAY_UNSIGNED_SHORT:
1484  case value::ARRAY_SHORT:
1485  case value::ARRAY_UNSIGNED_INT:
1486  case value::ARRAY_INT:
1487  case value::ARRAY_UNSIGNED_INT64:
1488  case value::ARRAY_INT64:
1489  case value::ARRAY_FLOAT:
1490  //case value::ARRAY_DOUBLE:
1491  case value::ARRAY_BOOL:
1492  case value::ARRAY_STRING:
1493  break;
1494  }
1495  break;
1496  case value::DOUBLE:
1497  switch(aV.m_type) {
1498  case value::SHORT:
1499  if(aV.u.m_short==0) {
1500  aError = value::error_div_zero();
1501  aThis.set_none();
1502  return false;
1503  } else {
1504  aThis.u.m_double /= aV.u.m_short;
1505  return true;
1506  }
1507  case value::INT:
1508  if(aV.u.m_int==0) {
1509  aError = value::error_div_zero();
1510  aThis.set_none();
1511  return false;
1512  } else {
1513  aThis.u.m_double /= aV.u.m_int;
1514  return true;
1515  }
1516  case value::FLOAT:
1517  if(aV.u.m_float==0.0F) {
1518  aError = value::error_div_zero();
1519  aThis.set_none();
1520  return false;
1521  } else {
1522  aThis.u.m_double /= aV.u.m_float;
1523  return true;
1524  }
1525  case value::DOUBLE:
1526  if(aV.u.m_double==0) {
1527  aError = value::error_div_zero();
1528  aThis.set_none();
1529  return false;
1530  } else {
1531  aThis.u.m_double /= aV.u.m_double;
1532  return true;
1533  }
1534  case value::UNSIGNED_INT:
1535  if(aV.u.m_unsigned_int==0) {
1536  aError = value::error_div_zero();
1537  aThis.set_none();
1538  return false;
1539  } else {
1540  aThis.u.m_double /= aV.u.m_unsigned_int;
1541  return true;
1542  }
1543  case value::ARRAY_DOUBLE:{
1544  double tmp = aThis.u.m_double;
1545  //In the below, this becomes a value::ARRAY_DOUBLE.
1546  aThis.set(aV.u.m_array_double->orders(),
1547  aV.u.m_array_double->vector());
1548  if(!aThis.u.m_array_double->invert()) {
1549  aError = value::error_div_zero();
1550  aThis.set_none();
1551  return false;
1552  }
1553  aThis.u.m_array_double->multiply(tmp);
1554  return true;}
1555 
1556  case value::NONE:
1557  case value::VOID_STAR:
1558  case value::BOOL:
1559  case value::INT64:
1560  //case value::UNSIGNED_CHAR:
1561  //case value::CHAR:
1562  case value::UNSIGNED_SHORT :
1563  case value::UNSIGNED_INT64 :
1564  case value::DOUBLE_STAR:
1565  case value::FLOAT_STAR:
1566  case value::INT_STAR:
1567  case value::STRING:
1568  //case value::ARRAY_UNSIGNED_CHAR:
1569  //case value::ARRAY_CHAR:
1570  case value::ARRAY_UNSIGNED_SHORT:
1571  case value::ARRAY_SHORT:
1572  case value::ARRAY_UNSIGNED_INT:
1573  case value::ARRAY_INT:
1574  case value::ARRAY_UNSIGNED_INT64:
1575  case value::ARRAY_INT64:
1576  case value::ARRAY_FLOAT:
1577  //case value::ARRAY_DOUBLE:
1578  case value::ARRAY_BOOL:
1579  case value::ARRAY_STRING:
1580  break;
1581  }
1582  break;
1583  case value::UNSIGNED_INT:
1584  switch(aV.m_type) {
1585  //case value::UNSIGNED_INT:
1586  // if(aV.u.m_unsigned_int==0) {
1587  // aError = value::error_div_zero();
1588  // aThis.set_none();
1589  // return false;
1590  // } else {
1591  // //FIXME : ???
1592  // aThis.set((double)(aThis.u.m_unsigned_int / aV.u.m_unsigned_int ));
1593  // return true;
1594  // }
1595  case value::ARRAY_DOUBLE:{
1596  unsigned int tmp = aThis.u.m_unsigned_int;
1597  //In the below, this becomes a value::ARRAY_DOUBLE.
1598  aThis.set(aV.u.m_array_double->orders(),
1599  aV.u.m_array_double->vector());
1600  if(!aThis.u.m_array_double->invert()) {
1601  aError = value::error_div_zero();
1602  aThis.set_none();
1603  return false;
1604  }
1605  aThis.u.m_array_double->multiply(double(tmp));
1606  return true;}
1607 
1608  case value::FLOAT:
1609  if(aV.u.m_float==0) {
1610  aError = value::error_div_zero();
1611  aThis.set_none();
1612  return false;
1613  } else {
1614  float d = float(aThis.u.m_unsigned_int)/aV.u.m_float;
1615  aThis.set(d); //this becomes a value::FLOAT.
1616  return true;
1617  }
1618  case value::DOUBLE:
1619  if(aV.u.m_double==0) {
1620  aError = value::error_div_zero();
1621  aThis.set_none();
1622  return false;
1623  } else {
1624  double d = double(aThis.u.m_unsigned_int)/aV.u.m_double;
1625  aThis.set(d); //this becomes a value::DOUBLE.
1626  return true;
1627  }
1628  case value::NONE:
1629  case value::INT:
1630  case value::VOID_STAR:
1631  case value::BOOL:
1632  case value::SHORT:
1633  case value::INT64:
1634  //case value::UNSIGNED_CHAR:
1635  //case value::CHAR:
1636  case value::UNSIGNED_SHORT :
1637  case value::UNSIGNED_INT:
1638  case value::UNSIGNED_INT64 :
1639  case value::DOUBLE_STAR:
1640  case value::FLOAT_STAR:
1641  case value::INT_STAR:
1642  case value::STRING:
1643  //case value::ARRAY_UNSIGNED_CHAR:
1644  //case value::ARRAY_CHAR:
1645  case value::ARRAY_UNSIGNED_SHORT:
1646  case value::ARRAY_SHORT:
1647  case value::ARRAY_UNSIGNED_INT:
1648  case value::ARRAY_INT:
1649  case value::ARRAY_UNSIGNED_INT64:
1650  case value::ARRAY_INT64:
1651  case value::ARRAY_FLOAT:
1652  //case value::ARRAY_DOUBLE:
1653  case value::ARRAY_BOOL:
1654  case value::ARRAY_STRING:
1655  break;
1656  }
1657  break;
1658  case value::ARRAY_DOUBLE:
1659  switch(aV.m_type) {
1660  case value::INT:
1661  if(aV.u.m_int==0) {
1662  aError = value::error_div_zero();
1663  aThis.set_none();
1664  return false;
1665  } else {
1666  double value = 1./aV.u.m_int;
1667  aThis.u.m_array_double->multiply(value);
1668  return true;
1669  }
1670  case value::UNSIGNED_INT:
1671  if(aV.u.m_unsigned_int==0) {
1672  aError = value::error_div_zero();
1673  aThis.set_none();
1674  return false;
1675  } else {
1676  double value = 1./aV.u.m_unsigned_int;
1677  aThis.u.m_array_double->multiply(value);
1678  return true;
1679  }
1680  case value::DOUBLE:
1681  if(aV.u.m_double==0) {
1682  aError = value::error_div_zero();
1683  aThis.set_none();
1684  return false;
1685  } else {
1686  aThis.u.m_array_double->multiply(1./aV.u.m_double);
1687  return true;
1688  }
1689  case value::ARRAY_DOUBLE:{
1690  if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) {
1691  aError = value::error_div_zero(); //FIXME : error_mismatch_orders
1692  aThis.set_none();
1693  return false;
1694  }
1695  std::vector<double>& stdv = aThis.u.m_array_double->vector();
1696  const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
1697  bool has_div_zero = false;
1698  unsigned int number = stdv.size();
1699  for(unsigned int index=0;index<number;index++) {
1700  if(stdv2[index]==0) {
1701  //FIXME : stdv[index] = nan;
1702  stdv[index] = 0; //PAW convention.
1703  has_div_zero = true;
1704  } else {
1705  stdv[index] /= stdv2[index];
1706  }
1707  }
1708  if(has_div_zero) {
1709  aError = value::error_div_zero();
1710  // For OpenPAW/pasigm::SIGMA, continue anyway in case of /0 errors.
1711  //aThis.set_none();
1712  //return false; //FIXME : is so, then it will stop Processor.
1713  return true; //FIXME : do we want that ?
1714  }
1715 
1716  return true;}
1717 
1718  case value::NONE:
1719  case value::STRING:
1720  case value::VOID_STAR:
1721  case value::BOOL:
1722  case value::SHORT:
1723  case value::FLOAT:
1724  //case value::UNSIGNED_CHAR:
1725  //case value::CHAR:
1726  case value::INT64:
1727  case value::UNSIGNED_SHORT :
1728  case value::UNSIGNED_INT64 :
1729  case value::DOUBLE_STAR:
1730  case value::FLOAT_STAR:
1731  case value::INT_STAR:
1732  //case value::ARRAY_UNSIGNED_CHAR:
1733  //case value::ARRAY_CHAR:
1734  case value::ARRAY_UNSIGNED_SHORT:
1735  case value::ARRAY_SHORT:
1736  case value::ARRAY_UNSIGNED_INT:
1737  case value::ARRAY_INT:
1738  case value::ARRAY_UNSIGNED_INT64:
1739  case value::ARRAY_INT64:
1740  case value::ARRAY_FLOAT:
1741  //case value::ARRAY_DOUBLE:
1742  case value::ARRAY_BOOL:
1743  case value::ARRAY_STRING:
1744  break;
1745  }
1746  break;
1747 
1748  case value::NONE:
1749  case value::STRING:
1750  case value::VOID_STAR:
1751  case value::BOOL:
1752  case value::SHORT:
1753  //case value::UNSIGNED_CHAR:
1754  //case value::CHAR:
1755  case value::INT64:
1756  case value::UNSIGNED_SHORT :
1757  case value::UNSIGNED_INT64 :
1758  case value::DOUBLE_STAR:
1759  case value::FLOAT_STAR:
1760  case value::INT_STAR:
1761  //case value::ARRAY_UNSIGNED_CHAR:
1762  //case value::ARRAY_CHAR:
1763  case value::ARRAY_UNSIGNED_SHORT:
1764  case value::ARRAY_SHORT:
1765  case value::ARRAY_UNSIGNED_INT:
1766  case value::ARRAY_INT:
1767  case value::ARRAY_UNSIGNED_INT64:
1768  case value::ARRAY_INT64:
1769  case value::ARRAY_FLOAT:
1770  //case value::ARRAY_DOUBLE:
1771  case value::ARRAY_BOOL:
1772  case value::ARRAY_STRING:
1773  break;
1774  }
1775  aError = std::string("Value::divide :")
1776  + " can't apply on type " + value::stype(oType)
1777  + " and type " + aV.stype();
1778  aThis.set_none();
1779  return false;
1780 }
1781 
1782 //////////////////////////////////////////////////////////////////////////////
1783 //////////////////////////////////////////////////////////////////////////////
1784 //////////////////////////////////////////////////////////////////////////////
1785 
1786 inline bool value::if_gt(value& aThis,const value& aV,std::string& aError){
1787  value::e_type oType = aThis.m_type;
1788  switch(aThis.m_type) {
1789  case value::INT:
1790  switch(aV.m_type) {
1791  case value::INT:
1792  aThis.set((bool)(aThis.u.m_int>aV.u.m_int?true:false));
1793  return true;
1794  case value::FLOAT:
1795  aThis.set((bool)(aThis.u.m_int>aV.u.m_float?true:false));
1796  return true;
1797  case value::DOUBLE:
1798  aThis.set((bool)(aThis.u.m_int>aV.u.m_double?true:false));
1799  return true;
1800  case value::UNSIGNED_SHORT :
1801  aThis.set((bool)(aThis.u.m_int>(int)aV.u.m_unsigned_short?true:false));
1802  return true;
1803  case value::UNSIGNED_INT:
1804  aThis.set((bool)(aThis.u.m_int>(int)aV.u.m_unsigned_int?true:false));
1805  return true;
1806  case value::ARRAY_DOUBLE:{
1807  const std::vector<double>& stdv = aV.u.m_array_double->vector();
1808  unsigned int number = stdv.size();
1809  for(unsigned int index=0;index<number;index++) {
1810  if(aThis.u.m_int<=stdv[index]) {
1811  aThis.set(false);
1812  return true;
1813  }
1814  }
1815  aThis.set(true);
1816  return true;
1817  }
1818  case value::NONE:
1819  case value::VOID_STAR:
1820  case value::BOOL:
1821  case value::SHORT:
1822  case value::INT64:
1823  //case value::UNSIGNED_CHAR:
1824  //case value::CHAR:
1825  case value::UNSIGNED_INT64 :
1826  case value::DOUBLE_STAR:
1827  case value::FLOAT_STAR:
1828  case value::INT_STAR:
1829  case value::STRING:
1830  //case value::ARRAY_UNSIGNED_CHAR:
1831  //case value::ARRAY_CHAR:
1832  case value::ARRAY_UNSIGNED_SHORT:
1833  case value::ARRAY_SHORT:
1834  case value::ARRAY_UNSIGNED_INT:
1835  case value::ARRAY_INT:
1836  case value::ARRAY_UNSIGNED_INT64:
1837  case value::ARRAY_INT64:
1838  case value::ARRAY_FLOAT:
1839  //case value::ARRAY_DOUBLE:
1840  case value::ARRAY_BOOL:
1841  case value::ARRAY_STRING:
1842  break;
1843  }
1844  break;
1845  case value::DOUBLE:
1846  switch(aV.m_type) {
1847  case value::DOUBLE:
1848  aThis.set((bool)(aThis.u.m_double>aV.u.m_double?true:false));
1849  return true;
1850  case value::FLOAT:
1851  aThis.set((bool)(aThis.u.m_double>aV.u.m_float?true:false));
1852  return true;
1853  case value::INT:
1854  aThis.set((bool)(aThis.u.m_double>aV.u.m_int?true:false));
1855  return true;
1856  case value::UNSIGNED_SHORT :
1857  aThis.set((bool)(aThis.u.m_double>aV.u.m_unsigned_short?true:false));
1858  return true;
1859  case value::UNSIGNED_INT:
1860  aThis.set((bool)(aThis.u.m_double>aV.u.m_unsigned_int?true:false));
1861  return true;
1862  case value::ARRAY_DOUBLE:{
1863  const std::vector<double>& stdv = aV.u.m_array_double->vector();
1864  unsigned int number = stdv.size();
1865  for(unsigned int index=0;index<number;index++) {
1866  if(aThis.u.m_double<=stdv[index]) {
1867  aThis.set(false);
1868  return true;
1869  }
1870  }
1871  aThis.set(true);
1872  return true;
1873  }
1874  case value::NONE:
1875  case value::VOID_STAR:
1876  case value::BOOL:
1877  case value::SHORT:
1878  case value::INT64:
1879  //case value::UNSIGNED_CHAR:
1880  //case value::CHAR:
1881  case value::UNSIGNED_INT64 :
1882  case value::DOUBLE_STAR:
1883  case value::FLOAT_STAR:
1884  case value::INT_STAR:
1885  case value::STRING:
1886  //case value::ARRAY_UNSIGNED_CHAR:
1887  //case value::ARRAY_CHAR:
1888  case value::ARRAY_UNSIGNED_SHORT:
1889  case value::ARRAY_SHORT:
1890  case value::ARRAY_UNSIGNED_INT:
1891  case value::ARRAY_INT:
1892  case value::ARRAY_UNSIGNED_INT64:
1893  case value::ARRAY_INT64:
1894  case value::ARRAY_FLOAT:
1895  //case value::ARRAY_DOUBLE:
1896  case value::ARRAY_BOOL:
1897  case value::ARRAY_STRING:
1898  break;
1899  }
1900  break;
1901  case value::FLOAT:
1902  switch(aV.m_type) {
1903  case value::DOUBLE:
1904  aThis.set((bool)(aThis.u.m_float>aV.u.m_double?true:false));
1905  return true;
1906  case value::FLOAT:
1907  aThis.set((bool)(aThis.u.m_float>aV.u.m_float?true:false));
1908  return true;
1909  case value::INT:
1910  aThis.set((bool)(aThis.u.m_float>aV.u.m_int?true:false));
1911  return true;
1912  case value::UNSIGNED_SHORT :
1913  aThis.set((bool)(aThis.u.m_float>aV.u.m_unsigned_short?true:false));
1914  return true;
1915  case value::UNSIGNED_INT:
1916  aThis.set((bool)(aThis.u.m_float>aV.u.m_unsigned_int?true:false));
1917  return true;
1918  case value::ARRAY_DOUBLE:{
1919  const std::vector<double>& stdv = aV.u.m_array_double->vector();
1920  unsigned int number = stdv.size();
1921  for(unsigned int index=0;index<number;index++) {
1922  if(aThis.u.m_float<=stdv[index]) {
1923  aThis.set(false);
1924  return true;
1925  }
1926  }
1927  aThis.set(true);
1928  return true;
1929  }
1930  case value::NONE:
1931  case value::VOID_STAR:
1932  case value::BOOL:
1933  case value::SHORT:
1934  case value::INT64:
1935  //case value::UNSIGNED_CHAR:
1936  //case value::CHAR:
1937  case value::UNSIGNED_INT64 :
1938  case value::DOUBLE_STAR:
1939  case value::FLOAT_STAR:
1940  case value::INT_STAR:
1941  case value::STRING:
1942  //case value::ARRAY_UNSIGNED_CHAR:
1943  //case value::ARRAY_CHAR:
1944  case value::ARRAY_UNSIGNED_SHORT:
1945  case value::ARRAY_SHORT:
1946  case value::ARRAY_UNSIGNED_INT:
1947  case value::ARRAY_INT:
1948  case value::ARRAY_UNSIGNED_INT64:
1949  case value::ARRAY_INT64:
1950  case value::ARRAY_FLOAT:
1951  //case value::ARRAY_DOUBLE:
1952  case value::ARRAY_BOOL:
1953  case value::ARRAY_STRING:
1954  break;
1955  }
1956  break;
1957  case value::VOID_STAR:
1958  switch(aV.m_type) {
1959  case value::VOID_STAR:
1960  aThis.set((bool)(aThis.u.m_void_star>aV.u.m_void_star?true:false));
1961  return true;
1962  case value::NONE:
1963  case value::INT:
1964  case value::DOUBLE:
1965  case value::BOOL:
1966  case value::SHORT:
1967  case value::INT64:
1968  case value::FLOAT:
1969  //case value::UNSIGNED_CHAR:
1970  //case value::CHAR:
1971  case value::UNSIGNED_SHORT :
1972  case value::UNSIGNED_INT:
1973  case value::UNSIGNED_INT64 :
1974  case value::DOUBLE_STAR:
1975  case value::FLOAT_STAR:
1976  case value::INT_STAR:
1977  case value::STRING:
1978  //case value::ARRAY_UNSIGNED_CHAR:
1979  //case value::ARRAY_CHAR:
1980  case value::ARRAY_UNSIGNED_SHORT:
1981  case value::ARRAY_SHORT:
1982  case value::ARRAY_UNSIGNED_INT:
1983  case value::ARRAY_INT:
1984  case value::ARRAY_UNSIGNED_INT64:
1985  case value::ARRAY_INT64:
1986  case value::ARRAY_FLOAT:
1987  case value::ARRAY_DOUBLE:
1988  case value::ARRAY_BOOL:
1989  case value::ARRAY_STRING:
1990  break;
1991  }
1992  break;
1993  case value::UNSIGNED_INT:
1994  switch(aV.m_type) {
1995  case value::UNSIGNED_INT:
1996  aThis.set((bool)(aThis.u.m_unsigned_int >aV.u.m_unsigned_int ?true:false));
1997  return true;
1998  case value::INT:
1999  aThis.set((bool)((int)aThis.u.m_unsigned_int >aV.u.m_int?true:false));
2000  return true;
2001  case value::NONE:
2002  case value::VOID_STAR:
2003  case value::DOUBLE:
2004  case value::BOOL:
2005  case value::SHORT:
2006  case value::INT64:
2007  case value::FLOAT:
2008  //case value::UNSIGNED_CHAR:
2009  //case value::CHAR:
2010  case value::UNSIGNED_SHORT :
2011  case value::UNSIGNED_INT64 :
2012  case value::DOUBLE_STAR:
2013  case value::FLOAT_STAR:
2014  case value::INT_STAR:
2015  case value::STRING:
2016  //case value::ARRAY_UNSIGNED_CHAR:
2017  //case value::ARRAY_CHAR:
2018  case value::ARRAY_UNSIGNED_SHORT:
2019  case value::ARRAY_SHORT:
2020  case value::ARRAY_UNSIGNED_INT:
2021  case value::ARRAY_INT:
2022  case value::ARRAY_UNSIGNED_INT64:
2023  case value::ARRAY_INT64:
2024  case value::ARRAY_FLOAT:
2025  case value::ARRAY_DOUBLE:
2026  case value::ARRAY_BOOL:
2027  case value::ARRAY_STRING:
2028  break;
2029  }
2030  break;
2031  case value::ARRAY_DOUBLE:
2032  switch(aV.m_type) {
2033  case value::INT:{
2034  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2035  unsigned int number = stdv.size();
2036  for(unsigned int index=0;index<number;index++) {
2037  if(stdv[index]<=aV.u.m_int) {
2038  aThis.set(false);
2039  return true;
2040  }
2041  }
2042  aThis.set(true);
2043  return true;
2044  }
2045  case value::FLOAT:{
2046  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2047  unsigned int number = stdv.size();
2048  for(unsigned int index=0;index<number;index++) {
2049  if(stdv[index]<=aV.u.m_float) {
2050  aThis.set(false);
2051  return true;
2052  }
2053  }
2054  aThis.set(true);
2055  return true;
2056  }
2057  case value::DOUBLE:{
2058  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2059  unsigned int number = stdv.size();
2060  for(unsigned int index=0;index<number;index++) {
2061  if(stdv[index]<=aV.u.m_double) {
2062  aThis.set(false);
2063  return true;
2064  }
2065  }
2066  aThis.set(true);
2067  return true;
2068  }
2069  case value::UNSIGNED_INT:{
2070  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2071  unsigned int number = stdv.size();
2072  for(unsigned int index=0;index<number;index++) {
2073  if(stdv[index]<=aV.u.m_unsigned_int ) {
2074  aThis.set(false);
2075  return true;
2076  }
2077  }
2078  aThis.set(true);
2079  return true;
2080  }
2081  case value::ARRAY_DOUBLE:{
2082  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2083  const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
2084  if(stdv.size()!=stdv2.size()) break;
2085  unsigned int number = stdv.size();
2086  for(unsigned int index=0;index<number;index++) {
2087  if(stdv[index]<=stdv2[index]) {
2088  aThis.set(false);
2089  return true;
2090  }
2091  }
2092  aThis.set(true);
2093  return true;
2094  }
2095  case value::NONE:
2096  case value::VOID_STAR:
2097  case value::BOOL:
2098  case value::SHORT:
2099  case value::INT64:
2100  //case value::UNSIGNED_CHAR:
2101  //case value::CHAR:
2102  case value::UNSIGNED_SHORT :
2103  case value::UNSIGNED_INT64 :
2104  case value::DOUBLE_STAR:
2105  case value::FLOAT_STAR:
2106  case value::INT_STAR:
2107  case value::STRING:
2108  //case value::ARRAY_UNSIGNED_CHAR:
2109  //case value::ARRAY_CHAR:
2110  case value::ARRAY_UNSIGNED_SHORT:
2111  case value::ARRAY_SHORT:
2112  case value::ARRAY_UNSIGNED_INT:
2113  case value::ARRAY_INT:
2114  case value::ARRAY_UNSIGNED_INT64:
2115  case value::ARRAY_INT64:
2116  case value::ARRAY_FLOAT:
2117  //case value::ARRAY_DOUBLE:
2118  case value::ARRAY_BOOL:
2119  case value::ARRAY_STRING:
2120  break;
2121  }
2122  break;
2123  case value::NONE:
2124  case value::BOOL:
2125  case value::SHORT:
2126  //case value::UNSIGNED_CHAR:
2127  //case value::CHAR:
2128  case value::STRING:
2129  case value::INT64:
2130  case value::UNSIGNED_SHORT :
2131  case value::UNSIGNED_INT64 :
2132  case value::DOUBLE_STAR:
2133  case value::FLOAT_STAR:
2134  case value::INT_STAR:
2135  //case value::ARRAY_UNSIGNED_CHAR:
2136  //case value::ARRAY_CHAR:
2137  case value::ARRAY_UNSIGNED_SHORT:
2138  case value::ARRAY_SHORT:
2139  case value::ARRAY_UNSIGNED_INT:
2140  case value::ARRAY_INT:
2141  case value::ARRAY_UNSIGNED_INT64:
2142  case value::ARRAY_INT64:
2143  case value::ARRAY_FLOAT:
2144 //case value::ARRAY_DOUBLE:
2145  case value::ARRAY_BOOL:
2146  case value::ARRAY_STRING:
2147  break;
2148  }
2149  aError = std::string("Value::if_gt() :")
2150  + " can't compare type " + value::stype(oType)
2151  + " with type " + aV.stype();
2152  aThis.set_none();
2153  return false;
2154 }
2155 
2156 inline bool value::if_eq(value& aThis,const value& aV,std::string& aError){
2157  value::e_type oType = aThis.m_type;
2158  switch(aThis.m_type) {
2159  case value::INT:
2160  switch(aV.m_type) {
2161  case value::INT:
2162  aThis.set((bool)(aThis.u.m_int==aV.u.m_int?true:false));
2163  return true;
2164  case value::DOUBLE:
2165  aThis.set((bool)(aThis.u.m_int==aV.u.m_double?true:false));
2166  return true;
2167  case value::FLOAT:
2168  aThis.set((bool)(aThis.u.m_int==aV.u.m_float?true:false));
2169  return true;
2170  case value::UNSIGNED_SHORT :
2171  aThis.set((bool)(aThis.u.m_int==(int)aV.u.m_unsigned_short?true:false));
2172  return true;
2173  case value::UNSIGNED_INT:
2174  aThis.set((bool)(aThis.u.m_int==(int)aV.u.m_unsigned_int ?true:false));
2175  return true;
2176  case value::ARRAY_DOUBLE:{
2177  const std::vector<double>& stdv = aV.u.m_array_double->vector();
2178  unsigned int number = stdv.size();
2179  for(unsigned int index=0;index<number;index++) {
2180  if(aThis.u.m_int!=stdv[index]) {
2181  aThis.set(false);
2182  return true;
2183  }
2184  }
2185  aThis.set(true);
2186  return true;
2187  }
2188 
2189  case value::NONE:
2190  case value::STRING:
2191  case value::VOID_STAR:
2192  case value::BOOL:
2193  case value::SHORT:
2194  case value::INT64:
2195  //case value::UNSIGNED_CHAR:
2196  //case value::CHAR:
2197  case value::UNSIGNED_INT64 :
2198  case value::DOUBLE_STAR:
2199  case value::FLOAT_STAR:
2200  case value::INT_STAR:
2201 
2202  //case value::ARRAY_UNSIGNED_CHAR:
2203  //case value::ARRAY_CHAR:
2204  case value::ARRAY_UNSIGNED_SHORT:
2205  case value::ARRAY_SHORT:
2206  case value::ARRAY_UNSIGNED_INT:
2207  case value::ARRAY_INT:
2208  case value::ARRAY_UNSIGNED_INT64:
2209  case value::ARRAY_INT64:
2210  case value::ARRAY_FLOAT:
2211  //case value::ARRAY_DOUBLE:
2212  case value::ARRAY_BOOL:
2213  case value::ARRAY_STRING:
2214  break;
2215  }
2216  break;
2217  case value::FLOAT:
2218  switch(aV.m_type) {
2219  case value::FLOAT:
2220  aThis.set((bool)(aThis.u.m_float==aV.u.m_float?true:false));
2221  return true;
2222  case value::DOUBLE:
2223  aThis.set((bool)(aThis.u.m_float==aV.u.m_double?true:false));
2224  return true;
2225  case value::INT:
2226  aThis.set((bool)(aThis.u.m_float==aV.u.m_int?true:false));
2227  return true;
2228  case value::UNSIGNED_SHORT :
2229  aThis.set((bool)(aThis.u.m_float==aV.u.m_unsigned_short?true:false));
2230  return true;
2231  case value::UNSIGNED_INT:
2232  aThis.set((bool)(aThis.u.m_float==aV.u.m_unsigned_int?true:false));
2233  return true;
2234  case value::ARRAY_DOUBLE:{
2235  const std::vector<double>& stdv = aV.u.m_array_double->vector();
2236  unsigned int number = stdv.size();
2237  for(unsigned int index=0;index<number;index++) {
2238  if(aThis.u.m_float!=stdv[index]) {
2239  aThis.set(false);
2240  return true;
2241  }
2242  }
2243  aThis.set(true);
2244  return true;
2245  }
2246  case value::NONE:
2247  case value::STRING:
2248  case value::VOID_STAR:
2249  case value::BOOL:
2250  case value::SHORT:
2251  //case value::UNSIGNED_CHAR:
2252  //case value::CHAR:
2253  case value::INT64:
2254  case value::UNSIGNED_INT64 :
2255  case value::DOUBLE_STAR:
2256  case value::FLOAT_STAR:
2257  case value::INT_STAR:
2258  //case value::ARRAY_UNSIGNED_CHAR:
2259  //case value::ARRAY_CHAR:
2260  case value::ARRAY_UNSIGNED_SHORT:
2261  case value::ARRAY_SHORT:
2262  case value::ARRAY_UNSIGNED_INT:
2263  case value::ARRAY_INT:
2264  case value::ARRAY_UNSIGNED_INT64:
2265  case value::ARRAY_INT64:
2266  case value::ARRAY_FLOAT:
2267  //case value::ARRAY_DOUBLE:
2268  case value::ARRAY_BOOL:
2269  case value::ARRAY_STRING:
2270  break;
2271  }
2272  break;
2273  case value::DOUBLE:
2274  switch(aV.m_type) {
2275  case value::DOUBLE:
2276  aThis.set((bool)(aThis.u.m_double==aV.u.m_double?true:false));
2277  return true;
2278  case value::FLOAT:
2279  aThis.set((bool)(aThis.u.m_double==aV.u.m_float?true:false));
2280  return true;
2281  case value::INT:
2282  aThis.set((bool)(aThis.u.m_double==aV.u.m_int?true:false));
2283  return true;
2284  case value::UNSIGNED_SHORT :
2285  aThis.set((bool)(aThis.u.m_double==aV.u.m_unsigned_short?true:false));
2286  return true;
2287  case value::UNSIGNED_INT:
2288  aThis.set((bool)(aThis.u.m_double==aV.u.m_unsigned_int ?true:false));
2289  return true;
2290  case value::ARRAY_DOUBLE:{
2291  const std::vector<double>& stdv = aV.u.m_array_double->vector();
2292  unsigned int number = stdv.size();
2293  for(unsigned int index=0;index<number;index++) {
2294  if(aThis.u.m_double!=stdv[index]) {
2295  aThis.set(false);
2296  return true;
2297  }
2298  }
2299  aThis.set(true);
2300  return true;
2301  }
2302  case value::NONE:
2303  case value::STRING:
2304  case value::VOID_STAR:
2305  case value::BOOL:
2306  case value::SHORT:
2307  //case value::UNSIGNED_CHAR:
2308  //case value::CHAR:
2309  case value::INT64:
2310  case value::UNSIGNED_INT64 :
2311  case value::DOUBLE_STAR:
2312  case value::FLOAT_STAR:
2313  case value::INT_STAR:
2314  //case value::ARRAY_UNSIGNED_CHAR:
2315  //case value::ARRAY_CHAR:
2316  case value::ARRAY_UNSIGNED_SHORT:
2317  case value::ARRAY_SHORT:
2318  case value::ARRAY_UNSIGNED_INT:
2319  case value::ARRAY_INT:
2320  case value::ARRAY_UNSIGNED_INT64:
2321  case value::ARRAY_INT64:
2322  case value::ARRAY_FLOAT:
2323  //case value::ARRAY_DOUBLE:
2324  case value::ARRAY_BOOL:
2325  case value::ARRAY_STRING:
2326  break;
2327  }
2328  break;
2329  case value::STRING:
2330  switch(aV.m_type) {
2331  case value::STRING:
2332  aThis.set((bool)((*aThis.u.m_string)==(*aV.u.m_string)?true:false));
2333  return true;
2334  case value::INT:
2335  {int v;
2336  if(!tools::to<int>(*aThis.u.m_string,v)) break;
2337  aThis.set((bool)(v==aV.u.m_int?true:false));
2338  return true;}
2339  case value::FLOAT:
2340  {float v;
2341  if(!tools::to<float>(*aThis.u.m_string,v)) break;
2342  aThis.set((bool)(v==aV.u.m_float?true:false));
2343  return true;}
2344  case value::DOUBLE:
2345  {double v;
2346  if(!tools::to<double>(*aThis.u.m_string,v)) break;
2347  aThis.set((bool)(v==aV.u.m_double?true:false));
2348  return true;}
2349  case value::UNSIGNED_INT:
2350  {typedef unsigned int uint_t;
2351  uint_t v;
2352  if(!tools::to<uint_t>(*aThis.u.m_string,v)) break;
2353  aThis.set((bool)(v==aV.u.m_unsigned_int ?true:false));
2354  return true;}
2355  case value::BOOL:
2356  {bool v;
2357  if(!tools::to(*aThis.u.m_string,v)) break;
2358  aThis.set((bool)(v==aV.u.m_bool?true:false));
2359  return true;}
2360  case value::NONE:
2361  case value::VOID_STAR:
2362  case value::SHORT:
2363  //case value::UNSIGNED_CHAR:
2364  //case value::CHAR:
2365  case value::INT64:
2366  case value::UNSIGNED_SHORT :
2367  case value::UNSIGNED_INT64 :
2368  case value::DOUBLE_STAR:
2369  case value::FLOAT_STAR:
2370  case value::INT_STAR:
2371  //case value::ARRAY_UNSIGNED_CHAR:
2372  //case value::ARRAY_CHAR:
2373  case value::ARRAY_UNSIGNED_SHORT:
2374  case value::ARRAY_SHORT:
2375  case value::ARRAY_UNSIGNED_INT:
2376  case value::ARRAY_INT:
2377  case value::ARRAY_UNSIGNED_INT64:
2378  case value::ARRAY_INT64:
2379  case value::ARRAY_FLOAT:
2380  case value::ARRAY_DOUBLE:
2381  case value::ARRAY_BOOL:
2382  case value::ARRAY_STRING:
2383  break;
2384  }
2385  break;
2386  case value::VOID_STAR:
2387  switch(aV.m_type) {
2388  case value::VOID_STAR:
2389  aThis.set((bool)(aThis.u.m_void_star==aV.u.m_void_star?true:false));
2390  return true;
2391  case value::NONE:
2392  case value::INT:
2393  case value::DOUBLE:
2394  case value::BOOL:
2395  case value::SHORT:
2396  case value::INT64:
2397  case value::FLOAT:
2398  //case value::UNSIGNED_CHAR:
2399  //case value::CHAR:
2400  case value::UNSIGNED_SHORT :
2401  case value::UNSIGNED_INT:
2402  case value::UNSIGNED_INT64 :
2403  case value::DOUBLE_STAR:
2404  case value::FLOAT_STAR:
2405  case value::INT_STAR:
2406  case value::STRING:
2407  //case value::ARRAY_UNSIGNED_CHAR:
2408  //case value::ARRAY_CHAR:
2409  case value::ARRAY_UNSIGNED_SHORT:
2410  case value::ARRAY_SHORT:
2411  case value::ARRAY_UNSIGNED_INT:
2412  case value::ARRAY_INT:
2413  case value::ARRAY_UNSIGNED_INT64:
2414  case value::ARRAY_INT64:
2415  case value::ARRAY_FLOAT:
2416  case value::ARRAY_DOUBLE:
2417  case value::ARRAY_BOOL:
2418  case value::ARRAY_STRING:
2419  break;
2420  }
2421  break;
2422  case value::UNSIGNED_INT:
2423  switch(aV.m_type) {
2424  case value::UNSIGNED_INT:
2425  aThis.set((bool)(aThis.u.m_unsigned_int ==aV.u.m_unsigned_int ?true:false));
2426  return true;
2427  case value::INT:
2428  aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_int?true:false));
2429  return true;
2430  case value::FLOAT:
2431  aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_float?true:false));
2432  return true;
2433  case value::DOUBLE:
2434  aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_double?true:false));
2435  return true;
2436  case value::ARRAY_DOUBLE:{
2437  const std::vector<double>& stdv = aV.u.m_array_double->vector();
2438  unsigned int number = stdv.size();
2439  for(unsigned int index=0;index<number;index++) {
2440  if(aThis.u.m_unsigned_int !=stdv[index]) {
2441  aThis.set(false);
2442  return true;
2443  }
2444  }
2445  aThis.set(true);
2446  return true;
2447  }
2448  case value::NONE:
2449  case value::BOOL:
2450  case value::VOID_STAR:
2451  case value::SHORT:
2452  case value::INT64:
2453  //case value::UNSIGNED_CHAR:
2454  //case value::CHAR:
2455  case value::UNSIGNED_SHORT :
2456  case value::UNSIGNED_INT64 :
2457  case value::DOUBLE_STAR:
2458  case value::FLOAT_STAR:
2459  case value::INT_STAR:
2460  case value::STRING:
2461  //case value::ARRAY_UNSIGNED_CHAR:
2462  //case value::ARRAY_CHAR:
2463  case value::ARRAY_UNSIGNED_SHORT:
2464  case value::ARRAY_SHORT:
2465  case value::ARRAY_UNSIGNED_INT:
2466  case value::ARRAY_INT:
2467  case value::ARRAY_UNSIGNED_INT64:
2468  case value::ARRAY_INT64:
2469  case value::ARRAY_FLOAT:
2470  //case value::ARRAY_DOUBLE:
2471  case value::ARRAY_BOOL:
2472  case value::ARRAY_STRING:
2473  break;
2474  }
2475  break;
2476  case value::BOOL:
2477  switch(aV.m_type) {
2478  case value::BOOL:
2479  aThis.u.m_bool = ((aThis.u.m_bool==aV.u.m_bool)?true:false);
2480  return true;
2481  case value::NONE:
2482  case value::INT:
2483  case value::DOUBLE:
2484  case value::VOID_STAR:
2485  case value::SHORT:
2486  case value::INT64:
2487  case value::FLOAT:
2488  //case value::UNSIGNED_CHAR:
2489  //case value::CHAR:
2490  case value::UNSIGNED_SHORT :
2491  case value::UNSIGNED_INT:
2492  case value::UNSIGNED_INT64 :
2493  case value::DOUBLE_STAR:
2494  case value::FLOAT_STAR:
2495  case value::INT_STAR:
2496  case value::STRING:
2497  //case value::ARRAY_UNSIGNED_CHAR:
2498  //case value::ARRAY_CHAR:
2499  case value::ARRAY_UNSIGNED_SHORT:
2500  case value::ARRAY_SHORT:
2501  case value::ARRAY_UNSIGNED_INT:
2502  case value::ARRAY_INT:
2503  case value::ARRAY_UNSIGNED_INT64:
2504  case value::ARRAY_INT64:
2505  case value::ARRAY_FLOAT:
2506  case value::ARRAY_DOUBLE:
2507  case value::ARRAY_BOOL:
2508  case value::ARRAY_STRING:
2509  break;
2510  }
2511  break;
2512  case value::ARRAY_DOUBLE:
2513  switch(aV.m_type) {
2514  case value::INT:{
2515  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2516  unsigned int number = stdv.size();
2517  for(unsigned int index=0;index<number;index++) {
2518  if(stdv[index]!=aV.u.m_int) {
2519  aThis.set(false);
2520  return true;
2521  }
2522  }
2523  aThis.set(true);
2524  return true;
2525  }
2526  case value::FLOAT:{
2527  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2528  unsigned int number = stdv.size();
2529  for(unsigned int index=0;index<number;index++) {
2530  if(stdv[index]!=aV.u.m_float) {
2531  aThis.set(false);
2532  return true;
2533  }
2534  }
2535  aThis.set(true);
2536  return true;
2537  }
2538  case value::DOUBLE:{
2539  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2540  unsigned int number = stdv.size();
2541  for(unsigned int index=0;index<number;index++) {
2542  if(stdv[index]!=aV.u.m_double) {
2543  aThis.set(false);
2544  return true;
2545  }
2546  }
2547  aThis.set(true);
2548  return true;
2549  }
2550  case value::UNSIGNED_INT:{
2551  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2552  unsigned int number = stdv.size();
2553  for(unsigned int index=0;index<number;index++) {
2554  if(stdv[index]!=aV.u.m_unsigned_int ) {
2555  aThis.set(false);
2556  return true;
2557  }
2558  }
2559  aThis.set(true);
2560  return true;
2561  }
2562  case value::ARRAY_DOUBLE:{
2563  const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2564  const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
2565  if(stdv.size()!=stdv2.size()) {
2566  aThis.set(false);
2567  return true;
2568  }
2569  unsigned int number = stdv.size();
2570  for(unsigned int index=0;index<number;index++) {
2571  if(stdv[index]!=stdv2[index]) {
2572  aThis.set(false);
2573  return true;
2574  }
2575  }
2576  aThis.set(true);
2577  return true;
2578  }
2579  case value::NONE:
2580  case value::VOID_STAR:
2581  case value::BOOL:
2582  case value::SHORT:
2583  //case value::UNSIGNED_CHAR:
2584  //case value::CHAR:
2585  case value::STRING:
2586  case value::INT64:
2587  case value::UNSIGNED_SHORT :
2588  case value::UNSIGNED_INT64 :
2589  case value::DOUBLE_STAR:
2590  case value::FLOAT_STAR:
2591  case value::INT_STAR:
2592  //case value::ARRAY_UNSIGNED_CHAR:
2593  //case value::ARRAY_CHAR:
2594  case value::ARRAY_UNSIGNED_SHORT:
2595  case value::ARRAY_SHORT:
2596  case value::ARRAY_UNSIGNED_INT:
2597  case value::ARRAY_INT:
2598  case value::ARRAY_UNSIGNED_INT64:
2599  case value::ARRAY_INT64:
2600  case value::ARRAY_FLOAT:
2601  //case value::ARRAY_DOUBLE:
2602  case value::ARRAY_BOOL:
2603  case value::ARRAY_STRING:
2604  break;
2605  }
2606  break;
2607  case value::NONE:
2608  case value::SHORT:
2609  case value::INT64:
2610  //case value::UNSIGNED_CHAR:
2611  //case value::CHAR:
2612  case value::UNSIGNED_SHORT :
2613  case value::UNSIGNED_INT64 :
2614  case value::DOUBLE_STAR:
2615  case value::FLOAT_STAR:
2616  case value::INT_STAR:
2617  //case value::ARRAY_UNSIGNED_CHAR:
2618  //case value::ARRAY_CHAR:
2619  case value::ARRAY_UNSIGNED_SHORT:
2620  case value::ARRAY_SHORT:
2621  case value::ARRAY_UNSIGNED_INT:
2622  case value::ARRAY_INT:
2623  case value::ARRAY_UNSIGNED_INT64:
2624  case value::ARRAY_INT64:
2625  case value::ARRAY_FLOAT:
2626 //case value::ARRAY_DOUBLE:
2627  case value::ARRAY_BOOL:
2628  case value::ARRAY_STRING:
2629  break;
2630  }
2631  aError = std::string("Value::if_eq() :")
2632  + " can't compare type " + value::stype(oType)
2633  + " with type " + aV.stype();
2634  aThis.set_none();
2635  return false;
2636 }
2637 
2638 inline bool value::if_and(value& aThis,const value& aV,std::string& aError){
2639  value::e_type oType = aThis.m_type;
2640  switch(aThis.m_type) {
2641  case value::BOOL:
2642  switch(aV.m_type) {
2643  case value::BOOL:
2644  aThis.u.m_bool = ((aThis.u.m_bool && aV.u.m_bool)?true:false);
2645  return true;
2646  case value::INT:
2647  case value::NONE:
2648  case value::DOUBLE:
2649  case value::STRING:
2650  case value::VOID_STAR:
2651  case value::SHORT:
2652  case value::INT64:
2653  case value::FLOAT:
2654  //case value::UNSIGNED_CHAR:
2655  //case value::CHAR:
2656  case value::UNSIGNED_SHORT :
2657  case value::UNSIGNED_INT64 :
2658  case value::DOUBLE_STAR:
2659  case value::FLOAT_STAR:
2660  case value::INT_STAR:
2661  case value::UNSIGNED_INT:
2662  //case value::ARRAY_UNSIGNED_CHAR:
2663  //case value::ARRAY_CHAR:
2664  case value::ARRAY_UNSIGNED_SHORT:
2665  case value::ARRAY_SHORT:
2666  case value::ARRAY_UNSIGNED_INT:
2667  case value::ARRAY_INT:
2668  case value::ARRAY_UNSIGNED_INT64:
2669  case value::ARRAY_INT64:
2670  case value::ARRAY_FLOAT:
2671  case value::ARRAY_DOUBLE:
2672  case value::ARRAY_BOOL:
2673  case value::ARRAY_STRING:
2674  break;
2675  }
2676  break;
2677  case value::NONE:
2678  case value::INT:
2679  case value::DOUBLE:
2680  case value::VOID_STAR:
2681  case value::SHORT:
2682  case value::INT64:
2683  case value::FLOAT:
2684  //case value::UNSIGNED_CHAR:
2685  //case value::CHAR:
2686  case value::UNSIGNED_SHORT :
2687  case value::UNSIGNED_INT:
2688  case value::UNSIGNED_INT64 :
2689  case value::DOUBLE_STAR:
2690  case value::FLOAT_STAR:
2691  case value::INT_STAR:
2692  case value::STRING:
2693  //case value::ARRAY_UNSIGNED_CHAR:
2694  //case value::ARRAY_CHAR:
2695  case value::ARRAY_UNSIGNED_SHORT:
2696  case value::ARRAY_SHORT:
2697  case value::ARRAY_UNSIGNED_INT:
2698  case value::ARRAY_INT:
2699  case value::ARRAY_UNSIGNED_INT64:
2700  case value::ARRAY_INT64:
2701  case value::ARRAY_FLOAT:
2702  case value::ARRAY_DOUBLE:
2703  case value::ARRAY_BOOL:
2704  case value::ARRAY_STRING:
2705  break;
2706  }
2707  aError = std::string("Value::if_and :")
2708  + " can't apply on type " + value::stype(oType)
2709  + " and type " + aV.stype();
2710  aThis.set_none();
2711  return false;
2712 }
2713 
2714 inline bool value::if_or(value& aThis,const value& aV,std::string& aError){
2715  value::e_type oType = aThis.m_type;
2716  switch(aThis.m_type) {
2717  case value::BOOL:
2718  switch(aV.m_type) {
2719  case value::BOOL:
2720  aThis.u.m_bool = ((aThis.u.m_bool || aV.u.m_bool)?true:false);
2721  return true;
2722  case value::INT:
2723  case value::NONE:
2724  case value::DOUBLE:
2725  case value::STRING:
2726  case value::VOID_STAR:
2727  case value::SHORT:
2728  case value::INT64:
2729  case value::FLOAT:
2730  //case value::UNSIGNED_CHAR:
2731  //case value::CHAR:
2732  case value::UNSIGNED_SHORT :
2733  case value::UNSIGNED_INT64 :
2734  case value::DOUBLE_STAR:
2735  case value::FLOAT_STAR:
2736  case value::INT_STAR:
2737  case value::UNSIGNED_INT:
2738  //case value::ARRAY_UNSIGNED_CHAR:
2739  //case value::ARRAY_CHAR:
2740  case value::ARRAY_UNSIGNED_SHORT:
2741  case value::ARRAY_SHORT:
2742  case value::ARRAY_UNSIGNED_INT:
2743  case value::ARRAY_INT:
2744  case value::ARRAY_UNSIGNED_INT64:
2745  case value::ARRAY_INT64:
2746  case value::ARRAY_FLOAT:
2747  case value::ARRAY_DOUBLE:
2748  case value::ARRAY_BOOL:
2749  case value::ARRAY_STRING:
2750  break;
2751  }
2752  break;
2753  case value::NONE:
2754  case value::INT:
2755  case value::DOUBLE:
2756  case value::VOID_STAR:
2757  case value::SHORT:
2758  case value::INT64:
2759  case value::FLOAT:
2760  //case value::UNSIGNED_CHAR:
2761  //case value::CHAR:
2762  case value::UNSIGNED_SHORT :
2763  case value::UNSIGNED_INT:
2764  case value::UNSIGNED_INT64 :
2765  case value::DOUBLE_STAR:
2766  case value::FLOAT_STAR:
2767  case value::INT_STAR:
2768  case value::STRING:
2769  //case value::ARRAY_UNSIGNED_CHAR:
2770  //case value::ARRAY_CHAR:
2771  case value::ARRAY_UNSIGNED_SHORT:
2772  case value::ARRAY_SHORT:
2773  case value::ARRAY_UNSIGNED_INT:
2774  case value::ARRAY_INT:
2775  case value::ARRAY_UNSIGNED_INT64:
2776  case value::ARRAY_INT64:
2777  case value::ARRAY_FLOAT:
2778  case value::ARRAY_DOUBLE:
2779  case value::ARRAY_BOOL:
2780  case value::ARRAY_STRING:
2781  break;
2782  }
2783  aError = std::string("Value::if_or :")
2784  + " can't apply on type " + value::stype(oType)
2785  + " and type " + aV.stype();
2786  aThis.set_none();
2787  return false;
2788 }
2789 
2790 inline bool value::to_double(const value& aThis,double& aValue){
2791  switch(aThis.m_type) {
2792  case value::INT:
2793  aValue = aThis.u.m_int;
2794  return true;
2795  case value::DOUBLE:
2796  aValue = aThis.u.m_double;
2797  return true;
2798  case value::UNSIGNED_SHORT:
2799  aValue = aThis.u.m_unsigned_short;
2800  return true;
2801  case value::UNSIGNED_INT:
2802  aValue = aThis.u.m_unsigned_int;
2803  return true;
2804  case value::SHORT:
2805  aValue = aThis.u.m_short;
2806  return true;
2807  case value::INT64:
2808  aValue = (double)aThis.u.m_int64;
2809  return true;
2810  case value::UNSIGNED_INT64:
2811  aValue = (double)aThis.u.m_unsigned_int64;
2812  return true;
2813  case value::FLOAT:
2814  aValue = aThis.u.m_float;
2815  return true;
2816  //case value::UNSIGNED_CHAR:
2817  // aValue = aThis.u.m_unsigned_char;
2818  // return true;
2819  //case value::CHAR:
2820  // aValue = aThis.u.m_char;
2821  // return true;
2822  case value::BOOL:
2823  aValue = aThis.u.m_bool?1:0;
2824  return true;
2825  case value::NONE:
2826  case value::STRING:
2827  case value::VOID_STAR:
2828  case value::DOUBLE_STAR:
2829  case value::FLOAT_STAR:
2830  case value::INT_STAR:
2831  //case value::ARRAY_UNSIGNED_CHAR:
2832  //case value::ARRAY_CHAR:
2833  case value::ARRAY_UNSIGNED_SHORT:
2834  case value::ARRAY_SHORT:
2835  case value::ARRAY_UNSIGNED_INT:
2836  case value::ARRAY_INT:
2837  case value::ARRAY_UNSIGNED_INT64:
2838  case value::ARRAY_INT64:
2839  case value::ARRAY_FLOAT:
2840  case value::ARRAY_DOUBLE:
2841  case value::ARRAY_BOOL:
2842  case value::ARRAY_STRING:
2843  break;
2844  }
2845  aValue = 0;
2846  return false;
2847 }
2848 
2849 inline bool value::cxx_type(const value& aThis,std::string& aValue){
2850  switch(aThis.m_type) {
2851  case value::INT:
2852  aValue = "int";
2853  return true;
2854  case value::DOUBLE:
2855  aValue = "double";
2856  return true;
2857  case value::STRING:
2858  aValue = "std::string";
2859  return true;
2860  case value::BOOL:
2861  aValue = "bool";
2862  return true;
2863  case value::SHORT:
2864  aValue = "short";
2865  return true;
2866  case value::FLOAT:
2867  aValue = "float";
2868  return true;
2869  //case value::CHAR:
2870  // aValue = "char";
2871  // return true;
2872  //case value::UNSIGNED_CHAR:
2873  // aValue = "unsigned char";
2874  // return true;
2875  case value::UNSIGNED_SHORT:
2876  aValue = "unsigned short";
2877  return true;
2878  case value::UNSIGNED_INT:
2879  aValue = "unsigned int";
2880  return true;
2881  case value::VOID_STAR:
2882  aValue = "void*";
2883  return true;
2884  case value::DOUBLE_STAR:
2885  aValue = "double*";
2886  return true;
2887  case value::FLOAT_STAR:
2888  aValue = "float*";
2889  return true;
2890  case value::INT_STAR:
2891  aValue = "int*";
2892  return true;
2893  case value::NONE:
2894  case value::INT64:
2895  case value::UNSIGNED_INT64:
2896  //case value::ARRAY_UNSIGNED_CHAR:
2897  //case value::ARRAY_CHAR:
2898  case value::ARRAY_UNSIGNED_SHORT:
2899  case value::ARRAY_SHORT:
2900  case value::ARRAY_UNSIGNED_INT:
2901  case value::ARRAY_INT:
2902  case value::ARRAY_UNSIGNED_INT64:
2903  case value::ARRAY_INT64:
2904  case value::ARRAY_FLOAT:
2905  case value::ARRAY_DOUBLE:
2906  case value::ARRAY_BOOL:
2907  case value::ARRAY_STRING:
2908  aValue = "";
2909  return false;
2910  }
2911  return false;
2912 }
2913 
2914 /*
2915 inline bool value::i_set(value& aThis,const Slash::Core::IValue& aValue){
2916  aThis.reset();
2917 
2918  aThis.m_type = aValue.type();
2919 
2920  switch(aValue.type()) {
2921  case value::NONE:
2922  aThis.u.m_unsigned_int64 = 0;
2923  return true;
2924  case value::CHAR:
2925  aThis.u.m_char = aValue.get_char();
2926  return true;
2927  case value::SHORT:
2928  aThis.u.m_short = aValue.get_short();
2929  return true;
2930  case value::INT:
2931  aThis.u.m_int = aValue.get_int();
2932  return true;
2933  case value::INT64:
2934  aThis.u.m_int64 = aValue.get_int64();
2935  return true;
2936  case value::UNSIGNED_INT64:
2937  aThis.u.m_unsigned_int64 = aValue.get_unsigned_int64();
2938  return true;
2939  //case value::UNSIGNED_CHAR:
2940  // aThis.u.m_unsigned_char = aValue.get_unsigned_char();
2941  // return true;
2942  case value::UNSIGNED_SHORT:
2943  aThis.u.m_unsigned_short = aValue.get_unsigned_short();
2944  return true;
2945  case value::UNSIGNED_INT:
2946  aThis.u.m_unsigned_int = aValue.get_unsigned_int();
2947  return true;
2948  case value::DOUBLE_STAR:
2949  aThis.u.m_double_star = aValue.get_double_star();
2950  return true;
2951  case value::FLOAT_STAR:
2952  aThis.u.m_float_star = aValue.get_float_star();
2953  return true;
2954  case value::INT_STAR:
2955  aThis.u.m_int_star = aValue.get_int_star();
2956  return true;
2957  case value::FLOAT:
2958  aThis.u.m_float = aValue.get_float();
2959  return true;
2960  case value::DOUBLE:
2961  aThis.u.m_double = aValue.get_double();
2962  return true;
2963  case value::VOID_STAR:
2964  aThis.u.m_void_star = aValue.get_void_star();
2965  return true;
2966  case value::BOOL:
2967  aThis.u.m_bool = aValue.get_bool();
2968  return true;
2969  case value::STRING:
2970  aThis.u.m_string = new std::string(aValue.get_string());
2971  return true;
2972 
2973  case value::ARRAY_UNSIGNED_CHAR:
2974  {std::vector<unsigned int> is;
2975  const std::vector<unsigned char>& vd = aValue.get_array_unsigned_char(is);
2976  aThis.u.m_array_unsigned_char = new tools::array<unsigned char>();
2977  if(!aThis.u.m_array_unsigned_char->configure(is)){
2978  aThis.set_none();return false;
2979  }
2980  if(!aThis.u.m_array_unsigned_char->fill(vd)){aThis.set_none();return false;}
2981  return true;}
2982 
2983  case value::ARRAY_CHAR:
2984  {std::vector<unsigned int> is;
2985  const std::vector<char>& vd = aValue.get_array_char(is);
2986  aThis.u.m_array_char = new tools::array<char>();
2987  if(!aThis.u.m_array_char->configure(is)){
2988  aThis.set_none();return false;
2989  }
2990  if(!aThis.u.m_array_char->fill(vd)){aThis.set_none();return false;}
2991  return true;}
2992  case value::ARRAY_UNSIGNED_SHORT:
2993  {std::vector<unsigned int> is;
2994  const std::vector<unsigned short>& vd =
2995  aValue.get_array_unsigned_short(is);
2996  aThis.u.m_array_unsigned_short = new tools::array<unsigned short>();
2997  if(!aThis.u.m_array_unsigned_short->configure(is)){
2998  aThis.set_none();return false;
2999  }
3000  if(!aThis.u.m_array_unsigned_short->fill(vd)){
3001  aThis.set_none();return false;
3002  }
3003  return true;}
3004 
3005  case value::ARRAY_SHORT:
3006  {std::vector<unsigned int> is;
3007  const std::vector<short>& vd = aValue.get_array_short(is);
3008  aThis.u.m_array_short = new tools::array<short>();
3009  if(!aThis.u.m_array_short->configure(is)){aThis.set_none();return false;}
3010  if(!aThis.u.m_array_short->fill(vd)){aThis.set_none();return false;}
3011  return true;}
3012 
3013  case value::ARRAY_UNSIGNED_INT:
3014  {std::vector<unsigned int> is;
3015  const std::vector<unsigned int>& vd = aValue.get_array_unsigned_int(is);
3016  aThis.u.m_array_unsigned_int = new tools::array<unsigned int>();
3017  if(!aThis.u.m_array_unsigned_int->configure(is)){
3018  aThis.set_none();return false;
3019  }
3020  if(!aThis.u.m_array_unsigned_int->fill(vd)){
3021  aThis.set_none();return false;
3022  }
3023  return true;}
3024 
3025  case value::ARRAY_INT:
3026  {std::vector<unsigned int> is;
3027  const std::vector<int>& vd = aValue.get_array_int(is);
3028  aThis.u.m_array_int = new tools::array<int>();
3029  if(!aThis.u.m_array_int->configure(is)){aThis.set_none();return false;}
3030  if(!aThis.u.m_array_int->fill(vd)){aThis.set_none();return false;}
3031  return true;}
3032 
3033  case value::ARRAY_UNSIGNED_INT64:
3034  {std::vector<unsigned int> is;
3035  const std::vector<uint64>& vd = aValue.get_array_unsigned_int64(is);
3036  aThis.u.m_array_unsigned_int64 = new tools::array<uint64>();
3037  if(!aThis.u.m_array_unsigned_int64->configure(is)){
3038  aThis.set_none();return false;
3039  }
3040  if(!aThis.u.m_array_unsigned_int64->fill(vd)){
3041  aThis.set_none();return false;
3042  }
3043  return true;}
3044 
3045  case value::ARRAY_INT64:
3046  {std::vector<unsigned int> is;
3047  const std::vector<int64>& vd = aValue.get_array_int64(is);
3048  aThis.u.m_array_int64 = new tools::array<int64>();
3049  if(!aThis.u.m_array_int64->configure(is)){aThis.set_none();return false;}
3050  if(!aThis.u.m_array_int64->fill(vd)){aThis.set_none();return false;}
3051  return true;}
3052 
3053  case value::ARRAY_FLOAT:
3054  {std::vector<unsigned int> is;
3055  const std::vector<float>& vd = aValue.get_array_float(is);
3056  aThis.u.m_array_float = new tools::array<float>();
3057  if(!aThis.u.m_array_float->configure(is)){aThis.set_none();return false;}
3058  if(!aThis.u.m_array_float->fill(vd)){aThis.set_none();return false;}
3059  return true;}
3060 
3061  case value::ARRAY_DOUBLE:
3062  {std::vector<unsigned int> is;
3063  const std::vector<double>& vd = aValue.get_array_double(is);
3064  aThis.u.m_array_double = new tools::array<double>();
3065  if(!aThis.u.m_array_double->configure(is)){aThis.set_none();return false;}
3066  if(!aThis.u.m_array_double->fill(vd)){aThis.set_none();return false;}
3067  return true;}
3068 
3069  case value::ARRAY_BOOL:
3070  {std::vector<unsigned int> is;
3071  const std::vector<bool>& vd = aValue.get_array_bool(is);
3072  aThis.u.m_array_bool = new tools::array<bool>();
3073  if(!aThis.u.m_array_bool->configure(is)){aThis.set_none();return false;}
3074  if(!aThis.u.m_array_bool->fill(vd)){aThis.set_none();return false;}
3075  return true;}
3076 
3077  case value::ARRAY_STRING:
3078  {std::vector<unsigned int> is;
3079  const std::vector<std::string>& vd = aValue.get_array_string(is);
3080  aThis.u.m_array_string = new tools::array<std::string>();
3081  if(!aThis.u.m_array_string->configure(is)){aThis.set_none();return false;}
3082  if(!aThis.u.m_array_string->fill(vd)){aThis.set_none();return false;}
3083  return true;}
3084 
3085  }
3086 
3087  aThis.set_none();
3088  return false;
3089 }
3090 */
3091 
3092 inline std::string value::to_string(const value& aThis){
3093  std::string s;
3094  switch(aThis.m_type) {
3095  case value::NONE:
3096  tools::sprintf(s,5,"(nil)");
3097  return s;
3098  case value::INT:
3099  tools::sprintf(s,16,"%d",aThis.u.m_int);
3100  return s;
3101  case value::DOUBLE:
3102  tools::sprintf(s,16,"%g",aThis.u.m_double);
3103  return s;
3104  case value::VOID_STAR:
3105  tools::sprintf(s,16,"0x%lx",(unsigned long)aThis.u.m_void_star);
3106  return s;
3107  case value::UNSIGNED_SHORT:
3108  tools::sprintf(s,16,"%u",aThis.u.m_unsigned_short);
3109  return s;
3110  case value::UNSIGNED_INT:
3111  tools::sprintf(s,16,"%u",aThis.u.m_unsigned_int);
3112  return s;
3113  case value::BOOL:
3114  tools::sprintf(s,5,"%s",aThis.u.m_bool?"true":"false");
3115  return s;
3116  case value::SHORT:
3117  tools::sprintf(s,16,"%d",aThis.u.m_short);
3118  return s;
3119  case value::INT64:{
3120  tools::sprintf(s,16,tools::int64_format(),aThis.u.m_int64);
3121  }return s;
3122  case value::UNSIGNED_INT64:{
3123  tools::sprintf(s,16,tools::int64_format(),aThis.u.m_unsigned_int64);
3124  }return s;
3125  case value::FLOAT:
3126  tools::sprintf(s,16,"%g",aThis.u.m_float);
3127  return s;
3128  //case value::UNSIGNED_CHAR:
3129  // tools::sprintf(s,16,"%c",aThis.u.m_unsigned_char);
3130  // return s;
3131  //case value::CHAR:
3132  // tools::sprintf(s,16,"%c",aThis.u.m_char);
3133  // return s;
3134  case value::DOUBLE_STAR:
3135  tools::sprintf(s,16,"0x%lx",(unsigned long)aThis.u.m_double_star);
3136  return s;
3137  case value::FLOAT_STAR:
3138  tools::sprintf(s,16,"0x%lx",(unsigned long)aThis.u.m_float_star);
3139  return s;
3140  case value::INT_STAR:
3141  tools::sprintf(s,16,"0x%lx",(unsigned long)aThis.u.m_int_star);
3142  return s;
3143  case value::STRING:
3144  return *aThis.u.m_string;
3145 
3146  //case value::ARRAY_UNSIGNED_CHAR:
3147  // return tools::tos<unsigned char>(aThis.u.m_array_unsigned_char->vector());
3148  //case value::ARRAY_CHAR:
3149  // return tools::tos<char>(aThis.u.m_array_char->vector());
3150  case value::ARRAY_UNSIGNED_SHORT:
3151  return tools::tos<unsigned short>(aThis.u.m_array_unsigned_short->vector());
3152  case value::ARRAY_SHORT:
3153  return tools::tos<short>(aThis.u.m_array_short->vector());
3154 
3155  case value::ARRAY_UNSIGNED_INT:
3156  return tools::tos<unsigned int>(aThis.u.m_array_unsigned_int->vector());
3157  case value::ARRAY_INT:
3158  return tools::tos<int>(aThis.u.m_array_int->vector());
3159 
3160  case value::ARRAY_UNSIGNED_INT64:
3161  return tools::tos<uint64>(aThis.u.m_array_unsigned_int64->vector());
3162  case value::ARRAY_INT64:
3163  return tools::tos<int64>(aThis.u.m_array_int64->vector());
3164 
3165  case value::ARRAY_FLOAT:
3166  return tools::tos<float>(aThis.u.m_array_float->vector());
3167  case value::ARRAY_DOUBLE:
3168  return tools::tos<double>(aThis.u.m_array_double->vector());
3169  case value::ARRAY_BOOL:
3170  return tools::tos<bool>(aThis.u.m_array_bool->vector());
3171  case value::ARRAY_STRING:
3172  return tools::tos<std::string>(aThis.u.m_array_string->vector());
3173  default:
3174  return "unknow"; //it should not happen.
3175  }
3176 }
3177 
3178 }