diff --git a/src/util/DataTree.cpp b/src/util/DataTree.cpp index be428fb..f6efbfc 100755 --- a/src/util/DataTree.cpp +++ b/src/util/DataTree.cpp @@ -66,7 +66,7 @@ int DataElement::getUnitSize() { #define DataElementSetNumericDef(enumtype, datatype) void DataElement::set(const datatype& val_in) { \ data_type = enumtype; \ - unit_size = sizeof(char); \ + unit_size = sizeof(datatype); \ data_init(unit_size); \ memcpy(data_val, &val_in, data_size); \ } @@ -140,7 +140,7 @@ void DataElement::set(std::set &strset_in) { #define DataElementSetNumericVectorDef(enumtype, datatype) void DataElement::set(vector& val_in) { \ data_type = enumtype; \ - unit_size = sizeof(char); \ + unit_size = sizeof(datatype); \ data_init(unit_size * val_in.size()); \ memcpy(data_val, &val_in[0], data_size); \ } diff --git a/src/util/DataTree.h b/src/util/DataTree.h index fb4c8da..316e8dc 100755 --- a/src/util/DataTree.h +++ b/src/util/DataTree.h @@ -261,28 +261,49 @@ public: void findAll(const char *name_in, vector &node_list_out); operator string () { string s; element().get(s); return s; } + operator char () { char v; element().get(v); return v; } + operator unsigned char () { unsigned char v; element().get(v); return v; } operator int () { int v; element().get(v); return v; } + operator unsigned int () { unsigned int v; element().get(v); return v; } operator long () { long v; element().get(v); return v; } + operator unsigned long () { unsigned long v; element().get(v); return v; } + operator long long () { long long v; element().get(v); return v; } operator float () { float v; element().get(v); return v; } operator double () { double v; element().get(v); return v; } + operator long double () { long double v; element().get(v); return v; } + operator vector () { vector v; element().get(v); return v; } + operator vector () { vector v; element().get(v); return v; } operator vector () { vector v; element().get(v); return v; } + operator vector () { vector v; element().get(v); return v; } operator vector () { vector v; element().get(v); return v; } + operator vector () { vector v; element().get(v); return v; } operator vector () { vector v; element().get(v); return v; } operator vector () { vector v; element().get(v); return v; } + operator vector () { vector v; element().get(v); return v; } const string &operator= (const string &s) { element().set(s); return s; } + char operator= (char i) { element().set(i); return i; } + unsigned char operator= (unsigned char i) { element().set(i); return i; } int operator= (int i) { element().set(i); return i; } + unsigned int operator= (unsigned int i) { element().set(i); return i; } long operator= (long i) { element().set(i); return i; } + unsigned long operator= (unsigned long i) { element().set(i); return i; } + long long operator= (long long i) { element().set(i); return i; } float operator= (float i) { element().set(i); return i; } double operator= (double i) { element().set(i); return i; } - + long double operator= (long double i) { element().set(i); return i; } + vector &operator= (vector &v) { element().set(v); return v; } + vector &operator= (vector &v) { element().set(v); return v; } vector &operator= (vector &v) { element().set(v); return v; } + vector &operator= (vector &v) { element().set(v); return v; } vector &operator= (vector &v) { element().set(v); return v; } + vector &operator= (vector &v) { element().set(v); return v; } vector &operator= (vector &v) { element().set(v); return v; } vector &operator= (vector &v) { element().set(v); return v; } + vector &operator= (vector &v) { element().set(v); return v; } DataNode &operator[] (const char *name_in) { return getNext(name_in); } DataNode &operator[] (int idx) { return child(idx); }