#include "sto" namespace tools { inline bool value::assign(value& aThis,const value& aV,std::string& aError){ if(aThis.m_type==aV.m_type) { aThis.reset(); if(aV.m_type==value::STRING) { aThis.u.m_string = new std::string(*aV.u.m_string); //} else if(aV.m_type==value::ARRAY_UNSIGNED_CHAR) { // aThis.u.m_array_unsigned_char = // new array(*aV.u.m_array_unsigned_char); //} else if(aV.m_type==value::ARRAY_CHAR) { // aThis.u.m_array_char = new array(*aV.u.m_array_char); } else if(aV.m_type==value::ARRAY_UNSIGNED_SHORT) { aThis.u.m_array_unsigned_short = new array(*aV.u.m_array_unsigned_short); } else if(aV.m_type==value::ARRAY_SHORT) { aThis.u.m_array_short = new array(*aV.u.m_array_short); } else if(aV.m_type==value::ARRAY_UNSIGNED_INT) { aThis.u.m_array_unsigned_int = new array(*aV.u.m_array_unsigned_int); } else if(aV.m_type==value::ARRAY_INT) { aThis.u.m_array_int = new array(*aV.u.m_array_int); } else if(aV.m_type==value::ARRAY_UNSIGNED_INT64) { aThis.u.m_array_unsigned_int64 = new array(*aV.u.m_array_unsigned_int64); } else if(aV.m_type==value::ARRAY_INT64) { aThis.u.m_array_int64 = new array(*aV.u.m_array_int64); } else if(aV.m_type==value::ARRAY_FLOAT) { aThis.u.m_array_float = new array(*aV.u.m_array_float); } else if(aV.m_type==value::ARRAY_DOUBLE) { aThis.u.m_array_double = new array(*aV.u.m_array_double); } else if(aV.m_type==value::ARRAY_BOOL) { aThis.u.m_array_bool = new array(*aV.u.m_array_bool); } else if(aV.m_type==value::ARRAY_STRING) { aThis.u.m_array_string = new array(*aV.u.m_array_string); } else { aThis.u = aV.u; } return true; } else { switch(aThis.m_type) { case value::INT: break; case value::DOUBLE: switch(aV.m_type) { case value::INT: aThis.u.m_double = aV.u.m_int; return true; case value::UNSIGNED_SHORT : aThis.u.m_double = aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_double = aV.u.m_unsigned_int; return true; case value::NONE: case value::DOUBLE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::STRING: break; case value::VOID_STAR: break; case value::UNSIGNED_INT: break; case value::BOOL: break; case value::SHORT: switch(aV.m_type) { case value::INT: aThis.u.m_short = (short)aV.u.m_int; return true; case value::NONE: case value::DOUBLE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::FLOAT: switch(aV.m_type) { case value::INT: aThis.u.m_float = (float)aV.u.m_int; return true; case value::DOUBLE: aThis.u.m_float = (float)aV.u.m_double; return true; case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; /* case value::UNSIGNED_CHAR: switch(aV.m_type) { case value::INT: aThis.u.m_unsigned_char = (unsigned char)aV.u.m_int; return true; case value::NONE: case value::DOUBLE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: case value::UNSIGNED_CHAR: case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: case value::ARRAY_UNSIGNED_CHAR: case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::CHAR: switch(aV.m_type) { case value::INT: aThis.u.m_char = (char)aV.u.m_int; return true; case value::STRING: if(aV.u.m_string->size()!=1) break; aThis.u.m_char = (*aV.u.m_string)[0]; return true; case value::NONE: case value::DOUBLE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: case value::UNSIGNED_CHAR: case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::ARRAY_UNSIGNED_CHAR: case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; */ case value::NONE: case value::INT64: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : switch(aV.m_type) { case value::INT: aThis.u.m_int64 = aV.u.m_int; return true; case value::UNSIGNED_SHORT : aThis.u.m_int64 = aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_int64 = aV.u.m_unsigned_int; return true; case value::NONE: case value::DOUBLE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } aError = std::string("value::assign :") + " unable to assign " + aV.stype() + " to " + aThis.stype(); aThis.set_none(); return false; } } inline bool value::minus(value& aThis,std::string& aError){ value::e_type oType = aThis.m_type; switch(aThis.m_type) { case value::INT: aThis.u.m_int = -aThis.u.m_int; return true; case value::DOUBLE: aThis.u.m_double = -aThis.u.m_double; return true; case value::SHORT: aThis.u.m_short = -aThis.u.m_short; return true; case value::INT64: aThis.u.m_int64 = -aThis.u.m_int64; return true; case value::FLOAT: aThis.u.m_float = -1.0F * aThis.u.m_float; return true; case value::ARRAY_DOUBLE:{ std::vector& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;indexorders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->add(double(tmp)); return true;} case value::NONE: case value::STRING: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::UNSIGNED_INT: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::FLOAT: switch(aV.m_type) { case value::UNSIGNED_SHORT : aThis.u.m_float += aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_float += aV.u.m_unsigned_int; return true; case value::SHORT: aThis.u.m_float += aV.u.m_short; return true; case value::INT: aThis.u.m_float += aV.u.m_int; return true; case value::FLOAT: aThis.u.m_float += aV.u.m_float; return true; case value::DOUBLE: aThis.u.m_float += (float)aV.u.m_double; return true; case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_float; //In the below this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->add(tmp); return true;} case value::NONE: case value::STRING: case value::VOID_STAR: case value::BOOL: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::DOUBLE: switch(aV.m_type) { case value::SHORT: aThis.u.m_double += aV.u.m_short; return true; case value::INT: aThis.u.m_double += aV.u.m_int; return true; case value::FLOAT: aThis.u.m_double += aV.u.m_float; return true; case value::DOUBLE: aThis.u.m_double += aV.u.m_double; return true; case value::UNSIGNED_SHORT : aThis.u.m_double += aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_double += aV.u.m_unsigned_int; return true; case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_double; //In the below this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->add(tmp); return true;} case value::NONE: case value::STRING: case value::VOID_STAR: case value::BOOL: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::UNSIGNED_INT: switch(aV.m_type) { case value::UNSIGNED_INT: aThis.u.m_unsigned_int += aV.u.m_unsigned_int; return true; case value::INT:{ int tmp = aThis.u.m_unsigned_int + aV.u.m_int; aThis.set(tmp); return true;} case value::FLOAT:{ float tmp = float(aThis.u.m_unsigned_int) + aV.u.m_float; aThis.set(tmp); return true;} case value::DOUBLE:{ double tmp = double(aThis.u.m_unsigned_int) + aV.u.m_double; aThis.set(tmp); return true;} case value::ARRAY_DOUBLE:{ unsigned int tmp = aThis.u.m_unsigned_int; //In the below this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->add(double(tmp)); return true;} case value::NONE: case value::STRING: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::STRING: switch(aV.m_type) { case value::STRING: aThis.set((*aThis.u.m_string)+(*aV.u.m_string)); return true; case value::NONE: case value::INT: case value::DOUBLE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::ARRAY_DOUBLE: switch(aV.m_type) { case value::INT: aThis.u.m_array_double->add(aV.u.m_int); return true; case value::UNSIGNED_INT: aThis.u.m_array_double->add(aV.u.m_unsigned_int); return true; case value::DOUBLE: aThis.u.m_array_double->add(aV.u.m_double); return true; case value::ARRAY_DOUBLE: if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) { aError = "Value::add : vector orders mismatch."; aThis.set_none(); return false; } aThis.u.m_array_double->add(*aV.u.m_array_double); return true; case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } aError = std::string("Value::add :" ) + " can't apply on type " + value::stype(oType) + " and type " + aV.stype(); aThis.set_none(); return false; } inline bool value::subtract(value& aThis,const value& aV,std::string& aError){ value::e_type oType = aThis.m_type; switch(aThis.m_type) { case value::INT: switch(aV.m_type) { case value::INT: aThis.u.m_int -= aV.u.m_int; return true; case value::DOUBLE:{ double tmp = aThis.u.m_int - aV.u.m_double; aThis.set(tmp); return true;} case value::FLOAT:{ float tmp = aThis.u.m_int - aV.u.m_float; aThis.set(tmp); return true;} case value::ARRAY_DOUBLE:{ int tmp = aThis.u.m_int; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(-1); aThis.u.m_array_double->add(double(tmp)); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::FLOAT: switch(aV.m_type) { case value::DOUBLE:{ double tmp = double(aThis.u.m_float) - aV.u.m_double; aThis.set(tmp); return true;} case value::UNSIGNED_SHORT : aThis.u.m_float -= aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_float -= aV.u.m_unsigned_int; return true; case value::INT: aThis.u.m_float -= aV.u.m_int; return true; case value::SHORT: aThis.u.m_float -= aV.u.m_short; return true; case value::FLOAT: aThis.u.m_float -= aV.u.m_float; return true; case value::INT64:{ double tmp = double(aThis.u.m_float) - aV.u.m_int64; aThis.set(tmp); return true;} case value::UNSIGNED_INT64:{ double tmp = double(aThis.u.m_float) - aV.u.m_unsigned_int64; aThis.set(tmp); return true;} case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_float; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(-1); aThis.u.m_array_double->add(tmp); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::DOUBLE: switch(aV.m_type) { case value::DOUBLE: aThis.u.m_double -= aV.u.m_double; return true; case value::UNSIGNED_SHORT : aThis.u.m_double -= aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_double -= aV.u.m_unsigned_int; return true; case value::INT: aThis.u.m_double -= aV.u.m_int; return true; case value::SHORT: aThis.u.m_double -= aV.u.m_short; return true; case value::INT64: aThis.u.m_double -= aV.u.m_int64; return true; case value::FLOAT: aThis.u.m_double -= aV.u.m_float; return true; case value::UNSIGNED_INT64 : aThis.u.m_double -= aV.u.m_unsigned_int64; return true; case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_double; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(-1); aThis.u.m_array_double->add(tmp); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::UNSIGNED_INT: switch(aV.m_type) { case value::UNSIGNED_INT: if(aThis.u.m_unsigned_int>=aV.u.m_unsigned_int) { aThis.u.m_unsigned_int -= aV.u.m_unsigned_int; } else { int i = int(aThis.u.m_unsigned_int) - aV.u.m_unsigned_int; aThis.set(i); } return true; case value::DOUBLE:{ double d = double(aThis.u.m_unsigned_int) - aV.u.m_double; aThis.set(d); return true;} case value::FLOAT:{ float d = float(aThis.u.m_unsigned_int) - aV.u.m_float; aThis.set(d); return true;} case value::INT:{ int d = int(aThis.u.m_unsigned_int) - aV.u.m_int; aThis.set(d); return true;} case value::ARRAY_DOUBLE:{ unsigned int tmp = aThis.u.m_unsigned_int; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(-1); aThis.u.m_array_double->add(double(tmp)); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::ARRAY_DOUBLE: switch(aV.m_type) { case value::INT: aThis.u.m_array_double->add(-aV.u.m_int); return true; case value::UNSIGNED_INT: aThis.u.m_array_double->add(-((double)aV.u.m_unsigned_int)); return true; case value::DOUBLE: aThis.u.m_array_double->add(-aV.u.m_double); return true; case value::ARRAY_DOUBLE:{ if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) { aError = "Value::subtract : vector orders mismatch."; aThis.set_none(); return false; } std::vector& stdv = aThis.u.m_array_double->vector(); const std::vector& stdv2 = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;indexorders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(double(tmp)); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::FLOAT: switch(aV.m_type) { case value::SHORT: aThis.u.m_float *= aV.u.m_short; return true; case value::INT: aThis.u.m_float *= aV.u.m_int; return true; case value::FLOAT: aThis.u.m_float *= aV.u.m_float; return true; case value::DOUBLE: aThis.u.m_float *= (float)aV.u.m_double; return true; case value::UNSIGNED_SHORT : aThis.u.m_float *= aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_float *= aV.u.m_unsigned_int; return true; case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_float; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(tmp); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::DOUBLE: switch(aV.m_type) { case value::SHORT: aThis.u.m_double *= aV.u.m_short; return true; case value::INT: aThis.u.m_double *= aV.u.m_int; return true; case value::INT64: aThis.u.m_double *= aV.u.m_int64; return true; case value::FLOAT: aThis.u.m_double *= aV.u.m_float; return true; case value::DOUBLE: aThis.u.m_double *= aV.u.m_double; return true; case value::UNSIGNED_SHORT : aThis.u.m_double *= aV.u.m_unsigned_short; return true; case value::UNSIGNED_INT: aThis.u.m_double *= aV.u.m_unsigned_int; return true; case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_double; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(tmp); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::UNSIGNED_INT: switch(aV.m_type) { case value::FLOAT:{ float tmp = aThis.u.m_unsigned_int * aV.u.m_float; aThis.set(tmp); //this becomes a value::FLOAT. return true;} case value::DOUBLE:{ double tmp = aThis.u.m_unsigned_int * aV.u.m_double; aThis.set(tmp); //this becomes a value::DOUBLE. return true;} case value::INT:{ int tmp = aThis.u.m_unsigned_int * aV.u.m_int; aThis.set(tmp); //this becomes a value::INT. return true;} case value::INT64:{ int64 tmp = aThis.u.m_unsigned_int * aV.u.m_int64; aThis.set(tmp); //this becomes a value::INT64. return true;} case value::UNSIGNED_INT: aThis.u.m_unsigned_int *= aV.u.m_unsigned_int; return true; case value::ARRAY_DOUBLE:{ unsigned int tmp = aThis.u.m_unsigned_int; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); aThis.u.m_array_double->multiply(double(tmp)); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::ARRAY_DOUBLE: switch(aV.m_type) { case value::INT: aThis.u.m_array_double->multiply(aV.u.m_int); return true; case value::UNSIGNED_INT: aThis.u.m_array_double->multiply(aV.u.m_unsigned_int); return true; case value::DOUBLE: aThis.u.m_array_double->multiply(aV.u.m_double); return true; case value::ARRAY_DOUBLE:{ if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) { aError = "Value::multiply : vector orders mismatch."; aThis.set_none(); return false; } std::vector& stdv = aThis.u.m_array_double->vector(); const std::vector& stdv2 = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;indexorders(), aV.u.m_array_double->vector()); if(!aThis.u.m_array_double->invert()) { aError = value::error_div_zero(); aThis.set_none(); return false; } aThis.u.m_array_double->multiply((double)tmp); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::FLOAT: switch(aV.m_type) { case value::INT: if(aV.u.m_int==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_float /= aV.u.m_int; return true; } case value::SHORT: if(aV.u.m_short==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_float /= aV.u.m_short; return true; } case value::FLOAT: if(aV.u.m_float==0.0F) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_float /= aV.u.m_float; return true; } case value::DOUBLE: if(aV.u.m_double==0.0F) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { double tmp = double(aThis.u.m_float)/aV.u.m_double; aThis.set(tmp); return true; } case value::UNSIGNED_INT: if(aV.u.m_unsigned_int==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_float /= aV.u.m_unsigned_int; return true; } case value::UNSIGNED_SHORT: if(aV.u.m_unsigned_short==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_float /= aV.u.m_unsigned_short; return true; } case value::UNSIGNED_INT64: if(aV.u.m_unsigned_int64==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { double tmp = double(aThis.u.m_float)/aV.u.m_unsigned_int64; aThis.set(tmp); return true; } case value::INT64: if(aV.u.m_int64==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { double tmp = double(aThis.u.m_float)/aV.u.m_int64; aThis.set(tmp); return true; } case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_float; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); if(!aThis.u.m_array_double->invert()) { aError = value::error_div_zero(); aThis.set_none(); return false; } aThis.u.m_array_double->multiply(tmp); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::DOUBLE: switch(aV.m_type) { case value::SHORT: if(aV.u.m_short==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_short; return true; } case value::INT: if(aV.u.m_int==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_int; return true; } case value::INT64: if(aV.u.m_int64==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_int64; return true; } case value::FLOAT: if(aV.u.m_float==0.0F) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_float; return true; } case value::DOUBLE: if(aV.u.m_double==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_double; return true; } case value::UNSIGNED_INT: if(aV.u.m_unsigned_int==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_unsigned_int; return true; } case value::UNSIGNED_SHORT: if(aV.u.m_unsigned_short==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_unsigned_short; return true; } case value::UNSIGNED_INT64: if(aV.u.m_unsigned_int64==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_double /= aV.u.m_unsigned_int64; return true; } case value::ARRAY_DOUBLE:{ double tmp = aThis.u.m_double; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); if(!aThis.u.m_array_double->invert()) { aError = value::error_div_zero(); aThis.set_none(); return false; } aThis.u.m_array_double->multiply(tmp); return true;} case value::NONE: case value::VOID_STAR: case value::BOOL: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::UNSIGNED_INT: switch(aV.m_type) { case value::UNSIGNED_INT: if(aV.u.m_unsigned_int==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { unsigned int tmp = aThis.u.m_unsigned_int/aV.u.m_unsigned_int; aThis.set(tmp); return true; } case value::FLOAT: if(aV.u.m_float==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { float d = float(aThis.u.m_unsigned_int)/aV.u.m_float; aThis.set(d); //this becomes a value::FLOAT. return true; } case value::DOUBLE: if(aV.u.m_double==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { double d = double(aThis.u.m_unsigned_int)/aV.u.m_double; aThis.set(d); //this becomes a value::DOUBLE. return true; } case value::ARRAY_DOUBLE:{ unsigned int tmp = aThis.u.m_unsigned_int; //In the below, this becomes a value::ARRAY_DOUBLE. aThis.set(aV.u.m_array_double->orders(), aV.u.m_array_double->vector()); if(!aThis.u.m_array_double->invert()) { aError = value::error_div_zero(); aThis.set_none(); return false; } aThis.u.m_array_double->multiply(double(tmp)); return true;} case value::NONE: case value::INT: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: //case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::ARRAY_DOUBLE: switch(aV.m_type) { case value::INT: if(aV.u.m_int==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { double value = 1./aV.u.m_int; aThis.u.m_array_double->multiply(value); return true; } case value::UNSIGNED_INT: if(aV.u.m_unsigned_int==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { double value = 1./aV.u.m_unsigned_int; aThis.u.m_array_double->multiply(value); return true; } case value::DOUBLE: if(aV.u.m_double==0) { aError = value::error_div_zero(); aThis.set_none(); return false; } else { aThis.u.m_array_double->multiply(1./aV.u.m_double); return true; } case value::ARRAY_DOUBLE:{ if(aThis.u.m_array_double->orders()!=aV.u.m_array_double->orders()) { aError = value::error_div_zero(); //FIXME : error_mismatch_orders aThis.set_none(); return false; } std::vector& stdv = aThis.u.m_array_double->vector(); const std::vector& stdv2 = aV.u.m_array_double->vector(); bool has_div_zero = false; size_t number = stdv.size(); for(size_t index=0;indexaV.u.m_int?true:false)); return true; case value::FLOAT: aThis.set((bool)(aThis.u.m_int>aV.u.m_float?true:false)); return true; case value::DOUBLE: aThis.set((bool)(aThis.u.m_int>aV.u.m_double?true:false)); return true; case value::UNSIGNED_SHORT : aThis.set((bool)(aThis.u.m_int>(int)aV.u.m_unsigned_short?true:false)); return true; case value::UNSIGNED_INT: aThis.set((bool)(aThis.u.m_int>(int)aV.u.m_unsigned_int?true:false)); return true; case value::ARRAY_DOUBLE:{ const std::vector& stdv = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;indexaV.u.m_double?true:false)); return true; case value::FLOAT: aThis.set((bool)(aThis.u.m_double>aV.u.m_float?true:false)); return true; case value::INT: aThis.set((bool)(aThis.u.m_double>aV.u.m_int?true:false)); return true; case value::UNSIGNED_SHORT : aThis.set((bool)(aThis.u.m_double>aV.u.m_unsigned_short?true:false)); return true; case value::UNSIGNED_INT: aThis.set((bool)(aThis.u.m_double>aV.u.m_unsigned_int?true:false)); return true; case value::ARRAY_DOUBLE:{ const std::vector& stdv = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;indexaV.u.m_double?true:false)); return true; case value::FLOAT: aThis.set((bool)(aThis.u.m_float>aV.u.m_float?true:false)); return true; case value::INT: aThis.set((bool)(aThis.u.m_float>aV.u.m_int?true:false)); return true; case value::UNSIGNED_SHORT : aThis.set((bool)(aThis.u.m_float>aV.u.m_unsigned_short?true:false)); return true; case value::UNSIGNED_INT: aThis.set((bool)(aThis.u.m_float>aV.u.m_unsigned_int?true:false)); return true; case value::ARRAY_DOUBLE:{ const std::vector& stdv = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;indexaV.u.m_void_star?true:false)); return true; case value::NONE: case value::INT: case value::DOUBLE: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::UNSIGNED_INT: switch(aV.m_type) { case value::UNSIGNED_INT: aThis.set((bool)(aThis.u.m_unsigned_int >aV.u.m_unsigned_int ?true:false)); return true; case value::INT: aThis.set((bool)((int)aThis.u.m_unsigned_int >aV.u.m_int?true:false)); return true; case value::DOUBLE: aThis.set((bool)(double(aThis.u.m_unsigned_int)>aV.u.m_double?true:false)); return true; case value::FLOAT: aThis.set((bool)(float(aThis.u.m_unsigned_int)>aV.u.m_float?true:false)); return true; case value::NONE: case value::VOID_STAR: case value::BOOL: case value::SHORT: case value::INT64: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::ARRAY_DOUBLE: switch(aV.m_type) { case value::INT:{ const std::vector& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); const std::vector& stdv2 = aV.u.m_array_double->vector(); if(stdv.size()!=stdv2.size()) break; size_t number = stdv.size(); for(size_t index=0;index& stdv = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index(*aThis.u.m_string,v)) break; aThis.set((bool)(v==aV.u.m_int?true:false)); return true;} case value::FLOAT: {float v; if(!to(*aThis.u.m_string,v)) break; aThis.set((bool)(v==aV.u.m_float?true:false)); return true;} case value::DOUBLE: {double v; if(!to(*aThis.u.m_string,v)) break; aThis.set((bool)(v==aV.u.m_double?true:false)); return true;} case value::UNSIGNED_INT: {typedef unsigned int uint_t; uint_t v; if(!to(*aThis.u.m_string,v)) break; aThis.set((bool)(v==aV.u.m_unsigned_int ?true:false)); return true;} case value::BOOL: {bool v; if(!to(*aThis.u.m_string,v)) break; aThis.set((bool)(v==aV.u.m_bool?true:false)); return true;} case value::NONE: case value::VOID_STAR: case value::SHORT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::INT64: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::VOID_STAR: switch(aV.m_type) { case value::VOID_STAR: aThis.set((bool)(aThis.u.m_void_star==aV.u.m_void_star?true:false)); return true; case value::NONE: case value::INT: case value::DOUBLE: case value::BOOL: case value::SHORT: case value::INT64: case value::FLOAT: //case value::UNSIGNED_CHAR: //case value::CHAR: case value::UNSIGNED_SHORT : case value::UNSIGNED_INT: case value::UNSIGNED_INT64 : case value::DOUBLE_STAR: case value::FLOAT_STAR: case value::INT_STAR: case value::STRING: //case value::ARRAY_UNSIGNED_CHAR: //case value::ARRAY_CHAR: case value::ARRAY_UNSIGNED_SHORT: case value::ARRAY_SHORT: case value::ARRAY_UNSIGNED_INT: case value::ARRAY_INT: case value::ARRAY_UNSIGNED_INT64: case value::ARRAY_INT64: case value::ARRAY_FLOAT: case value::ARRAY_DOUBLE: case value::ARRAY_BOOL: case value::ARRAY_STRING: break; } break; case value::UNSIGNED_INT: switch(aV.m_type) { case value::UNSIGNED_INT: aThis.set((bool)(aThis.u.m_unsigned_int ==aV.u.m_unsigned_int ?true:false)); return true; case value::INT: aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_int?true:false)); return true; case value::FLOAT: aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_float?true:false)); return true; case value::DOUBLE: aThis.set((bool)((int)aThis.u.m_unsigned_int ==aV.u.m_double?true:false)); return true; case value::ARRAY_DOUBLE:{ const std::vector& stdv = aV.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); size_t number = stdv.size(); for(size_t index=0;index& stdv = aThis.u.m_array_double->vector(); const std::vector& stdv2 = aV.u.m_array_double->vector(); if(stdv.size()!=stdv2.size()) { aThis.set(false); return true; } size_t number = stdv.size(); for(size_t index=0;index is; const std::vector& vd = aValue.get_array_unsigned_char(is); aThis.u.m_array_unsigned_char = new array(); if(!aThis.u.m_array_unsigned_char->configure(is)){ aThis.set_none();return false; } if(!aThis.u.m_array_unsigned_char->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_CHAR: {std::vector is; const std::vector& vd = aValue.get_array_char(is); aThis.u.m_array_char = new array(); if(!aThis.u.m_array_char->configure(is)){ aThis.set_none();return false; } if(!aThis.u.m_array_char->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_UNSIGNED_SHORT: {std::vector is; const std::vector& vd = aValue.get_array_unsigned_short(is); aThis.u.m_array_unsigned_short = new array(); if(!aThis.u.m_array_unsigned_short->configure(is)){ aThis.set_none();return false; } if(!aThis.u.m_array_unsigned_short->fill(vd)){ aThis.set_none();return false; } return true;} case value::ARRAY_SHORT: {std::vector is; const std::vector& vd = aValue.get_array_short(is); aThis.u.m_array_short = new array(); if(!aThis.u.m_array_short->configure(is)){aThis.set_none();return false;} if(!aThis.u.m_array_short->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_UNSIGNED_INT: {std::vector is; const std::vector& vd = aValue.get_array_unsigned_int(is); aThis.u.m_array_unsigned_int = new array(); if(!aThis.u.m_array_unsigned_int->configure(is)){ aThis.set_none();return false; } if(!aThis.u.m_array_unsigned_int->fill(vd)){ aThis.set_none();return false; } return true;} case value::ARRAY_INT: {std::vector is; const std::vector& vd = aValue.get_array_int(is); aThis.u.m_array_int = new array(); if(!aThis.u.m_array_int->configure(is)){aThis.set_none();return false;} if(!aThis.u.m_array_int->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_UNSIGNED_INT64: {std::vector is; const std::vector& vd = aValue.get_array_unsigned_int64(is); aThis.u.m_array_unsigned_int64 = new array(); if(!aThis.u.m_array_unsigned_int64->configure(is)){ aThis.set_none();return false; } if(!aThis.u.m_array_unsigned_int64->fill(vd)){ aThis.set_none();return false; } return true;} case value::ARRAY_INT64: {std::vector is; const std::vector& vd = aValue.get_array_int64(is); aThis.u.m_array_int64 = new array(); if(!aThis.u.m_array_int64->configure(is)){aThis.set_none();return false;} if(!aThis.u.m_array_int64->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_FLOAT: {std::vector is; const std::vector& vd = aValue.get_array_float(is); aThis.u.m_array_float = new array(); if(!aThis.u.m_array_float->configure(is)){aThis.set_none();return false;} if(!aThis.u.m_array_float->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_DOUBLE: {std::vector is; const std::vector& vd = aValue.get_array_double(is); aThis.u.m_array_double = new array(); if(!aThis.u.m_array_double->configure(is)){aThis.set_none();return false;} if(!aThis.u.m_array_double->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_BOOL: {std::vector is; const std::vector& vd = aValue.get_array_bool(is); aThis.u.m_array_bool = new array(); if(!aThis.u.m_array_bool->configure(is)){aThis.set_none();return false;} if(!aThis.u.m_array_bool->fill(vd)){aThis.set_none();return false;} return true;} case value::ARRAY_STRING: {std::vector is; const std::vector& vd = aValue.get_array_string(is); aThis.u.m_array_string = new array(); if(!aThis.u.m_array_string->configure(is)){aThis.set_none();return false;} if(!aThis.u.m_array_string->fill(vd)){aThis.set_none();return false;} return true;} } aThis.set_none(); return false; } */ inline std::string value::to_string(const value& aThis){ std::string s; switch(aThis.m_type) { case value::NONE: sprintf(s,5,"(nil)"); return s; case value::INT: sprintf(s,16,"%d",aThis.u.m_int); return s; case value::DOUBLE: sprintf(s,16,"%g",aThis.u.m_double); return s; case value::VOID_STAR: sprintf(s,32,upointer_format_x(),(upointer)aThis.u.m_void_star); return s; case value::UNSIGNED_SHORT: sprintf(s,16,"%u",aThis.u.m_unsigned_short); return s; case value::UNSIGNED_INT: sprintf(s,16,"%u",aThis.u.m_unsigned_int); return s; case value::BOOL: sprintf(s,5,"%s",aThis.u.m_bool?"true":"false"); return s; case value::SHORT: sprintf(s,16,"%d",aThis.u.m_short); return s; case value::INT64:{ sprintf(s,16,int64_format(),aThis.u.m_int64); }return s; case value::UNSIGNED_INT64:{ sprintf(s,16,int64_format(),aThis.u.m_unsigned_int64); }return s; case value::FLOAT: sprintf(s,16,"%g",aThis.u.m_float); return s; //case value::UNSIGNED_CHAR: // sprintf(s,16,"%c",aThis.u.m_unsigned_char); // return s; //case value::CHAR: // sprintf(s,16,"%c",aThis.u.m_char); // return s; case value::DOUBLE_STAR: sprintf(s,32,upointer_format_x(),(upointer)aThis.u.m_double_star); return s; case value::FLOAT_STAR: sprintf(s,32,upointer_format_x(),(upointer)aThis.u.m_float_star); return s; case value::INT_STAR: sprintf(s,32,upointer_format_x(),(upointer)aThis.u.m_int_star); return s; case value::STRING: return *aThis.u.m_string; //case value::ARRAY_UNSIGNED_CHAR: // return tos(aThis.u.m_array_unsigned_char->vector()); //case value::ARRAY_CHAR: // return tos(aThis.u.m_array_char->vector()); case value::ARRAY_UNSIGNED_SHORT: if(!nums2s(aThis.u.m_array_unsigned_short->vector(),s)) {} return s; case value::ARRAY_SHORT: if(!nums2s(aThis.u.m_array_short->vector(),s)) {} return s; case value::ARRAY_UNSIGNED_INT: if(!nums2s(aThis.u.m_array_unsigned_int->vector(),s)) {} return s; case value::ARRAY_INT: if(!nums2s(aThis.u.m_array_int->vector(),s)) {} return s; case value::ARRAY_UNSIGNED_INT64: if(!nums2s(aThis.u.m_array_unsigned_int64->vector(),s)) {} return s; case value::ARRAY_INT64: if(!nums2s(aThis.u.m_array_int64->vector(),s)) {} return s; case value::ARRAY_FLOAT: if(!nums2s(aThis.u.m_array_float->vector(),s)) {} return s; case value::ARRAY_DOUBLE: if(!nums2s(aThis.u.m_array_double->vector(),s)) {} return s; case value::ARRAY_BOOL: b2s(aThis.u.m_array_bool->vector(),s); return s; case value::ARRAY_STRING: if(!nums2s(aThis.u.m_array_string->vector(),s)) {} return s; default: return "unknown"; //it should not happen. } } }