Geant4 Cross Reference

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

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

  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 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 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 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 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 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 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 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 array<int64>(*aV.u.m_array_int64);
 36 
 37     } else if(aV.m_type==value::ARRAY_FLOAT) {
 38       aThis.u.m_array_float = new array<float>(*aV.u.m_array_float);
 39     } else if(aV.m_type==value::ARRAY_DOUBLE) {
 40       aThis.u.m_array_double = new array<double>(*aV.u.m_array_double);
 41     } else if(aV.m_type==value::ARRAY_BOOL) {
 42       aThis.u.m_array_bool = new 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 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     size_t number = stdv.size();
344     for(size_t 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       double tmp = double(aThis.u.m_float) - aV.u.m_double;
822       aThis.set(tmp);
823       return true;}
824     case value::UNSIGNED_SHORT :
825       aThis.u.m_float -= aV.u.m_unsigned_short;
826       return true;
827     case value::UNSIGNED_INT:
828       aThis.u.m_float -= aV.u.m_unsigned_int;
829       return true;
830     case value::INT:
831       aThis.u.m_float -= aV.u.m_int;
832       return true;
833     case value::SHORT:
834       aThis.u.m_float -= aV.u.m_short;
835       return true;
836     case value::FLOAT:
837       aThis.u.m_float -= aV.u.m_float;
838       return true;
839     case value::INT64:{
840       double tmp = double(aThis.u.m_float) - aV.u.m_int64;
841       aThis.set(tmp);
842       return true;}
843     case value::UNSIGNED_INT64:{
844       double tmp = double(aThis.u.m_float) - aV.u.m_unsigned_int64;
845       aThis.set(tmp);
846       return true;}
847     case value::ARRAY_DOUBLE:{
848       double tmp = aThis.u.m_float;
849       //In the below, this becomes a value::ARRAY_DOUBLE.
850       aThis.set(aV.u.m_array_double->orders(),
851                 aV.u.m_array_double->vector());
852       aThis.u.m_array_double->multiply(-1);
853       aThis.u.m_array_double->add(tmp);
854       return true;}
855     case value::NONE:
856     case value::VOID_STAR:
857     case value::BOOL:
858     //case value::UNSIGNED_CHAR:
859     //case value::CHAR:
860     case value::DOUBLE_STAR:
861     case value::FLOAT_STAR:
862     case value::INT_STAR:
863     case value::STRING:
864     //case value::ARRAY_UNSIGNED_CHAR:
865     //case value::ARRAY_CHAR:
866     case value::ARRAY_UNSIGNED_SHORT:
867     case value::ARRAY_SHORT:
868     case value::ARRAY_UNSIGNED_INT:
869     case value::ARRAY_INT:
870     case value::ARRAY_UNSIGNED_INT64:
871     case value::ARRAY_INT64:
872     case value::ARRAY_FLOAT:
873     //case value::ARRAY_DOUBLE:
874     case value::ARRAY_BOOL:
875     case value::ARRAY_STRING:
876       break;
877     }
878     break;
879   case value::DOUBLE:
880     switch(aV.m_type) {
881     case value::DOUBLE:
882       aThis.u.m_double -= aV.u.m_double;
883       return true;
884     case value::UNSIGNED_SHORT :
885       aThis.u.m_double -= aV.u.m_unsigned_short;
886       return true;
887     case value::UNSIGNED_INT:
888       aThis.u.m_double -= aV.u.m_unsigned_int;
889       return true;
890     case value::INT:
891       aThis.u.m_double -= aV.u.m_int;
892       return true;
893     case value::SHORT:
894       aThis.u.m_double -= aV.u.m_short;
895       return true;
896     case value::INT64:
897       aThis.u.m_double -= aV.u.m_int64;
898       return true;
899     case value::FLOAT:
900       aThis.u.m_double -= aV.u.m_float;
901       return true;
902     case value::UNSIGNED_INT64 :
903       aThis.u.m_double -= aV.u.m_unsigned_int64;
904       return true;
905     case value::ARRAY_DOUBLE:{
906       double tmp = aThis.u.m_double;
907       //In the below, this becomes a value::ARRAY_DOUBLE.
908       aThis.set(aV.u.m_array_double->orders(),
909                 aV.u.m_array_double->vector());
910       aThis.u.m_array_double->multiply(-1);
911       aThis.u.m_array_double->add(tmp);
912       return true;}
913     case value::NONE:
914     case value::VOID_STAR:
915     case value::BOOL:
916     //case value::UNSIGNED_CHAR:
917     //case value::CHAR:
918     case value::DOUBLE_STAR:
919     case value::FLOAT_STAR:
920     case value::INT_STAR:
921     case value::STRING:
922     //case value::ARRAY_UNSIGNED_CHAR:
923     //case value::ARRAY_CHAR:
924     case value::ARRAY_UNSIGNED_SHORT:
925     case value::ARRAY_SHORT:
926     case value::ARRAY_UNSIGNED_INT:
927     case value::ARRAY_INT:
928     case value::ARRAY_UNSIGNED_INT64:
929     case value::ARRAY_INT64:
930     case value::ARRAY_FLOAT:
931     //case value::ARRAY_DOUBLE:
932     case value::ARRAY_BOOL:
933     case value::ARRAY_STRING:
934       break;
935     }
936     break;
937   case value::UNSIGNED_INT:
938     switch(aV.m_type) {
939     case value::UNSIGNED_INT:
940       if(aThis.u.m_unsigned_int>=aV.u.m_unsigned_int) {
941         aThis.u.m_unsigned_int -= aV.u.m_unsigned_int;
942       } else {
943         int i = int(aThis.u.m_unsigned_int) - aV.u.m_unsigned_int;
944         aThis.set(i);
945       }
946       return true;
947     case value::DOUBLE:{
948       double d = double(aThis.u.m_unsigned_int) - aV.u.m_double;
949       aThis.set(d);
950       return true;}
951     case value::FLOAT:{
952       float d = float(aThis.u.m_unsigned_int) - aV.u.m_float;
953       aThis.set(d);
954       return true;}
955     case value::INT:{
956       int d = int(aThis.u.m_unsigned_int) - aV.u.m_int;
957       aThis.set(d);
958       return true;}
959     case value::ARRAY_DOUBLE:{
960       unsigned int tmp = aThis.u.m_unsigned_int;
961       //In the below, this becomes a value::ARRAY_DOUBLE.
962       aThis.set(aV.u.m_array_double->orders(),
963                 aV.u.m_array_double->vector());
964       aThis.u.m_array_double->multiply(-1);
965       aThis.u.m_array_double->add(double(tmp));
966       return true;}
967     case value::NONE:
968     case value::VOID_STAR:
969     case value::BOOL:
970     case value::SHORT:
971     case value::INT64:
972     //case value::UNSIGNED_CHAR:
973     //case value::CHAR:
974     case value::UNSIGNED_SHORT :
975     case value::UNSIGNED_INT64 :
976     case value::DOUBLE_STAR:
977     case value::FLOAT_STAR:
978     case value::INT_STAR:
979     case value::STRING:
980     //case value::ARRAY_UNSIGNED_CHAR:
981     //case value::ARRAY_CHAR:
982     case value::ARRAY_UNSIGNED_SHORT:
983     case value::ARRAY_SHORT:
984     case value::ARRAY_UNSIGNED_INT:
985     case value::ARRAY_INT:
986     case value::ARRAY_UNSIGNED_INT64:
987     case value::ARRAY_INT64:
988     case value::ARRAY_FLOAT:
989     //case value::ARRAY_DOUBLE:
990     case value::ARRAY_BOOL:
991     case value::ARRAY_STRING:
992       break;
993     }
994     break;
995   case value::ARRAY_DOUBLE:
996     switch(aV.m_type) {
997     case value::INT:
998       aThis.u.m_array_double->add(-aV.u.m_int);
999       return true;
1000     case value::UNSIGNED_INT:
1001       aThis.u.m_array_double->add(-((double)aV.u.m_unsigned_int));
1002       return true;
1003     case value::DOUBLE:
1004       aThis.u.m_array_double->add(-aV.u.m_double);
1005       return true;
1006     case value::ARRAY_DOUBLE:{
1007       if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) {
1008         aError = "Value::subtract : vector orders mismatch.";
1009         aThis.set_none();
1010         return false;
1011       }
1012       std::vector<double>& stdv = aThis.u.m_array_double->vector();
1013       const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
1014       size_t number = stdv.size();
1015       for(size_t index=0;index<number;index++) {
1016         stdv[index] -= stdv2[index];
1017       }
1018       return true;}
1019     case value::NONE:
1020     case value::VOID_STAR:
1021     case value::BOOL:
1022     case value::SHORT:
1023     case value::INT64:
1024     case value::FLOAT:
1025     //case value::UNSIGNED_CHAR:
1026     //case value::CHAR:
1027     case value::UNSIGNED_SHORT :
1028     case value::UNSIGNED_INT64 :
1029     case value::DOUBLE_STAR:
1030     case value::FLOAT_STAR:
1031     case value::INT_STAR:
1032     case value::STRING:
1033     //case value::ARRAY_UNSIGNED_CHAR:
1034     //case value::ARRAY_CHAR:
1035     case value::ARRAY_UNSIGNED_SHORT:
1036     case value::ARRAY_SHORT:
1037     case value::ARRAY_UNSIGNED_INT:
1038     case value::ARRAY_INT:
1039     case value::ARRAY_UNSIGNED_INT64:
1040     case value::ARRAY_INT64:
1041     case value::ARRAY_FLOAT:
1042     //case value::ARRAY_DOUBLE:
1043     case value::ARRAY_BOOL:
1044     case value::ARRAY_STRING:
1045       break;
1046     }
1047     break;
1048   case value::NONE:
1049   case value::VOID_STAR:
1050   case value::BOOL:
1051   case value::SHORT:
1052   case value::INT64:
1053   //case value::UNSIGNED_CHAR:
1054   //case value::CHAR:
1055   case value::UNSIGNED_SHORT :
1056   case value::UNSIGNED_INT64 :
1057   case value::DOUBLE_STAR:
1058   case value::FLOAT_STAR:
1059   case value::INT_STAR:
1060   case value::STRING:
1061   //case value::ARRAY_UNSIGNED_CHAR:
1062   //case value::ARRAY_CHAR:
1063   case value::ARRAY_UNSIGNED_SHORT:
1064   case value::ARRAY_SHORT:
1065   case value::ARRAY_UNSIGNED_INT:
1066   case value::ARRAY_INT:
1067   case value::ARRAY_UNSIGNED_INT64:
1068   case value::ARRAY_INT64:
1069   case value::ARRAY_FLOAT:
1070   //case value::ARRAY_DOUBLE:
1071   case value::ARRAY_BOOL:
1072   case value::ARRAY_STRING:
1073     break;
1074   }
1075   aError = std::string("Value::subtract :" )
1076          + " can't apply on type " + value::stype(oType)
1077          + " and type " + aV.stype();
1078   aThis.set_none();
1079   return false;
1080 }
1081 
1082 inline bool value::multiply(value& aThis,const value& aV,std::string& aError){
1083   value::e_type oType = aThis.m_type;
1084   switch(aThis.m_type) {
1085   case value::INT:
1086     switch(aV.m_type) {
1087     case value::INT:
1088       aThis.u.m_int *= aV.u.m_int;
1089       return true;
1090     case value::UNSIGNED_INT:
1091       aThis.u.m_int *= aV.u.m_unsigned_int;
1092       return true;
1093     case value::DOUBLE:
1094       aThis.u.m_int *= (int)aV.u.m_double;
1095       return true;
1096     case value::FLOAT:
1097       aThis.u.m_int *= (int)aV.u.m_float;
1098       return true;
1099     case value::ARRAY_DOUBLE:{
1100       int tmp = aThis.u.m_int;
1101       //In the below, this becomes a value::ARRAY_DOUBLE.
1102       aThis.set(aV.u.m_array_double->orders(),
1103                 aV.u.m_array_double->vector());
1104       aThis.u.m_array_double->multiply(double(tmp));
1105       return true;}
1106     case value::NONE:
1107     case value::VOID_STAR:
1108     case value::BOOL:
1109     case value::SHORT:
1110     case value::INT64:
1111     //case value::UNSIGNED_CHAR:
1112     //case value::CHAR:
1113     case value::UNSIGNED_SHORT :
1114     case value::UNSIGNED_INT64 :
1115     case value::DOUBLE_STAR:
1116     case value::FLOAT_STAR:
1117     case value::INT_STAR:
1118     case value::STRING:
1119     //case value::ARRAY_UNSIGNED_CHAR:
1120     //case value::ARRAY_CHAR:
1121     case value::ARRAY_UNSIGNED_SHORT:
1122     case value::ARRAY_SHORT:
1123     case value::ARRAY_UNSIGNED_INT:
1124     case value::ARRAY_INT:
1125     case value::ARRAY_UNSIGNED_INT64:
1126     case value::ARRAY_INT64:
1127     case value::ARRAY_FLOAT:
1128     //case value::ARRAY_DOUBLE:
1129     case value::ARRAY_BOOL:
1130     case value::ARRAY_STRING:
1131       break;
1132     }
1133     break;
1134   case value::FLOAT:
1135     switch(aV.m_type) {
1136     case value::SHORT:
1137       aThis.u.m_float *= aV.u.m_short;
1138       return true;
1139     case value::INT:
1140       aThis.u.m_float *= aV.u.m_int;
1141       return true;
1142     case value::FLOAT:
1143       aThis.u.m_float *= aV.u.m_float;
1144       return true;
1145     case value::DOUBLE:
1146       aThis.u.m_float *= (float)aV.u.m_double;
1147       return true;
1148     case value::UNSIGNED_SHORT :
1149       aThis.u.m_float *= aV.u.m_unsigned_short;
1150       return true;
1151     case value::UNSIGNED_INT:
1152       aThis.u.m_float *= aV.u.m_unsigned_int;
1153       return true;
1154     case value::ARRAY_DOUBLE:{
1155       double tmp = aThis.u.m_float;
1156       //In the below, this becomes a value::ARRAY_DOUBLE.
1157       aThis.set(aV.u.m_array_double->orders(),
1158                 aV.u.m_array_double->vector());
1159       aThis.u.m_array_double->multiply(tmp);
1160       return true;}
1161     case value::NONE:
1162     case value::VOID_STAR:
1163     case value::BOOL:
1164     case value::INT64:
1165     //case value::UNSIGNED_CHAR:
1166     //case value::CHAR:
1167     case value::UNSIGNED_INT64 :
1168     case value::DOUBLE_STAR:
1169     case value::FLOAT_STAR:
1170     case value::INT_STAR:
1171     case value::STRING:
1172     //case value::ARRAY_UNSIGNED_CHAR:
1173     //case value::ARRAY_CHAR:
1174     case value::ARRAY_UNSIGNED_SHORT:
1175     case value::ARRAY_SHORT:
1176     case value::ARRAY_UNSIGNED_INT:
1177     case value::ARRAY_INT:
1178     case value::ARRAY_UNSIGNED_INT64:
1179     case value::ARRAY_INT64:
1180     case value::ARRAY_FLOAT:
1181     //case value::ARRAY_DOUBLE:
1182     case value::ARRAY_BOOL:
1183     case value::ARRAY_STRING:
1184       break;
1185     }
1186     break;
1187   case value::DOUBLE:
1188     switch(aV.m_type) {
1189     case value::SHORT:
1190       aThis.u.m_double *= aV.u.m_short;
1191       return true;
1192     case value::INT:
1193       aThis.u.m_double *= aV.u.m_int;
1194       return true;
1195     case value::INT64:
1196       aThis.u.m_double *= aV.u.m_int64;
1197       return true;
1198     case value::FLOAT:
1199       aThis.u.m_double *= aV.u.m_float;
1200       return true;
1201     case value::DOUBLE:
1202       aThis.u.m_double *= aV.u.m_double;
1203       return true;
1204     case value::UNSIGNED_SHORT :
1205       aThis.u.m_double *= aV.u.m_unsigned_short;
1206       return true;
1207     case value::UNSIGNED_INT:
1208       aThis.u.m_double *= aV.u.m_unsigned_int;
1209       return true;
1210     case value::ARRAY_DOUBLE:{
1211       double tmp = aThis.u.m_double;
1212       //In the below, this becomes a value::ARRAY_DOUBLE.
1213       aThis.set(aV.u.m_array_double->orders(),
1214                 aV.u.m_array_double->vector());
1215       aThis.u.m_array_double->multiply(tmp);
1216       return true;}
1217     case value::NONE:
1218     case value::VOID_STAR:
1219     case value::BOOL:
1220     //case value::UNSIGNED_CHAR:
1221     //case value::CHAR:
1222     case value::UNSIGNED_INT64 :
1223     case value::DOUBLE_STAR:
1224     case value::FLOAT_STAR:
1225     case value::INT_STAR:
1226     case value::STRING:
1227     //case value::ARRAY_UNSIGNED_CHAR:
1228     //case value::ARRAY_CHAR:
1229     case value::ARRAY_UNSIGNED_SHORT:
1230     case value::ARRAY_SHORT:
1231     case value::ARRAY_UNSIGNED_INT:
1232     case value::ARRAY_INT:
1233     case value::ARRAY_UNSIGNED_INT64:
1234     case value::ARRAY_INT64:
1235     case value::ARRAY_FLOAT:
1236     //case value::ARRAY_DOUBLE:
1237     case value::ARRAY_BOOL:
1238     case value::ARRAY_STRING:
1239       break;
1240     }
1241     break;
1242   case value::UNSIGNED_INT:
1243     switch(aV.m_type) {
1244     case value::FLOAT:{
1245       float tmp = aThis.u.m_unsigned_int * aV.u.m_float;
1246       aThis.set(tmp); //this becomes a value::FLOAT.
1247       return true;}
1248     case value::DOUBLE:{
1249       double tmp = aThis.u.m_unsigned_int * aV.u.m_double;
1250       aThis.set(tmp); //this becomes a value::DOUBLE.
1251       return true;}
1252     case value::INT:{
1253       int tmp = aThis.u.m_unsigned_int * aV.u.m_int;
1254       aThis.set(tmp); //this becomes a value::INT.
1255       return true;}
1256     case value::INT64:{
1257       int64 tmp = aThis.u.m_unsigned_int * aV.u.m_int64;
1258       aThis.set(tmp); //this becomes a value::INT64.
1259       return true;}
1260     case value::UNSIGNED_INT:
1261       aThis.u.m_unsigned_int *= aV.u.m_unsigned_int;
1262       return true;
1263     case value::ARRAY_DOUBLE:{
1264       unsigned int tmp = aThis.u.m_unsigned_int;
1265       //In the below, this becomes a value::ARRAY_DOUBLE.
1266       aThis.set(aV.u.m_array_double->orders(),
1267                 aV.u.m_array_double->vector());
1268       aThis.u.m_array_double->multiply(double(tmp));
1269       return true;}
1270     case value::NONE:
1271     case value::VOID_STAR:
1272     case value::BOOL:
1273     case value::SHORT:
1274     //case value::UNSIGNED_CHAR:
1275     //case value::CHAR:
1276     case value::UNSIGNED_SHORT :
1277     case value::UNSIGNED_INT64 :
1278     case value::DOUBLE_STAR:
1279     case value::FLOAT_STAR:
1280     case value::INT_STAR:
1281     case value::STRING:
1282     //case value::ARRAY_UNSIGNED_CHAR:
1283     //case value::ARRAY_CHAR:
1284     case value::ARRAY_UNSIGNED_SHORT:
1285     case value::ARRAY_SHORT:
1286     case value::ARRAY_UNSIGNED_INT:
1287     case value::ARRAY_INT:
1288     case value::ARRAY_UNSIGNED_INT64:
1289     case value::ARRAY_INT64:
1290     case value::ARRAY_FLOAT:
1291     //case value::ARRAY_DOUBLE:
1292     case value::ARRAY_BOOL:
1293     case value::ARRAY_STRING:
1294       break;
1295     }
1296     break;
1297   case value::ARRAY_DOUBLE:
1298     switch(aV.m_type) {
1299     case value::INT:
1300       aThis.u.m_array_double->multiply(aV.u.m_int);
1301       return true;
1302     case value::UNSIGNED_INT:
1303       aThis.u.m_array_double->multiply(aV.u.m_unsigned_int);
1304       return true;
1305     case value::DOUBLE:
1306       aThis.u.m_array_double->multiply(aV.u.m_double);
1307       return true;
1308     case value::ARRAY_DOUBLE:{
1309       if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) {
1310         aError = "Value::multiply : vector orders mismatch.";
1311         aThis.set_none();
1312         return false;
1313       }
1314       std::vector<double>& stdv = aThis.u.m_array_double->vector();
1315       const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
1316       size_t number = stdv.size();
1317       for(size_t index=0;index<number;index++) {
1318         stdv[index] *= stdv2[index];
1319       }
1320       return true;}
1321     case value::NONE:
1322     case value::VOID_STAR:
1323     case value::BOOL:
1324     case value::SHORT:
1325     case value::INT64:
1326     case value::FLOAT:
1327     //case value::UNSIGNED_CHAR:
1328     //case value::CHAR:
1329     case value::UNSIGNED_SHORT :
1330     case value::UNSIGNED_INT64 :
1331     case value::DOUBLE_STAR:
1332     case value::FLOAT_STAR:
1333     case value::INT_STAR:
1334     case value::STRING:
1335     //case value::ARRAY_UNSIGNED_CHAR:
1336     //case value::ARRAY_CHAR:
1337     case value::ARRAY_UNSIGNED_SHORT:
1338     case value::ARRAY_SHORT:
1339     case value::ARRAY_UNSIGNED_INT:
1340     case value::ARRAY_INT:
1341     case value::ARRAY_UNSIGNED_INT64:
1342     case value::ARRAY_INT64:
1343     case value::ARRAY_FLOAT:
1344     //case value::ARRAY_DOUBLE:
1345     case value::ARRAY_BOOL:
1346     case value::ARRAY_STRING:
1347       break;
1348     }
1349     break;
1350   case value::NONE:
1351   case value::STRING:
1352   case value::VOID_STAR:
1353   case value::BOOL:
1354   case value::SHORT:
1355   case value::INT64:
1356   //case value::UNSIGNED_CHAR:
1357   //case value::CHAR:
1358   case value::UNSIGNED_SHORT :
1359   case value::UNSIGNED_INT64 :
1360   case value::DOUBLE_STAR:
1361   case value::FLOAT_STAR:
1362   case value::INT_STAR:
1363   //case value::ARRAY_UNSIGNED_CHAR:
1364   //case value::ARRAY_CHAR:
1365   case value::ARRAY_UNSIGNED_SHORT:
1366   case value::ARRAY_SHORT:
1367   case value::ARRAY_UNSIGNED_INT:
1368   case value::ARRAY_INT:
1369   case value::ARRAY_UNSIGNED_INT64:
1370   case value::ARRAY_INT64:
1371   case value::ARRAY_FLOAT:
1372   //case value::ARRAY_DOUBLE:
1373   case value::ARRAY_BOOL:
1374   case value::ARRAY_STRING:
1375     break;
1376   }
1377   aError = std::string("Value::multiply :" )
1378          + " can't apply on type " + value::stype(oType)
1379          + " and type " + aV.stype();
1380   aThis.set_none();
1381   return false;
1382 }
1383 
1384 inline bool value::divide(value& aThis,const value& aV,std::string& aError){
1385   value::e_type oType = aThis.m_type;
1386   switch(aThis.m_type) {
1387   case value::INT:
1388     switch(aV.m_type) {
1389     case value::INT:
1390       if(aV.u.m_int==0) {
1391         aError = value::error_div_zero();
1392         aThis.set_none();
1393         return false;
1394       } else {
1395         int tmp = aThis.u.m_int/aV.u.m_int;
1396         aThis.set(tmp);
1397         return true;
1398       }
1399     case value::FLOAT:
1400       if(aV.u.m_float==0.0F) {
1401         aError = value::error_div_zero();
1402         aThis.set_none();
1403         return false;
1404       } else {
1405         float tmp = float(aThis.u.m_int)/aV.u.m_float;
1406         aThis.set(tmp);
1407         return true;
1408       }
1409     case value::DOUBLE:
1410       if(aV.u.m_double==0) {
1411         aError = value::error_div_zero();
1412         aThis.set_none();
1413         return false;
1414       } else {
1415         double tmp = double(aThis.u.m_int)/aV.u.m_double;
1416         aThis.set(tmp);
1417         return true;
1418       }
1419     case value::ARRAY_DOUBLE:{
1420       int tmp = aThis.u.m_int;
1421       //In the below, this becomes a value::ARRAY_DOUBLE.
1422       aThis.set(aV.u.m_array_double->orders(),
1423                 aV.u.m_array_double->vector());
1424       if(!aThis.u.m_array_double->invert()) {
1425         aError = value::error_div_zero();
1426         aThis.set_none();
1427         return false;
1428       }
1429       aThis.u.m_array_double->multiply((double)tmp);
1430       return true;}
1431     case value::NONE:
1432     case value::VOID_STAR:
1433     case value::BOOL:
1434     case value::SHORT:
1435     case value::INT64:
1436     //case value::UNSIGNED_CHAR:
1437     //case value::CHAR:
1438     case value::UNSIGNED_SHORT :
1439     case value::UNSIGNED_INT:
1440     case value::UNSIGNED_INT64 :
1441     case value::DOUBLE_STAR:
1442     case value::FLOAT_STAR:
1443     case value::INT_STAR:
1444     case value::STRING:
1445     //case value::ARRAY_UNSIGNED_CHAR:
1446     //case value::ARRAY_CHAR:
1447     case value::ARRAY_UNSIGNED_SHORT:
1448     case value::ARRAY_SHORT:
1449     case value::ARRAY_UNSIGNED_INT:
1450     case value::ARRAY_INT:
1451     case value::ARRAY_UNSIGNED_INT64:
1452     case value::ARRAY_INT64:
1453     case value::ARRAY_FLOAT:
1454     //case value::ARRAY_DOUBLE:
1455     case value::ARRAY_BOOL:
1456     case value::ARRAY_STRING:
1457       break;
1458     }
1459     break;
1460   case value::FLOAT:
1461     switch(aV.m_type) {
1462     case value::INT:
1463       if(aV.u.m_int==0) {
1464         aError = value::error_div_zero();
1465         aThis.set_none();
1466         return false;
1467       } else {
1468         aThis.u.m_float /= aV.u.m_int;
1469         return true;
1470       }
1471     case value::SHORT:
1472       if(aV.u.m_short==0) {
1473         aError = value::error_div_zero();
1474         aThis.set_none();
1475         return false;
1476       } else {
1477         aThis.u.m_float /= aV.u.m_short;
1478         return true;
1479       }
1480     case value::FLOAT:
1481       if(aV.u.m_float==0.0F) {
1482         aError = value::error_div_zero();
1483         aThis.set_none();
1484         return false;
1485       } else {
1486         aThis.u.m_float /= aV.u.m_float;
1487         return true;
1488       }
1489     case value::DOUBLE:
1490       if(aV.u.m_double==0.0F) {
1491         aError = value::error_div_zero();
1492         aThis.set_none();
1493         return false;
1494       } else {
1495         double tmp = double(aThis.u.m_float)/aV.u.m_double;
1496         aThis.set(tmp);
1497         return true;
1498       }
1499     case value::UNSIGNED_INT:
1500       if(aV.u.m_unsigned_int==0) {
1501         aError = value::error_div_zero();
1502         aThis.set_none();
1503         return false;
1504       } else {
1505         aThis.u.m_float /= aV.u.m_unsigned_int;
1506         return true;
1507       }
1508     case value::UNSIGNED_SHORT:
1509       if(aV.u.m_unsigned_short==0) {
1510         aError = value::error_div_zero();
1511         aThis.set_none();
1512         return false;
1513       } else {
1514         aThis.u.m_float /= aV.u.m_unsigned_short;
1515         return true;
1516       }
1517     case value::UNSIGNED_INT64:
1518       if(aV.u.m_unsigned_int64==0) {
1519         aError = value::error_div_zero();
1520         aThis.set_none();
1521         return false;
1522       } else {
1523         double tmp = double(aThis.u.m_float)/aV.u.m_unsigned_int64;
1524         aThis.set(tmp);
1525         return true;
1526       }
1527     case value::INT64:
1528       if(aV.u.m_int64==0) {
1529         aError = value::error_div_zero();
1530         aThis.set_none();
1531         return false;
1532       } else {
1533         double tmp = double(aThis.u.m_float)/aV.u.m_int64;
1534         aThis.set(tmp);
1535         return true;
1536       }
1537     case value::ARRAY_DOUBLE:{
1538       double tmp = aThis.u.m_float;
1539       //In the below, this becomes a value::ARRAY_DOUBLE.
1540       aThis.set(aV.u.m_array_double->orders(),
1541                 aV.u.m_array_double->vector());
1542       if(!aThis.u.m_array_double->invert()) {
1543         aError = value::error_div_zero();
1544         aThis.set_none();
1545         return false;
1546       }
1547       aThis.u.m_array_double->multiply(tmp);
1548       return true;}
1549 
1550     case value::NONE:
1551     case value::VOID_STAR:
1552     case value::BOOL:
1553     //case value::UNSIGNED_CHAR:
1554     //case value::CHAR:
1555     case value::DOUBLE_STAR:
1556     case value::FLOAT_STAR:
1557     case value::INT_STAR:
1558     case value::STRING:
1559     //case value::ARRAY_UNSIGNED_CHAR:
1560     //case value::ARRAY_CHAR:
1561     case value::ARRAY_UNSIGNED_SHORT:
1562     case value::ARRAY_SHORT:
1563     case value::ARRAY_UNSIGNED_INT:
1564     case value::ARRAY_INT:
1565     case value::ARRAY_UNSIGNED_INT64:
1566     case value::ARRAY_INT64:
1567     case value::ARRAY_FLOAT:
1568     //case value::ARRAY_DOUBLE:
1569     case value::ARRAY_BOOL:
1570     case value::ARRAY_STRING:
1571       break;
1572     }
1573     break;
1574   case value::DOUBLE:
1575     switch(aV.m_type) {
1576     case value::SHORT:
1577       if(aV.u.m_short==0) {
1578         aError = value::error_div_zero();
1579         aThis.set_none();
1580         return false;
1581       } else {
1582         aThis.u.m_double /= aV.u.m_short;
1583         return true;
1584       }
1585     case value::INT:
1586       if(aV.u.m_int==0) {
1587         aError = value::error_div_zero();
1588         aThis.set_none();
1589         return false;
1590       } else {
1591         aThis.u.m_double /= aV.u.m_int;
1592         return true;
1593       }
1594     case value::INT64:
1595       if(aV.u.m_int64==0) {
1596         aError = value::error_div_zero();
1597         aThis.set_none();
1598         return false;
1599       } else {
1600         aThis.u.m_double /= aV.u.m_int64;
1601         return true;
1602       }
1603     case value::FLOAT:
1604       if(aV.u.m_float==0.0F) {
1605         aError = value::error_div_zero();
1606         aThis.set_none();
1607         return false;
1608       } else {
1609         aThis.u.m_double /= aV.u.m_float;
1610         return true;
1611       }
1612     case value::DOUBLE:
1613       if(aV.u.m_double==0) {
1614         aError = value::error_div_zero();
1615         aThis.set_none();
1616         return false;
1617       } else {
1618         aThis.u.m_double /= aV.u.m_double;
1619         return true;
1620       }
1621     case value::UNSIGNED_INT:
1622       if(aV.u.m_unsigned_int==0) {
1623         aError = value::error_div_zero();
1624         aThis.set_none();
1625         return false;
1626       } else {
1627         aThis.u.m_double /= aV.u.m_unsigned_int;
1628         return true;
1629       }
1630     case value::UNSIGNED_SHORT:
1631       if(aV.u.m_unsigned_short==0) {
1632         aError = value::error_div_zero();
1633         aThis.set_none();
1634         return false;
1635       } else {
1636         aThis.u.m_double /= aV.u.m_unsigned_short;
1637         return true;
1638       }
1639     case value::UNSIGNED_INT64:
1640       if(aV.u.m_unsigned_int64==0) {
1641         aError = value::error_div_zero();
1642         aThis.set_none();
1643         return false;
1644       } else {
1645         aThis.u.m_double /= aV.u.m_unsigned_int64;
1646         return true;
1647       }
1648     case value::ARRAY_DOUBLE:{
1649       double tmp = aThis.u.m_double;
1650       //In the below, this becomes a value::ARRAY_DOUBLE.
1651       aThis.set(aV.u.m_array_double->orders(),
1652                 aV.u.m_array_double->vector());
1653       if(!aThis.u.m_array_double->invert()) {
1654         aError = value::error_div_zero();
1655         aThis.set_none();
1656         return false;
1657       }
1658       aThis.u.m_array_double->multiply(tmp);
1659       return true;}
1660 
1661     case value::NONE:
1662     case value::VOID_STAR:
1663     case value::BOOL:
1664     //case value::UNSIGNED_CHAR:
1665     //case value::CHAR:
1666     case value::DOUBLE_STAR:
1667     case value::FLOAT_STAR:
1668     case value::INT_STAR:
1669     case value::STRING:
1670     //case value::ARRAY_UNSIGNED_CHAR:
1671     //case value::ARRAY_CHAR:
1672     case value::ARRAY_UNSIGNED_SHORT:
1673     case value::ARRAY_SHORT:
1674     case value::ARRAY_UNSIGNED_INT:
1675     case value::ARRAY_INT:
1676     case value::ARRAY_UNSIGNED_INT64:
1677     case value::ARRAY_INT64:
1678     case value::ARRAY_FLOAT:
1679     //case value::ARRAY_DOUBLE:
1680     case value::ARRAY_BOOL:
1681     case value::ARRAY_STRING:
1682       break;
1683     }
1684     break;
1685   case value::UNSIGNED_INT:
1686     switch(aV.m_type) {
1687     case value::UNSIGNED_INT:
1688       if(aV.u.m_unsigned_int==0) {
1689         aError = value::error_div_zero();
1690         aThis.set_none();
1691         return false;
1692       } else {
1693         unsigned int tmp = aThis.u.m_unsigned_int/aV.u.m_unsigned_int;
1694         aThis.set(tmp);
1695         return true;
1696       }
1697     case value::FLOAT:
1698       if(aV.u.m_float==0) {
1699         aError = value::error_div_zero();
1700         aThis.set_none();
1701         return false;
1702       } else {
1703         float d = float(aThis.u.m_unsigned_int)/aV.u.m_float;
1704         aThis.set(d); //this becomes a value::FLOAT.
1705         return true;
1706       }
1707     case value::DOUBLE:
1708       if(aV.u.m_double==0) {
1709         aError = value::error_div_zero();
1710         aThis.set_none();
1711         return false;
1712       } else {
1713         double d = double(aThis.u.m_unsigned_int)/aV.u.m_double;
1714         aThis.set(d); //this becomes a value::DOUBLE.
1715         return true;
1716       }
1717     case value::ARRAY_DOUBLE:{
1718       unsigned int tmp = aThis.u.m_unsigned_int;
1719       //In the below, this becomes a value::ARRAY_DOUBLE.
1720       aThis.set(aV.u.m_array_double->orders(),
1721                 aV.u.m_array_double->vector());
1722       if(!aThis.u.m_array_double->invert()) {
1723         aError = value::error_div_zero();
1724         aThis.set_none();
1725         return false;
1726       }
1727       aThis.u.m_array_double->multiply(double(tmp));
1728       return true;}
1729 
1730     case value::NONE:
1731     case value::INT:
1732     case value::VOID_STAR:
1733     case value::BOOL:
1734     case value::SHORT:
1735     case value::INT64:
1736     //case value::UNSIGNED_CHAR:
1737     //case value::CHAR:
1738     case value::UNSIGNED_SHORT :
1739     case value::UNSIGNED_INT64 :
1740     case value::DOUBLE_STAR:
1741     case value::FLOAT_STAR:
1742     case value::INT_STAR:
1743     case value::STRING:
1744     //case value::ARRAY_UNSIGNED_CHAR:
1745     //case value::ARRAY_CHAR:
1746     case value::ARRAY_UNSIGNED_SHORT:
1747     case value::ARRAY_SHORT:
1748     case value::ARRAY_UNSIGNED_INT:
1749     case value::ARRAY_INT:
1750     case value::ARRAY_UNSIGNED_INT64:
1751     case value::ARRAY_INT64:
1752     case value::ARRAY_FLOAT:
1753     //case value::ARRAY_DOUBLE:
1754     case value::ARRAY_BOOL:
1755     case value::ARRAY_STRING:
1756       break;
1757     }
1758     break;
1759   case value::ARRAY_DOUBLE:
1760     switch(aV.m_type) {
1761     case value::INT:
1762       if(aV.u.m_int==0) {
1763         aError = value::error_div_zero();
1764         aThis.set_none();
1765         return false;
1766       } else {
1767         double value = 1./aV.u.m_int;
1768         aThis.u.m_array_double->multiply(value);
1769         return true;
1770       }
1771     case value::UNSIGNED_INT:
1772       if(aV.u.m_unsigned_int==0) {
1773         aError = value::error_div_zero();
1774         aThis.set_none();
1775         return false;
1776       } else {
1777         double value = 1./aV.u.m_unsigned_int;
1778         aThis.u.m_array_double->multiply(value);
1779         return true;
1780       }
1781     case value::DOUBLE:
1782       if(aV.u.m_double==0) {
1783         aError = value::error_div_zero();
1784         aThis.set_none();
1785         return false;
1786       } else {
1787         aThis.u.m_array_double->multiply(1./aV.u.m_double);
1788         return true;
1789       }
1790     case value::ARRAY_DOUBLE:{
1791       if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) {
1792         aError = value::error_div_zero(); //FIXME : error_mismatch_orders
1793         aThis.set_none();
1794         return false;
1795       }
1796       std::vector<double>& stdv = aThis.u.m_array_double->vector();
1797       const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
1798       bool has_div_zero = false;
1799       size_t number = stdv.size();
1800       for(size_t index=0;index<number;index++) {
1801         if(stdv2[index]==0) {
1802           //FIXME : stdv[index] = nan;
1803           stdv[index] = 0; //PAW convention.
1804           has_div_zero = true;
1805         } else {
1806           stdv[index] /= stdv2[index];
1807         }
1808       }
1809       if(has_div_zero) {
1810         aError = value::error_div_zero();
1811         // For OpenPAW/pasigm::SIGMA, continue anyway in case of /0 errors.
1812         //aThis.set_none();
1813         //return false; //FIXME : is so, then it will stop Processor.
1814         return true; //FIXME : do we want that ?
1815       }
1816 
1817       return true;}
1818 
1819     case value::NONE:
1820     case value::STRING:
1821     case value::VOID_STAR:
1822     case value::BOOL:
1823     case value::SHORT:
1824     case value::FLOAT:
1825     //case value::UNSIGNED_CHAR:
1826     //case value::CHAR:
1827     case value::INT64:
1828     case value::UNSIGNED_SHORT :
1829     case value::UNSIGNED_INT64 :
1830     case value::DOUBLE_STAR:
1831     case value::FLOAT_STAR:
1832     case value::INT_STAR:
1833     //case value::ARRAY_UNSIGNED_CHAR:
1834     //case value::ARRAY_CHAR:
1835     case value::ARRAY_UNSIGNED_SHORT:
1836     case value::ARRAY_SHORT:
1837     case value::ARRAY_UNSIGNED_INT:
1838     case value::ARRAY_INT:
1839     case value::ARRAY_UNSIGNED_INT64:
1840     case value::ARRAY_INT64:
1841     case value::ARRAY_FLOAT:
1842     //case value::ARRAY_DOUBLE:
1843     case value::ARRAY_BOOL:
1844     case value::ARRAY_STRING:
1845       break;
1846     }
1847     break;
1848 
1849   case value::NONE:
1850   case value::STRING:
1851   case value::VOID_STAR:
1852   case value::BOOL:
1853   case value::SHORT:
1854   //case value::UNSIGNED_CHAR:
1855   //case value::CHAR:
1856   case value::INT64:
1857   case value::UNSIGNED_SHORT :
1858   case value::UNSIGNED_INT64 :
1859   case value::DOUBLE_STAR:
1860   case value::FLOAT_STAR:
1861   case value::INT_STAR:
1862   //case value::ARRAY_UNSIGNED_CHAR:
1863   //case value::ARRAY_CHAR:
1864   case value::ARRAY_UNSIGNED_SHORT:
1865   case value::ARRAY_SHORT:
1866   case value::ARRAY_UNSIGNED_INT:
1867   case value::ARRAY_INT:
1868   case value::ARRAY_UNSIGNED_INT64:
1869   case value::ARRAY_INT64:
1870   case value::ARRAY_FLOAT:
1871   //case value::ARRAY_DOUBLE:
1872   case value::ARRAY_BOOL:
1873   case value::ARRAY_STRING:
1874     break;
1875   }
1876   aError = std::string("Value::divide :")
1877          + " can't apply on type " + value::stype(oType)
1878          + " and type " + aV.stype();
1879   aThis.set_none();
1880   return false;
1881 }
1882 
1883 //////////////////////////////////////////////////////////////////////////////
1884 //////////////////////////////////////////////////////////////////////////////
1885 //////////////////////////////////////////////////////////////////////////////
1886 
1887 inline bool value::if_gt(value& aThis,const value& aV,std::string& aError){
1888   value::e_type oType = aThis.m_type;
1889   switch(aThis.m_type) {
1890   case value::INT:
1891     switch(aV.m_type) {
1892     case value::INT:
1893       aThis.set((bool)(aThis.u.m_int>aV.u.m_int?true:false));
1894       return true;
1895     case value::FLOAT:
1896       aThis.set((bool)(aThis.u.m_int>aV.u.m_float?true:false));
1897       return true;
1898     case value::DOUBLE:
1899       aThis.set((bool)(aThis.u.m_int>aV.u.m_double?true:false));
1900       return true;
1901     case value::UNSIGNED_SHORT :
1902       aThis.set((bool)(aThis.u.m_int>(int)aV.u.m_unsigned_short?true:false));
1903       return true;
1904     case value::UNSIGNED_INT:
1905       aThis.set((bool)(aThis.u.m_int>(int)aV.u.m_unsigned_int?true:false));
1906       return true;
1907     case value::ARRAY_DOUBLE:{
1908       const std::vector<double>& stdv = aV.u.m_array_double->vector();
1909       size_t number = stdv.size();
1910       for(size_t index=0;index<number;index++) {
1911         if(aThis.u.m_int<=stdv[index]) {
1912           aThis.set(false);
1913           return true;
1914         }
1915       }
1916       aThis.set(true);
1917       return true;
1918     }
1919     case value::NONE:
1920     case value::VOID_STAR:
1921     case value::BOOL:
1922     case value::SHORT:
1923     case value::INT64:
1924     //case value::UNSIGNED_CHAR:
1925     //case value::CHAR:
1926     case value::UNSIGNED_INT64 :
1927     case value::DOUBLE_STAR:
1928     case value::FLOAT_STAR:
1929     case value::INT_STAR:
1930     case value::STRING:
1931     //case value::ARRAY_UNSIGNED_CHAR:
1932     //case value::ARRAY_CHAR:
1933     case value::ARRAY_UNSIGNED_SHORT:
1934     case value::ARRAY_SHORT:
1935     case value::ARRAY_UNSIGNED_INT:
1936     case value::ARRAY_INT:
1937     case value::ARRAY_UNSIGNED_INT64:
1938     case value::ARRAY_INT64:
1939     case value::ARRAY_FLOAT:
1940     //case value::ARRAY_DOUBLE:
1941     case value::ARRAY_BOOL:
1942     case value::ARRAY_STRING:
1943       break;
1944     }
1945     break;
1946   case value::DOUBLE:
1947     switch(aV.m_type) {
1948     case value::DOUBLE:
1949       aThis.set((bool)(aThis.u.m_double>aV.u.m_double?true:false));
1950       return true;
1951     case value::FLOAT:
1952       aThis.set((bool)(aThis.u.m_double>aV.u.m_float?true:false));
1953       return true;
1954     case value::INT:
1955       aThis.set((bool)(aThis.u.m_double>aV.u.m_int?true:false));
1956       return true;
1957     case value::UNSIGNED_SHORT :
1958       aThis.set((bool)(aThis.u.m_double>aV.u.m_unsigned_short?true:false));
1959       return true;
1960     case value::UNSIGNED_INT:
1961       aThis.set((bool)(aThis.u.m_double>aV.u.m_unsigned_int?true:false));
1962       return true;
1963     case value::ARRAY_DOUBLE:{
1964       const std::vector<double>& stdv = aV.u.m_array_double->vector();
1965       size_t number = stdv.size();
1966       for(size_t index=0;index<number;index++) {
1967         if(aThis.u.m_double<=stdv[index]) {
1968           aThis.set(false);
1969           return true;
1970         }
1971       }
1972       aThis.set(true);
1973       return true;
1974     }
1975     case value::NONE:
1976     case value::VOID_STAR:
1977     case value::BOOL:
1978     case value::SHORT:
1979     case value::INT64:
1980     //case value::UNSIGNED_CHAR:
1981     //case value::CHAR:
1982     case value::UNSIGNED_INT64 :
1983     case value::DOUBLE_STAR:
1984     case value::FLOAT_STAR:
1985     case value::INT_STAR:
1986     case value::STRING:
1987     //case value::ARRAY_UNSIGNED_CHAR:
1988     //case value::ARRAY_CHAR:
1989     case value::ARRAY_UNSIGNED_SHORT:
1990     case value::ARRAY_SHORT:
1991     case value::ARRAY_UNSIGNED_INT:
1992     case value::ARRAY_INT:
1993     case value::ARRAY_UNSIGNED_INT64:
1994     case value::ARRAY_INT64:
1995     case value::ARRAY_FLOAT:
1996     //case value::ARRAY_DOUBLE:
1997     case value::ARRAY_BOOL:
1998     case value::ARRAY_STRING:
1999       break;
2000     }
2001     break;
2002   case value::FLOAT:
2003     switch(aV.m_type) {
2004     case value::DOUBLE:
2005       aThis.set((bool)(aThis.u.m_float>aV.u.m_double?true:false));
2006       return true;
2007     case value::FLOAT:
2008       aThis.set((bool)(aThis.u.m_float>aV.u.m_float?true:false));
2009       return true;
2010     case value::INT:
2011       aThis.set((bool)(aThis.u.m_float>aV.u.m_int?true:false));
2012       return true;
2013     case value::UNSIGNED_SHORT :
2014       aThis.set((bool)(aThis.u.m_float>aV.u.m_unsigned_short?true:false));
2015       return true;
2016     case value::UNSIGNED_INT:
2017       aThis.set((bool)(aThis.u.m_float>aV.u.m_unsigned_int?true:false));
2018       return true;
2019     case value::ARRAY_DOUBLE:{
2020       const std::vector<double>& stdv = aV.u.m_array_double->vector();
2021       size_t number = stdv.size();
2022       for(size_t index=0;index<number;index++) {
2023         if(aThis.u.m_float<=stdv[index]) {
2024           aThis.set(false);
2025           return true;
2026         }
2027       }
2028       aThis.set(true);
2029       return true;
2030     }
2031     case value::NONE:
2032     case value::VOID_STAR:
2033     case value::BOOL:
2034     case value::SHORT:
2035     case value::INT64:
2036     //case value::UNSIGNED_CHAR:
2037     //case value::CHAR:
2038     case value::UNSIGNED_INT64 :
2039     case value::DOUBLE_STAR:
2040     case value::FLOAT_STAR:
2041     case value::INT_STAR:
2042     case value::STRING:
2043     //case value::ARRAY_UNSIGNED_CHAR:
2044     //case value::ARRAY_CHAR:
2045     case value::ARRAY_UNSIGNED_SHORT:
2046     case value::ARRAY_SHORT:
2047     case value::ARRAY_UNSIGNED_INT:
2048     case value::ARRAY_INT:
2049     case value::ARRAY_UNSIGNED_INT64:
2050     case value::ARRAY_INT64:
2051     case value::ARRAY_FLOAT:
2052     //case value::ARRAY_DOUBLE:
2053     case value::ARRAY_BOOL:
2054     case value::ARRAY_STRING:
2055       break;
2056     }
2057     break;
2058   case value::VOID_STAR:
2059     switch(aV.m_type) {
2060     case value::VOID_STAR:
2061       aThis.set((bool)(aThis.u.m_void_star>aV.u.m_void_star?true:false));
2062       return true;
2063     case value::NONE:
2064     case value::INT:
2065     case value::DOUBLE:
2066     case value::BOOL:
2067     case value::SHORT:
2068     case value::INT64:
2069     case value::FLOAT:
2070     //case value::UNSIGNED_CHAR:
2071     //case value::CHAR:
2072     case value::UNSIGNED_SHORT :
2073     case value::UNSIGNED_INT:
2074     case value::UNSIGNED_INT64 :
2075     case value::DOUBLE_STAR:
2076     case value::FLOAT_STAR:
2077     case value::INT_STAR:
2078     case value::STRING:
2079     //case value::ARRAY_UNSIGNED_CHAR:
2080     //case value::ARRAY_CHAR:
2081     case value::ARRAY_UNSIGNED_SHORT:
2082     case value::ARRAY_SHORT:
2083     case value::ARRAY_UNSIGNED_INT:
2084     case value::ARRAY_INT:
2085     case value::ARRAY_UNSIGNED_INT64:
2086     case value::ARRAY_INT64:
2087     case value::ARRAY_FLOAT:
2088     case value::ARRAY_DOUBLE:
2089     case value::ARRAY_BOOL:
2090     case value::ARRAY_STRING:
2091       break;
2092     }
2093     break;
2094   case value::UNSIGNED_INT:
2095     switch(aV.m_type) {
2096     case value::UNSIGNED_INT:
2097       aThis.set((bool)(aThis.u.m_unsigned_int >aV.u.m_unsigned_int ?true:false));
2098       return true;
2099     case value::INT:
2100       aThis.set((bool)((int)aThis.u.m_unsigned_int >aV.u.m_int?true:false));
2101       return true;
2102     case value::DOUBLE:
2103       aThis.set((bool)(double(aThis.u.m_unsigned_int)>aV.u.m_double?true:false));
2104       return true;
2105     case value::FLOAT:
2106       aThis.set((bool)(float(aThis.u.m_unsigned_int)>aV.u.m_float?true:false));
2107       return true;
2108     case value::NONE:
2109     case value::VOID_STAR:
2110     case value::BOOL:
2111     case value::SHORT:
2112     case value::INT64:
2113     //case value::UNSIGNED_CHAR:
2114     //case value::CHAR:
2115     case value::UNSIGNED_SHORT :
2116     case value::UNSIGNED_INT64 :
2117     case value::DOUBLE_STAR:
2118     case value::FLOAT_STAR:
2119     case value::INT_STAR:
2120     case value::STRING:
2121     //case value::ARRAY_UNSIGNED_CHAR:
2122     //case value::ARRAY_CHAR:
2123     case value::ARRAY_UNSIGNED_SHORT:
2124     case value::ARRAY_SHORT:
2125     case value::ARRAY_UNSIGNED_INT:
2126     case value::ARRAY_INT:
2127     case value::ARRAY_UNSIGNED_INT64:
2128     case value::ARRAY_INT64:
2129     case value::ARRAY_FLOAT:
2130     case value::ARRAY_DOUBLE:
2131     case value::ARRAY_BOOL:
2132     case value::ARRAY_STRING:
2133       break;
2134     }
2135     break;
2136   case value::ARRAY_DOUBLE:
2137     switch(aV.m_type) {
2138     case value::INT:{
2139       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2140       size_t number = stdv.size();
2141       for(size_t index=0;index<number;index++) {
2142         if(stdv[index]<=aV.u.m_int) {
2143           aThis.set(false);
2144           return true;
2145         }
2146       }
2147       aThis.set(true);
2148       return true;
2149     }
2150     case value::FLOAT:{
2151       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2152       size_t number = stdv.size();
2153       for(size_t index=0;index<number;index++) {
2154         if(stdv[index]<=aV.u.m_float) {
2155           aThis.set(false);
2156           return true;
2157         }
2158       }
2159       aThis.set(true);
2160       return true;
2161     }
2162     case value::DOUBLE:{
2163       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2164       size_t number = stdv.size();
2165       for(size_t index=0;index<number;index++) {
2166         if(stdv[index]<=aV.u.m_double) {
2167           aThis.set(false);
2168           return true;
2169         }
2170       }
2171       aThis.set(true);
2172       return true;
2173     }
2174     case value::UNSIGNED_INT:{
2175       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2176       size_t number = stdv.size();
2177       for(size_t index=0;index<number;index++) {
2178         if(stdv[index]<=aV.u.m_unsigned_int ) {
2179           aThis.set(false);
2180           return true;
2181         }
2182       }
2183       aThis.set(true);
2184       return true;
2185     }
2186     case value::ARRAY_DOUBLE:{
2187       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2188       const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
2189       if(stdv.size()!=stdv2.size()) break;
2190       size_t number = stdv.size();
2191       for(size_t index=0;index<number;index++) {
2192         if(stdv[index]<=stdv2[index]) {
2193           aThis.set(false);
2194           return true;
2195         }
2196       }
2197       aThis.set(true);
2198       return true;
2199     }
2200     case value::NONE:
2201     case value::VOID_STAR:
2202     case value::BOOL:
2203     case value::SHORT:
2204     case value::INT64:
2205     //case value::UNSIGNED_CHAR:
2206     //case value::CHAR:
2207     case value::UNSIGNED_SHORT :
2208     case value::UNSIGNED_INT64 :
2209     case value::DOUBLE_STAR:
2210     case value::FLOAT_STAR:
2211     case value::INT_STAR:
2212     case value::STRING:
2213     //case value::ARRAY_UNSIGNED_CHAR:
2214     //case value::ARRAY_CHAR:
2215     case value::ARRAY_UNSIGNED_SHORT:
2216     case value::ARRAY_SHORT:
2217     case value::ARRAY_UNSIGNED_INT:
2218     case value::ARRAY_INT:
2219     case value::ARRAY_UNSIGNED_INT64:
2220     case value::ARRAY_INT64:
2221     case value::ARRAY_FLOAT:
2222     //case value::ARRAY_DOUBLE:
2223     case value::ARRAY_BOOL:
2224     case value::ARRAY_STRING:
2225       break;
2226     }
2227     break;
2228   case value::NONE:
2229   case value::BOOL:
2230   case value::SHORT:
2231   //case value::UNSIGNED_CHAR:
2232   //case value::CHAR:
2233   case value::STRING:
2234   case value::INT64:
2235   case value::UNSIGNED_SHORT :
2236   case value::UNSIGNED_INT64 :
2237   case value::DOUBLE_STAR:
2238   case value::FLOAT_STAR:
2239   case value::INT_STAR:
2240   //case value::ARRAY_UNSIGNED_CHAR:
2241   //case value::ARRAY_CHAR:
2242   case value::ARRAY_UNSIGNED_SHORT:
2243   case value::ARRAY_SHORT:
2244   case value::ARRAY_UNSIGNED_INT:
2245   case value::ARRAY_INT:
2246   case value::ARRAY_UNSIGNED_INT64:
2247   case value::ARRAY_INT64:
2248   case value::ARRAY_FLOAT:
2249 //case value::ARRAY_DOUBLE:
2250   case value::ARRAY_BOOL:
2251   case value::ARRAY_STRING:
2252     break;
2253   }
2254   aError = std::string("Value::if_gt() :")
2255          + " can't compare type " + value::stype(oType)
2256          + " with type " + aV.stype();
2257   aThis.set_none();
2258   return false;
2259 }
2260 
2261 inline bool value::if_eq(value& aThis,const value& aV,std::string& aError){
2262   value::e_type oType = aThis.m_type;
2263   switch(aThis.m_type) {
2264   case value::INT:
2265     switch(aV.m_type) {
2266     case value::INT:
2267       aThis.set((bool)(aThis.u.m_int==aV.u.m_int?true:false));
2268       return true;
2269     case value::DOUBLE:
2270       aThis.set((bool)(aThis.u.m_int==aV.u.m_double?true:false));
2271       return true;
2272     case value::FLOAT:
2273       aThis.set((bool)(aThis.u.m_int==aV.u.m_float?true:false));
2274       return true;
2275     case value::UNSIGNED_SHORT :
2276       aThis.set((bool)(aThis.u.m_int==(int)aV.u.m_unsigned_short?true:false));
2277       return true;
2278     case value::UNSIGNED_INT:
2279       aThis.set((bool)(aThis.u.m_int==(int)aV.u.m_unsigned_int ?true:false));
2280       return true;
2281     case value::ARRAY_DOUBLE:{
2282       const std::vector<double>& stdv = aV.u.m_array_double->vector();
2283       size_t number = stdv.size();
2284       for(size_t index=0;index<number;index++) {
2285         if(aThis.u.m_int!=stdv[index]) {
2286           aThis.set(false);
2287           return true;
2288         }
2289       }
2290       aThis.set(true);
2291       return true;
2292     }
2293 
2294     case value::NONE:
2295     case value::STRING:
2296     case value::VOID_STAR:
2297     case value::BOOL:
2298     case value::SHORT:
2299     case value::INT64:
2300     //case value::UNSIGNED_CHAR:
2301     //case value::CHAR:
2302     case value::UNSIGNED_INT64 :
2303     case value::DOUBLE_STAR:
2304     case value::FLOAT_STAR:
2305     case value::INT_STAR:
2306 
2307     //case value::ARRAY_UNSIGNED_CHAR:
2308     //case value::ARRAY_CHAR:
2309     case value::ARRAY_UNSIGNED_SHORT:
2310     case value::ARRAY_SHORT:
2311     case value::ARRAY_UNSIGNED_INT:
2312     case value::ARRAY_INT:
2313     case value::ARRAY_UNSIGNED_INT64:
2314     case value::ARRAY_INT64:
2315     case value::ARRAY_FLOAT:
2316     //case value::ARRAY_DOUBLE:
2317     case value::ARRAY_BOOL:
2318     case value::ARRAY_STRING:
2319       break;
2320     }
2321     break;
2322   case value::FLOAT:
2323     switch(aV.m_type) {
2324     case value::FLOAT:
2325       aThis.set((bool)(aThis.u.m_float==aV.u.m_float?true:false));
2326       return true;
2327     case value::DOUBLE:
2328       aThis.set((bool)(aThis.u.m_float==aV.u.m_double?true:false));
2329       return true;
2330     case value::INT:
2331       aThis.set((bool)(aThis.u.m_float==aV.u.m_int?true:false));
2332       return true;
2333     case value::UNSIGNED_SHORT :
2334       aThis.set((bool)(aThis.u.m_float==aV.u.m_unsigned_short?true:false));
2335       return true;
2336     case value::UNSIGNED_INT:
2337       aThis.set((bool)(aThis.u.m_float==aV.u.m_unsigned_int?true:false));
2338       return true;
2339     case value::ARRAY_DOUBLE:{
2340       const std::vector<double>& stdv = aV.u.m_array_double->vector();
2341       size_t number = stdv.size();
2342       for(size_t index=0;index<number;index++) {
2343         if(aThis.u.m_float!=stdv[index]) {
2344           aThis.set(false);
2345           return true;
2346         }
2347       }
2348       aThis.set(true);
2349       return true;
2350     }
2351     case value::NONE:
2352     case value::STRING:
2353     case value::VOID_STAR:
2354     case value::BOOL:
2355     case value::SHORT:
2356     //case value::UNSIGNED_CHAR:
2357     //case value::CHAR:
2358     case value::INT64:
2359     case value::UNSIGNED_INT64 :
2360     case value::DOUBLE_STAR:
2361     case value::FLOAT_STAR:
2362     case value::INT_STAR:
2363     //case value::ARRAY_UNSIGNED_CHAR:
2364     //case value::ARRAY_CHAR:
2365     case value::ARRAY_UNSIGNED_SHORT:
2366     case value::ARRAY_SHORT:
2367     case value::ARRAY_UNSIGNED_INT:
2368     case value::ARRAY_INT:
2369     case value::ARRAY_UNSIGNED_INT64:
2370     case value::ARRAY_INT64:
2371     case value::ARRAY_FLOAT:
2372     //case value::ARRAY_DOUBLE:
2373     case value::ARRAY_BOOL:
2374     case value::ARRAY_STRING:
2375       break;
2376     }
2377     break;
2378   case value::DOUBLE:
2379     switch(aV.m_type) {
2380     case value::DOUBLE:
2381       aThis.set((bool)(aThis.u.m_double==aV.u.m_double?true:false));
2382       return true;
2383     case value::FLOAT:
2384       aThis.set((bool)(aThis.u.m_double==aV.u.m_float?true:false));
2385       return true;
2386     case value::INT:
2387       aThis.set((bool)(aThis.u.m_double==aV.u.m_int?true:false));
2388       return true;
2389     case value::UNSIGNED_SHORT :
2390       aThis.set((bool)(aThis.u.m_double==aV.u.m_unsigned_short?true:false));
2391       return true;
2392     case value::UNSIGNED_INT:
2393       aThis.set((bool)(aThis.u.m_double==aV.u.m_unsigned_int ?true:false));
2394       return true;
2395     case value::ARRAY_DOUBLE:{
2396       const std::vector<double>& stdv = aV.u.m_array_double->vector();
2397       size_t number = stdv.size();
2398       for(size_t index=0;index<number;index++) {
2399         if(aThis.u.m_double!=stdv[index]) {
2400           aThis.set(false);
2401           return true;
2402         }
2403       }
2404       aThis.set(true);
2405       return true;
2406     }
2407     case value::NONE:
2408     case value::STRING:
2409     case value::VOID_STAR:
2410     case value::BOOL:
2411     case value::SHORT:
2412     //case value::UNSIGNED_CHAR:
2413     //case value::CHAR:
2414     case value::INT64:
2415     case value::UNSIGNED_INT64 :
2416     case value::DOUBLE_STAR:
2417     case value::FLOAT_STAR:
2418     case value::INT_STAR:
2419     //case value::ARRAY_UNSIGNED_CHAR:
2420     //case value::ARRAY_CHAR:
2421     case value::ARRAY_UNSIGNED_SHORT:
2422     case value::ARRAY_SHORT:
2423     case value::ARRAY_UNSIGNED_INT:
2424     case value::ARRAY_INT:
2425     case value::ARRAY_UNSIGNED_INT64:
2426     case value::ARRAY_INT64:
2427     case value::ARRAY_FLOAT:
2428     //case value::ARRAY_DOUBLE:
2429     case value::ARRAY_BOOL:
2430     case value::ARRAY_STRING:
2431       break;
2432     }
2433     break;
2434   case value::STRING:
2435     switch(aV.m_type) {
2436     case value::STRING:
2437       aThis.set((bool)((*aThis.u.m_string)==(*aV.u.m_string)?true:false));
2438       return true;
2439     case value::INT:
2440      {int v;
2441       if(!to<int>(*aThis.u.m_string,v)) break;
2442       aThis.set((bool)(v==aV.u.m_int?true:false));
2443       return true;}
2444     case value::FLOAT:
2445      {float v;
2446       if(!to<float>(*aThis.u.m_string,v)) break;
2447       aThis.set((bool)(v==aV.u.m_float?true:false));
2448       return true;}
2449     case value::DOUBLE:
2450      {double v;
2451       if(!to<double>(*aThis.u.m_string,v)) break;
2452       aThis.set((bool)(v==aV.u.m_double?true:false));
2453       return true;}
2454     case value::UNSIGNED_INT:
2455      {typedef unsigned int uint_t;
2456       uint_t v;
2457       if(!to<uint_t>(*aThis.u.m_string,v)) break;
2458       aThis.set((bool)(v==aV.u.m_unsigned_int ?true:false));
2459       return true;}
2460     case value::BOOL:
2461      {bool v;
2462       if(!to(*aThis.u.m_string,v)) break;
2463       aThis.set((bool)(v==aV.u.m_bool?true:false));
2464       return true;}
2465     case value::NONE:
2466     case value::VOID_STAR:
2467     case value::SHORT:
2468     //case value::UNSIGNED_CHAR:
2469     //case value::CHAR:
2470     case value::INT64:
2471     case value::UNSIGNED_SHORT :
2472     case value::UNSIGNED_INT64 :
2473     case value::DOUBLE_STAR:
2474     case value::FLOAT_STAR:
2475     case value::INT_STAR:
2476     //case value::ARRAY_UNSIGNED_CHAR:
2477     //case value::ARRAY_CHAR:
2478     case value::ARRAY_UNSIGNED_SHORT:
2479     case value::ARRAY_SHORT:
2480     case value::ARRAY_UNSIGNED_INT:
2481     case value::ARRAY_INT:
2482     case value::ARRAY_UNSIGNED_INT64:
2483     case value::ARRAY_INT64:
2484     case value::ARRAY_FLOAT:
2485     case value::ARRAY_DOUBLE:
2486     case value::ARRAY_BOOL:
2487     case value::ARRAY_STRING:
2488       break;
2489     }
2490     break;
2491   case value::VOID_STAR:
2492     switch(aV.m_type) {
2493     case value::VOID_STAR:
2494       aThis.set((bool)(aThis.u.m_void_star==aV.u.m_void_star?true:false));
2495       return true;
2496     case value::NONE:
2497     case value::INT:
2498     case value::DOUBLE:
2499     case value::BOOL:
2500     case value::SHORT:
2501     case value::INT64:
2502     case value::FLOAT:
2503     //case value::UNSIGNED_CHAR:
2504     //case value::CHAR:
2505     case value::UNSIGNED_SHORT :
2506     case value::UNSIGNED_INT:
2507     case value::UNSIGNED_INT64 :
2508     case value::DOUBLE_STAR:
2509     case value::FLOAT_STAR:
2510     case value::INT_STAR:
2511     case value::STRING:
2512     //case value::ARRAY_UNSIGNED_CHAR:
2513     //case value::ARRAY_CHAR:
2514     case value::ARRAY_UNSIGNED_SHORT:
2515     case value::ARRAY_SHORT:
2516     case value::ARRAY_UNSIGNED_INT:
2517     case value::ARRAY_INT:
2518     case value::ARRAY_UNSIGNED_INT64:
2519     case value::ARRAY_INT64:
2520     case value::ARRAY_FLOAT:
2521     case value::ARRAY_DOUBLE:
2522     case value::ARRAY_BOOL:
2523     case value::ARRAY_STRING:
2524       break;
2525     }
2526     break;
2527   case value::UNSIGNED_INT:
2528     switch(aV.m_type) {
2529     case value::UNSIGNED_INT:
2530       aThis.set((bool)(aThis.u.m_unsigned_int ==aV.u.m_unsigned_int ?true:false));
2531       return true;
2532     case value::INT:
2533       aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_int?true:false));
2534       return true;
2535     case value::FLOAT:
2536       aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_float?true:false));
2537       return true;
2538     case value::DOUBLE:
2539       aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_double?true:false));
2540       return true;
2541     case value::ARRAY_DOUBLE:{
2542       const std::vector<double>& stdv = aV.u.m_array_double->vector();
2543       size_t number = stdv.size();
2544       for(size_t index=0;index<number;index++) {
2545         if(aThis.u.m_unsigned_int !=stdv[index]) {
2546           aThis.set(false);
2547           return true;
2548         }
2549       }
2550       aThis.set(true);
2551       return true;
2552     }
2553     case value::NONE:
2554     case value::BOOL:
2555     case value::VOID_STAR:
2556     case value::SHORT:
2557     case value::INT64:
2558     //case value::UNSIGNED_CHAR:
2559     //case value::CHAR:
2560     case value::UNSIGNED_SHORT :
2561     case value::UNSIGNED_INT64 :
2562     case value::DOUBLE_STAR:
2563     case value::FLOAT_STAR:
2564     case value::INT_STAR:
2565     case value::STRING:
2566     //case value::ARRAY_UNSIGNED_CHAR:
2567     //case value::ARRAY_CHAR:
2568     case value::ARRAY_UNSIGNED_SHORT:
2569     case value::ARRAY_SHORT:
2570     case value::ARRAY_UNSIGNED_INT:
2571     case value::ARRAY_INT:
2572     case value::ARRAY_UNSIGNED_INT64:
2573     case value::ARRAY_INT64:
2574     case value::ARRAY_FLOAT:
2575     //case value::ARRAY_DOUBLE:
2576     case value::ARRAY_BOOL:
2577     case value::ARRAY_STRING:
2578       break;
2579     }
2580     break;
2581   case value::BOOL:
2582     switch(aV.m_type) {
2583     case value::BOOL:
2584       aThis.u.m_bool = ((aThis.u.m_bool==aV.u.m_bool)?true:false);
2585       return true;
2586     case value::NONE:
2587     case value::INT:
2588     case value::DOUBLE:
2589     case value::VOID_STAR:
2590     case value::SHORT:
2591     case value::INT64:
2592     case value::FLOAT:
2593     //case value::UNSIGNED_CHAR:
2594     //case value::CHAR:
2595     case value::UNSIGNED_SHORT :
2596     case value::UNSIGNED_INT:
2597     case value::UNSIGNED_INT64 :
2598     case value::DOUBLE_STAR:
2599     case value::FLOAT_STAR:
2600     case value::INT_STAR:
2601     case value::STRING:
2602     //case value::ARRAY_UNSIGNED_CHAR:
2603     //case value::ARRAY_CHAR:
2604     case value::ARRAY_UNSIGNED_SHORT:
2605     case value::ARRAY_SHORT:
2606     case value::ARRAY_UNSIGNED_INT:
2607     case value::ARRAY_INT:
2608     case value::ARRAY_UNSIGNED_INT64:
2609     case value::ARRAY_INT64:
2610     case value::ARRAY_FLOAT:
2611     case value::ARRAY_DOUBLE:
2612     case value::ARRAY_BOOL:
2613     case value::ARRAY_STRING:
2614       break;
2615     }
2616     break;
2617   case value::ARRAY_DOUBLE:
2618     switch(aV.m_type) {
2619     case value::INT:{
2620       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2621       size_t number = stdv.size();
2622       for(size_t index=0;index<number;index++) {
2623         if(stdv[index]!=aV.u.m_int) {
2624           aThis.set(false);
2625           return true;
2626         }
2627       }
2628       aThis.set(true);
2629       return true;
2630     }
2631     case value::FLOAT:{
2632       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2633       size_t number = stdv.size();
2634       for(size_t index=0;index<number;index++) {
2635         if(stdv[index]!=aV.u.m_float) {
2636           aThis.set(false);
2637           return true;
2638         }
2639       }
2640       aThis.set(true);
2641       return true;
2642     }
2643     case value::DOUBLE:{
2644       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2645       size_t number = stdv.size();
2646       for(size_t index=0;index<number;index++) {
2647         if(stdv[index]!=aV.u.m_double) {
2648           aThis.set(false);
2649           return true;
2650         }
2651       }
2652       aThis.set(true);
2653       return true;
2654     }
2655     case value::UNSIGNED_INT:{
2656       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2657       size_t number = stdv.size();
2658       for(size_t index=0;index<number;index++) {
2659         if(stdv[index]!=aV.u.m_unsigned_int ) {
2660           aThis.set(false);
2661           return true;
2662         }
2663       }
2664       aThis.set(true);
2665       return true;
2666     }
2667     case value::ARRAY_DOUBLE:{
2668       const std::vector<double>& stdv = aThis.u.m_array_double->vector();
2669       const std::vector<double>& stdv2 = aV.u.m_array_double->vector();
2670       if(stdv.size()!=stdv2.size()) {
2671         aThis.set(false);
2672         return true;
2673       }
2674       size_t number = stdv.size();
2675       for(size_t index=0;index<number;index++) {
2676         if(stdv[index]!=stdv2[index]) {
2677           aThis.set(false);
2678           return true;
2679         }
2680       }
2681       aThis.set(true);
2682       return true;
2683     }
2684     case value::NONE:
2685     case value::VOID_STAR:
2686     case value::BOOL:
2687     case value::SHORT:
2688     //case value::UNSIGNED_CHAR:
2689     //case value::CHAR:
2690     case value::STRING:
2691     case value::INT64:
2692     case value::UNSIGNED_SHORT :
2693     case value::UNSIGNED_INT64 :
2694     case value::DOUBLE_STAR:
2695     case value::FLOAT_STAR:
2696     case value::INT_STAR:
2697     //case value::ARRAY_UNSIGNED_CHAR:
2698     //case value::ARRAY_CHAR:
2699     case value::ARRAY_UNSIGNED_SHORT:
2700     case value::ARRAY_SHORT:
2701     case value::ARRAY_UNSIGNED_INT:
2702     case value::ARRAY_INT:
2703     case value::ARRAY_UNSIGNED_INT64:
2704     case value::ARRAY_INT64:
2705     case value::ARRAY_FLOAT:
2706     //case value::ARRAY_DOUBLE:
2707     case value::ARRAY_BOOL:
2708     case value::ARRAY_STRING:
2709       break;
2710     }
2711     break;
2712   case value::NONE:
2713   case value::SHORT:
2714   case value::INT64:
2715   //case value::UNSIGNED_CHAR:
2716   //case value::CHAR:
2717   case value::UNSIGNED_SHORT :
2718   case value::UNSIGNED_INT64 :
2719   case value::DOUBLE_STAR:
2720   case value::FLOAT_STAR:
2721   case value::INT_STAR:
2722   //case value::ARRAY_UNSIGNED_CHAR:
2723   //case value::ARRAY_CHAR:
2724   case value::ARRAY_UNSIGNED_SHORT:
2725   case value::ARRAY_SHORT:
2726   case value::ARRAY_UNSIGNED_INT:
2727   case value::ARRAY_INT:
2728   case value::ARRAY_UNSIGNED_INT64:
2729   case value::ARRAY_INT64:
2730   case value::ARRAY_FLOAT:
2731 //case value::ARRAY_DOUBLE:
2732   case value::ARRAY_BOOL:
2733   case value::ARRAY_STRING:
2734     break;
2735   }
2736   aError = std::string("Value::if_eq() :")
2737          + " can't compare type " + value::stype(oType)
2738          + " with type " + aV.stype();
2739   aThis.set_none();
2740   return false;
2741 }
2742 
2743 inline bool value::if_and(value& aThis,const value& aV,std::string& aError){
2744   value::e_type oType = aThis.m_type;
2745   switch(aThis.m_type) {
2746   case value::BOOL:
2747     switch(aV.m_type) {
2748     case value::BOOL:
2749       aThis.u.m_bool = ((aThis.u.m_bool && aV.u.m_bool)?true:false);
2750       return true;
2751     case value::INT:
2752     case value::NONE:
2753     case value::DOUBLE:
2754     case value::STRING:
2755     case value::VOID_STAR:
2756     case value::SHORT:
2757     case value::INT64:
2758     case value::FLOAT:
2759     //case value::UNSIGNED_CHAR:
2760     //case value::CHAR:
2761     case value::UNSIGNED_SHORT :
2762     case value::UNSIGNED_INT64 :
2763     case value::DOUBLE_STAR:
2764     case value::FLOAT_STAR:
2765     case value::INT_STAR:
2766     case value::UNSIGNED_INT:
2767     //case value::ARRAY_UNSIGNED_CHAR:
2768     //case value::ARRAY_CHAR:
2769     case value::ARRAY_UNSIGNED_SHORT:
2770     case value::ARRAY_SHORT:
2771     case value::ARRAY_UNSIGNED_INT:
2772     case value::ARRAY_INT:
2773     case value::ARRAY_UNSIGNED_INT64:
2774     case value::ARRAY_INT64:
2775     case value::ARRAY_FLOAT:
2776     case value::ARRAY_DOUBLE:
2777     case value::ARRAY_BOOL:
2778     case value::ARRAY_STRING:
2779       break;
2780     }
2781     break;
2782   case value::NONE:
2783   case value::INT:
2784   case value::DOUBLE:
2785   case value::VOID_STAR:
2786   case value::SHORT:
2787   case value::INT64:
2788   case value::FLOAT:
2789   //case value::UNSIGNED_CHAR:
2790   //case value::CHAR:
2791   case value::UNSIGNED_SHORT :
2792   case value::UNSIGNED_INT:
2793   case value::UNSIGNED_INT64 :
2794   case value::DOUBLE_STAR:
2795   case value::FLOAT_STAR:
2796   case value::INT_STAR:
2797   case value::STRING:
2798   //case value::ARRAY_UNSIGNED_CHAR:
2799   //case value::ARRAY_CHAR:
2800   case value::ARRAY_UNSIGNED_SHORT:
2801   case value::ARRAY_SHORT:
2802   case value::ARRAY_UNSIGNED_INT:
2803   case value::ARRAY_INT:
2804   case value::ARRAY_UNSIGNED_INT64:
2805   case value::ARRAY_INT64:
2806   case value::ARRAY_FLOAT:
2807   case value::ARRAY_DOUBLE:
2808   case value::ARRAY_BOOL:
2809   case value::ARRAY_STRING:
2810     break;
2811   }
2812   aError = std::string("Value::if_and :")
2813          + " can't apply on type " + value::stype(oType)
2814          + " and type " + aV.stype();
2815   aThis.set_none();
2816   return false;
2817 }
2818 
2819 inline bool value::if_or(value& aThis,const value& aV,std::string& aError){
2820   value::e_type oType = aThis.m_type;
2821   switch(aThis.m_type) {
2822   case value::BOOL:
2823     switch(aV.m_type) {
2824     case value::BOOL:
2825       aThis.u.m_bool = ((aThis.u.m_bool || aV.u.m_bool)?true:false);
2826       return true;
2827     case value::INT:
2828     case value::NONE:
2829     case value::DOUBLE:
2830     case value::STRING:
2831     case value::VOID_STAR:
2832     case value::SHORT:
2833     case value::INT64:
2834     case value::FLOAT:
2835     //case value::UNSIGNED_CHAR:
2836     //case value::CHAR:
2837     case value::UNSIGNED_SHORT :
2838     case value::UNSIGNED_INT64 :
2839     case value::DOUBLE_STAR:
2840     case value::FLOAT_STAR:
2841     case value::INT_STAR:
2842     case value::UNSIGNED_INT:
2843     //case value::ARRAY_UNSIGNED_CHAR:
2844     //case value::ARRAY_CHAR:
2845     case value::ARRAY_UNSIGNED_SHORT:
2846     case value::ARRAY_SHORT:
2847     case value::ARRAY_UNSIGNED_INT:
2848     case value::ARRAY_INT:
2849     case value::ARRAY_UNSIGNED_INT64:
2850     case value::ARRAY_INT64:
2851     case value::ARRAY_FLOAT:
2852     case value::ARRAY_DOUBLE:
2853     case value::ARRAY_BOOL:
2854     case value::ARRAY_STRING:
2855       break;
2856     }
2857     break;
2858   case value::NONE:
2859   case value::INT:
2860   case value::DOUBLE:
2861   case value::VOID_STAR:
2862   case value::SHORT:
2863   case value::INT64:
2864   case value::FLOAT:
2865   //case value::UNSIGNED_CHAR:
2866   //case value::CHAR:
2867   case value::UNSIGNED_SHORT :
2868   case value::UNSIGNED_INT:
2869   case value::UNSIGNED_INT64 :
2870   case value::DOUBLE_STAR:
2871   case value::FLOAT_STAR:
2872   case value::INT_STAR:
2873   case value::STRING:
2874   //case value::ARRAY_UNSIGNED_CHAR:
2875   //case value::ARRAY_CHAR:
2876   case value::ARRAY_UNSIGNED_SHORT:
2877   case value::ARRAY_SHORT:
2878   case value::ARRAY_UNSIGNED_INT:
2879   case value::ARRAY_INT:
2880   case value::ARRAY_UNSIGNED_INT64:
2881   case value::ARRAY_INT64:
2882   case value::ARRAY_FLOAT:
2883   case value::ARRAY_DOUBLE:
2884   case value::ARRAY_BOOL:
2885   case value::ARRAY_STRING:
2886     break;
2887   }
2888   aError = std::string("Value::if_or :")
2889          + " can't apply on type " + value::stype(oType)
2890          + " and type " + aV.stype();
2891   aThis.set_none();
2892   return false;
2893 }
2894 
2895 inline bool value::to_double(const value& aThis,double& aValue){
2896   switch(aThis.m_type) {
2897   case value::INT:
2898     aValue = aThis.u.m_int;
2899     return true;
2900   case value::DOUBLE:
2901     aValue = aThis.u.m_double;
2902     return true;
2903   case value::UNSIGNED_SHORT:
2904     aValue = aThis.u.m_unsigned_short;
2905     return true;
2906   case value::UNSIGNED_INT:
2907     aValue = aThis.u.m_unsigned_int;
2908     return true;
2909   case value::SHORT:
2910     aValue = aThis.u.m_short;
2911     return true;
2912   case value::INT64:
2913     aValue = (double)aThis.u.m_int64;
2914     return true;
2915   case value::UNSIGNED_INT64:
2916     aValue = (double)aThis.u.m_unsigned_int64;
2917     return true;
2918   case value::FLOAT:
2919     aValue = aThis.u.m_float;
2920     return true;
2921   //case value::UNSIGNED_CHAR:
2922   //  aValue = aThis.u.m_unsigned_char;
2923   //  return true;
2924   //case value::CHAR:
2925   //  aValue = aThis.u.m_char;
2926   //  return true;
2927   case value::BOOL:
2928     aValue = aThis.u.m_bool?1:0;
2929     return true;
2930   case value::NONE:
2931   case value::STRING:
2932   case value::VOID_STAR:
2933   case value::DOUBLE_STAR:
2934   case value::FLOAT_STAR:
2935   case value::INT_STAR:
2936   //case value::ARRAY_UNSIGNED_CHAR:
2937   //case value::ARRAY_CHAR:
2938   case value::ARRAY_UNSIGNED_SHORT:
2939   case value::ARRAY_SHORT:
2940   case value::ARRAY_UNSIGNED_INT:
2941   case value::ARRAY_INT:
2942   case value::ARRAY_UNSIGNED_INT64:
2943   case value::ARRAY_INT64:
2944   case value::ARRAY_FLOAT:
2945   case value::ARRAY_DOUBLE:
2946   case value::ARRAY_BOOL:
2947   case value::ARRAY_STRING:
2948     break;
2949   }
2950   aValue = 0;
2951   return false;
2952 }
2953 
2954 inline bool value::cxx_type(const value& aThis,std::string& aValue){
2955   switch(aThis.m_type) {
2956   case value::INT:
2957     aValue = "int";
2958     return true;
2959   case value::DOUBLE:
2960     aValue = "double";
2961     return true;
2962   case value::STRING:
2963     aValue = "std::string";
2964     return true;
2965   case value::BOOL:
2966     aValue = "bool";
2967     return true;
2968   case value::SHORT:
2969     aValue = "short";
2970     return true;
2971   case value::FLOAT:
2972     aValue = "float";
2973     return true;
2974   //case value::CHAR:
2975   //  aValue = "char";
2976   //  return true;
2977   //case value::UNSIGNED_CHAR:
2978   //  aValue = "unsigned char";
2979   //  return true;
2980   case value::UNSIGNED_SHORT:
2981     aValue = "unsigned short";
2982     return true;
2983   case value::UNSIGNED_INT:
2984     aValue = "unsigned int";
2985     return true;
2986   case value::VOID_STAR:
2987     aValue = "void*";
2988     return true;
2989   case value::DOUBLE_STAR:
2990     aValue = "double*";
2991     return true;
2992   case value::FLOAT_STAR:
2993     aValue = "float*";
2994     return true;
2995   case value::INT_STAR:
2996     aValue = "int*";
2997     return true;
2998   case value::NONE:
2999   case value::INT64:
3000   case value::UNSIGNED_INT64:
3001   //case value::ARRAY_UNSIGNED_CHAR:
3002   //case value::ARRAY_CHAR:
3003   case value::ARRAY_UNSIGNED_SHORT:
3004   case value::ARRAY_SHORT:
3005   case value::ARRAY_UNSIGNED_INT:
3006   case value::ARRAY_INT:
3007   case value::ARRAY_UNSIGNED_INT64:
3008   case value::ARRAY_INT64:
3009   case value::ARRAY_FLOAT:
3010   case value::ARRAY_DOUBLE:
3011   case value::ARRAY_BOOL:
3012   case value::ARRAY_STRING:
3013     aValue = "";
3014     return false;
3015   }
3016   return false;
3017 }
3018 
3019 /*
3020 inline bool value::i_set(value& aThis,const Slash::Core::IValue& aValue){
3021   aThis.reset();
3022 
3023   aThis.m_type = aValue.type();
3024 
3025   switch(aValue.type()) {
3026   case value::NONE:
3027     aThis.u.m_unsigned_int64 = 0;
3028     return true;
3029   case value::CHAR:
3030     aThis.u.m_char = aValue.get_char();
3031     return true;
3032   case value::SHORT:
3033     aThis.u.m_short = aValue.get_short();
3034     return true;
3035   case value::INT:
3036     aThis.u.m_int = aValue.get_int();
3037     return true;
3038   case value::INT64:
3039     aThis.u.m_int64 = aValue.get_int64();
3040     return true;
3041   case value::UNSIGNED_INT64:
3042     aThis.u.m_unsigned_int64 = aValue.get_unsigned_int64();
3043     return true;
3044   //case value::UNSIGNED_CHAR:
3045   //  aThis.u.m_unsigned_char = aValue.get_unsigned_char();
3046   //  return true;
3047   case value::UNSIGNED_SHORT:
3048     aThis.u.m_unsigned_short  = aValue.get_unsigned_short();
3049     return true;
3050   case value::UNSIGNED_INT:
3051     aThis.u.m_unsigned_int  = aValue.get_unsigned_int();
3052     return true;
3053   case value::DOUBLE_STAR:
3054     aThis.u.m_double_star  = aValue.get_double_star();
3055     return true;
3056   case value::FLOAT_STAR:
3057     aThis.u.m_float_star  = aValue.get_float_star();
3058     return true;
3059   case value::INT_STAR:
3060     aThis.u.m_int_star  = aValue.get_int_star();
3061     return true;
3062   case value::FLOAT:
3063     aThis.u.m_float = aValue.get_float();
3064     return true;
3065   case value::DOUBLE:
3066     aThis.u.m_double = aValue.get_double();
3067     return true;
3068   case value::VOID_STAR:
3069     aThis.u.m_void_star = aValue.get_void_star();
3070     return true;
3071   case value::BOOL:
3072     aThis.u.m_bool = aValue.get_bool();
3073     return true;
3074   case value::STRING:
3075     aThis.u.m_string = new std::string(aValue.get_string());
3076     return true;
3077 
3078   case value::ARRAY_UNSIGNED_CHAR:
3079    {std::vector<unsigned int> is;
3080     const std::vector<unsigned char>& vd = aValue.get_array_unsigned_char(is);
3081     aThis.u.m_array_unsigned_char = new array<unsigned char>();
3082     if(!aThis.u.m_array_unsigned_char->configure(is)){
3083       aThis.set_none();return false;
3084     }
3085     if(!aThis.u.m_array_unsigned_char->fill(vd)){aThis.set_none();return false;}
3086     return true;}
3087 
3088   case value::ARRAY_CHAR:
3089    {std::vector<unsigned int> is;
3090     const std::vector<char>& vd = aValue.get_array_char(is);
3091     aThis.u.m_array_char = new array<char>();
3092     if(!aThis.u.m_array_char->configure(is)){
3093       aThis.set_none();return false;
3094     }
3095     if(!aThis.u.m_array_char->fill(vd)){aThis.set_none();return false;}
3096     return true;}
3097   case value::ARRAY_UNSIGNED_SHORT:
3098    {std::vector<unsigned int> is;
3099     const std::vector<unsigned short>& vd =
3100       aValue.get_array_unsigned_short(is);
3101     aThis.u.m_array_unsigned_short = new array<unsigned short>();
3102     if(!aThis.u.m_array_unsigned_short->configure(is)){
3103       aThis.set_none();return false;
3104     }
3105     if(!aThis.u.m_array_unsigned_short->fill(vd)){
3106       aThis.set_none();return false;
3107     }
3108     return true;}
3109 
3110   case value::ARRAY_SHORT:
3111    {std::vector<unsigned int> is;
3112     const std::vector<short>& vd = aValue.get_array_short(is);
3113     aThis.u.m_array_short = new array<short>();
3114     if(!aThis.u.m_array_short->configure(is)){aThis.set_none();return false;}
3115     if(!aThis.u.m_array_short->fill(vd)){aThis.set_none();return false;}
3116     return true;}
3117 
3118   case value::ARRAY_UNSIGNED_INT:
3119    {std::vector<unsigned int> is;
3120     const std::vector<unsigned int>& vd = aValue.get_array_unsigned_int(is);
3121     aThis.u.m_array_unsigned_int = new array<unsigned int>();
3122     if(!aThis.u.m_array_unsigned_int->configure(is)){
3123       aThis.set_none();return false;
3124     }
3125     if(!aThis.u.m_array_unsigned_int->fill(vd)){
3126       aThis.set_none();return false;
3127     }
3128     return true;}
3129 
3130   case value::ARRAY_INT:
3131    {std::vector<unsigned int> is;
3132     const std::vector<int>& vd = aValue.get_array_int(is);
3133     aThis.u.m_array_int = new array<int>();
3134     if(!aThis.u.m_array_int->configure(is)){aThis.set_none();return false;}
3135     if(!aThis.u.m_array_int->fill(vd)){aThis.set_none();return false;}
3136     return true;}
3137 
3138   case value::ARRAY_UNSIGNED_INT64:
3139    {std::vector<unsigned int> is;
3140     const std::vector<uint64>& vd = aValue.get_array_unsigned_int64(is);
3141     aThis.u.m_array_unsigned_int64 = new array<uint64>();
3142     if(!aThis.u.m_array_unsigned_int64->configure(is)){
3143       aThis.set_none();return false;
3144     }
3145     if(!aThis.u.m_array_unsigned_int64->fill(vd)){
3146       aThis.set_none();return false;
3147     }
3148     return true;}
3149 
3150   case value::ARRAY_INT64:
3151    {std::vector<unsigned int> is;
3152     const std::vector<int64>& vd = aValue.get_array_int64(is);
3153     aThis.u.m_array_int64 = new array<int64>();
3154     if(!aThis.u.m_array_int64->configure(is)){aThis.set_none();return false;}
3155     if(!aThis.u.m_array_int64->fill(vd)){aThis.set_none();return false;}
3156     return true;}
3157 
3158   case value::ARRAY_FLOAT:
3159    {std::vector<unsigned int> is;
3160     const std::vector<float>& vd = aValue.get_array_float(is);
3161     aThis.u.m_array_float = new array<float>();
3162     if(!aThis.u.m_array_float->configure(is)){aThis.set_none();return false;}
3163     if(!aThis.u.m_array_float->fill(vd)){aThis.set_none();return false;}
3164     return true;}
3165 
3166   case value::ARRAY_DOUBLE:
3167    {std::vector<unsigned int> is;
3168     const std::vector<double>& vd = aValue.get_array_double(is);
3169     aThis.u.m_array_double = new array<double>();
3170     if(!aThis.u.m_array_double->configure(is)){aThis.set_none();return false;}
3171     if(!aThis.u.m_array_double->fill(vd)){aThis.set_none();return false;}
3172     return true;}
3173 
3174   case value::ARRAY_BOOL:
3175    {std::vector<unsigned int> is;
3176     const std::vector<bool>& vd = aValue.get_array_bool(is);
3177     aThis.u.m_array_bool = new array<bool>();
3178     if(!aThis.u.m_array_bool->configure(is)){aThis.set_none();return false;}
3179     if(!aThis.u.m_array_bool->fill(vd)){aThis.set_none();return false;}
3180     return true;}
3181 
3182   case value::ARRAY_STRING:
3183    {std::vector<unsigned int> is;
3184     const std::vector<std::string>& vd = aValue.get_array_string(is);
3185     aThis.u.m_array_string = new array<std::string>();
3186     if(!aThis.u.m_array_string->configure(is)){aThis.set_none();return false;}
3187     if(!aThis.u.m_array_string->fill(vd)){aThis.set_none();return false;}
3188     return true;}
3189 
3190   }
3191 
3192   aThis.set_none();
3193   return false;
3194 }
3195 */
3196 
3197 inline std::string value::to_string(const value& aThis){
3198   std::string _s;
3199   switch(aThis.m_type) {
3200   case value::NONE:
3201     sprintf(_s,5,"(nil)");
3202     return _s;
3203   case value::INT:
3204     sprintf(_s,16,"%d",aThis.u.m_int);
3205     return _s;
3206   case value::DOUBLE:
3207     sprintf(_s,16,"%g",aThis.u.m_double);
3208     return _s;
3209   case value::VOID_STAR:
3210     sprintf(_s,32,upointer_format_x(),(upointer)aThis.u.m_void_star);
3211     return _s;
3212   case value::UNSIGNED_SHORT:
3213     sprintf(_s,16,"%u",aThis.u.m_unsigned_short);
3214     return _s;
3215   case value::UNSIGNED_INT:
3216     sprintf(_s,16,"%u",aThis.u.m_unsigned_int);
3217     return _s;
3218   case value::BOOL:
3219     sprintf(_s,5,"%s",aThis.u.m_bool?"true":"false");
3220     return _s;
3221   case value::SHORT:
3222     sprintf(_s,16,"%d",aThis.u.m_short);
3223     return _s;
3224   case value::INT64:{
3225     sprintf(_s,16,int64_format(),aThis.u.m_int64);
3226    }return _s;
3227   case value::UNSIGNED_INT64:{
3228     sprintf(_s,16,int64_format(),aThis.u.m_unsigned_int64);
3229    }return _s;
3230   case value::FLOAT:
3231     sprintf(_s,16,"%g",aThis.u.m_float);
3232     return _s;
3233   //case value::UNSIGNED_CHAR:
3234   //  sprintf(_s,16,"%c",aThis.u.m_unsigned_char);
3235   //  return _s;
3236   //case value::CHAR:
3237   //  sprintf(_s,16,"%c",aThis.u.m_char);
3238   //  return _s;
3239   case value::DOUBLE_STAR:
3240     sprintf(_s,32,upointer_format_x(),(upointer)aThis.u.m_double_star);
3241     return _s;
3242   case value::FLOAT_STAR:
3243     sprintf(_s,32,upointer_format_x(),(upointer)aThis.u.m_float_star);
3244     return _s;
3245   case value::INT_STAR:
3246     sprintf(_s,32,upointer_format_x(),(upointer)aThis.u.m_int_star);
3247     return _s;
3248   case value::STRING:
3249     return *aThis.u.m_string;
3250 
3251   //case value::ARRAY_UNSIGNED_CHAR:
3252   //  return tos<unsigned char>(aThis.u.m_array_unsigned_char->vector());
3253   //case value::ARRAY_CHAR:
3254   //  return tos<char>(aThis.u.m_array_char->vector());
3255   case value::ARRAY_UNSIGNED_SHORT:
3256     if(!nums2s<unsigned short>(aThis.u.m_array_unsigned_short->vector(),_s)) {}
3257     return _s;
3258   case value::ARRAY_SHORT:
3259     if(!nums2s<short>(aThis.u.m_array_short->vector(),_s)) {}
3260     return _s;
3261 
3262   case value::ARRAY_UNSIGNED_INT:
3263     if(!nums2s<unsigned int>(aThis.u.m_array_unsigned_int->vector(),_s)) {}
3264     return _s;
3265   case value::ARRAY_INT:
3266     if(!nums2s<int>(aThis.u.m_array_int->vector(),_s)) {}
3267     return _s;
3268 
3269   case value::ARRAY_UNSIGNED_INT64:
3270     if(!nums2s<uint64>(aThis.u.m_array_unsigned_int64->vector(),_s)) {}
3271     return _s;
3272   case value::ARRAY_INT64:
3273     if(!nums2s<int64>(aThis.u.m_array_int64->vector(),_s)) {}
3274     return _s;
3275 
3276   case value::ARRAY_FLOAT:
3277     if(!nums2s<float>(aThis.u.m_array_float->vector(),_s)) {}
3278     return _s;
3279   case value::ARRAY_DOUBLE:
3280     if(!nums2s<double>(aThis.u.m_array_double->vector(),_s)) {}
3281     return _s;
3282   case value::ARRAY_BOOL:
3283     b2s(aThis.u.m_array_bool->vector(),_s);
3284     return _s;
3285   case value::ARRAY_STRING:
3286     if(!nums2s<std::string>(aThis.u.m_array_string->vector(),_s)) {}
3287     return _s;
3288   default:
3289     return "unknown"; //it should not happen.
3290   }
3291 }
3292 
3293 }
3294