|
@@ -30,8 +30,6 @@
|
|
#include <utility>
|
|
#include <utility>
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
|
|
-#include <iostream>
|
|
|
|
-
|
|
|
|
namespace artis { namespace kernel {
|
|
namespace artis { namespace kernel {
|
|
|
|
|
|
enum ValueTypeID { DOUBLE, INT, BOOL, DOUBLE_VECTOR, INT_VECTOR, BOOL_VECTOR,
|
|
enum ValueTypeID { DOUBLE, INT, BOOL, DOUBLE_VECTOR, INT_VECTOR, BOOL_VECTOR,
|
|
@@ -132,7 +130,7 @@ public:
|
|
void put(T* o, const V& value )
|
|
void put(T* o, const V& value )
|
|
{
|
|
{
|
|
V T::* p = dynamic_cast <
|
|
V T::* p = dynamic_cast <
|
|
- data < T, V >* >(ptr_)->value_;
|
|
|
|
|
|
+ data < T, V >* >(ptr_)->value_;
|
|
o->*(p) = value;
|
|
o->*(p) = value;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -179,44 +177,44 @@ public:
|
|
{
|
|
{
|
|
if (ptr_) {
|
|
if (ptr_) {
|
|
data < T, double >* q_double =
|
|
data < T, double >* q_double =
|
|
- dynamic_cast < data < T, double >* >(ptr_);
|
|
|
|
|
|
+ dynamic_cast < data < T, double >* >(ptr_);
|
|
|
|
|
|
if (q_double) {
|
|
if (q_double) {
|
|
return context::Value(o->*(q_double->value_));
|
|
return context::Value(o->*(q_double->value_));
|
|
} else {
|
|
} else {
|
|
data < T, int >* q_int =
|
|
data < T, int >* q_int =
|
|
- dynamic_cast < data < T, int >* >(ptr_);
|
|
|
|
|
|
+ dynamic_cast < data < T, int >* >(ptr_);
|
|
|
|
|
|
if (q_int) {
|
|
if (q_int) {
|
|
return context::Value(o->*(q_int->value_));
|
|
return context::Value(o->*(q_int->value_));
|
|
} else {
|
|
} else {
|
|
data < T, bool >* q_bool =
|
|
data < T, bool >* q_bool =
|
|
- dynamic_cast < data < T, bool >* >(ptr_);
|
|
|
|
|
|
+ dynamic_cast < data < T, bool >* >(ptr_);
|
|
|
|
|
|
if (q_bool) {
|
|
if (q_bool) {
|
|
return context::Value(o->*(q_bool->value_));
|
|
return context::Value(o->*(q_bool->value_));
|
|
} else {
|
|
} else {
|
|
data < T, std::vector < double > >* q_double_v =
|
|
data < T, std::vector < double > >* q_double_v =
|
|
- dynamic_cast < data < T, std::vector <
|
|
|
|
|
|
+ dynamic_cast < data < T, std::vector <
|
|
double > >* >(ptr_);
|
|
double > >* >(ptr_);
|
|
|
|
|
|
if (q_double_v) {
|
|
if (q_double_v) {
|
|
return context::Value(o->*(q_double_v->value_));
|
|
return context::Value(o->*(q_double_v->value_));
|
|
} else {
|
|
} else {
|
|
data < T, std::vector < int > >* q_int_v =
|
|
data < T, std::vector < int > >* q_int_v =
|
|
- dynamic_cast < data < T, std::vector <
|
|
|
|
|
|
+ dynamic_cast < data < T, std::vector <
|
|
int > >* >(ptr_);
|
|
int > >* >(ptr_);
|
|
|
|
|
|
if (q_int_v) {
|
|
if (q_int_v) {
|
|
return context::Value(o->*(q_int_v->value_));
|
|
return context::Value(o->*(q_int_v->value_));
|
|
} else {
|
|
} else {
|
|
data < T, std::vector < bool > >* q_bool_v =
|
|
data < T, std::vector < bool > >* q_bool_v =
|
|
- dynamic_cast < data < T, std::vector <
|
|
|
|
|
|
+ dynamic_cast < data < T, std::vector <
|
|
bool > >* >(ptr_);
|
|
bool > >* >(ptr_);
|
|
|
|
|
|
if (q_bool_v) {
|
|
if (q_bool_v) {
|
|
return context::Value(
|
|
return context::Value(
|
|
- o->*(q_bool_v->value_));
|
|
|
|
|
|
+ o->*(q_bool_v->value_));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -225,6 +223,7 @@ public:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
assert(false);
|
|
assert(false);
|
|
|
|
+ return context::Value();
|
|
}
|
|
}
|
|
|
|
|
|
template < typename T >
|
|
template < typename T >
|
|
@@ -232,45 +231,56 @@ public:
|
|
{
|
|
{
|
|
if (ptr_) {
|
|
if (ptr_) {
|
|
data < T, double >* q_double =
|
|
data < T, double >* q_double =
|
|
- dynamic_cast < data < T, double >* >(ptr_);
|
|
|
|
|
|
+ dynamic_cast < data < T, double >* >(ptr_);
|
|
|
|
|
|
if (q_double) {
|
|
if (q_double) {
|
|
return std::to_string(o->*(q_double->value_));
|
|
return std::to_string(o->*(q_double->value_));
|
|
} else {
|
|
} else {
|
|
data < T, int >* q_int =
|
|
data < T, int >* q_int =
|
|
- dynamic_cast < data < T, int >* >(ptr_);
|
|
|
|
|
|
+ dynamic_cast < data < T, int >* >(ptr_);
|
|
|
|
|
|
if (q_int) {
|
|
if (q_int) {
|
|
return std::to_string(o->*(q_int->value_));
|
|
return std::to_string(o->*(q_int->value_));
|
|
} else {
|
|
} else {
|
|
data < T, bool >* q_bool =
|
|
data < T, bool >* q_bool =
|
|
- dynamic_cast < data < T, bool >* >(ptr_);
|
|
|
|
|
|
+ dynamic_cast < data < T, bool >* >(ptr_);
|
|
|
|
|
|
if (q_bool) {
|
|
if (q_bool) {
|
|
return o->*(q_bool->value_) ? "true": "false";
|
|
return o->*(q_bool->value_) ? "true": "false";
|
|
} else {
|
|
} else {
|
|
data < T, std::vector < double > >* q_double_v =
|
|
data < T, std::vector < double > >* q_double_v =
|
|
- dynamic_cast < data < T, std::vector <
|
|
|
|
|
|
+ dynamic_cast < data < T, std::vector <
|
|
double > >* >(ptr_);
|
|
double > >* >(ptr_);
|
|
|
|
|
|
if (q_double_v) {
|
|
if (q_double_v) {
|
|
return "";
|
|
return "";
|
|
} else {
|
|
} else {
|
|
data < T, std::vector < int > >* q_int_v =
|
|
data < T, std::vector < int > >* q_int_v =
|
|
- dynamic_cast < data < T, std::vector <
|
|
|
|
|
|
+ dynamic_cast < data < T, std::vector <
|
|
int > >* >(ptr_);
|
|
int > >* >(ptr_);
|
|
|
|
|
|
if (q_int_v) {
|
|
if (q_int_v) {
|
|
return "";
|
|
return "";
|
|
} else {
|
|
} else {
|
|
data < T, std::vector < bool > >* q_bool_v =
|
|
data < T, std::vector < bool > >* q_bool_v =
|
|
- dynamic_cast < data < T, std::vector <
|
|
|
|
|
|
+ dynamic_cast < data < T, std::vector <
|
|
bool > >* >(ptr_);
|
|
bool > >* >(ptr_);
|
|
|
|
|
|
if (q_bool_v) {
|
|
if (q_bool_v) {
|
|
return "";
|
|
return "";
|
|
} else {
|
|
} else {
|
|
|
|
+#ifdef FORCE_TRACE_ENUM
|
|
|
|
+ data < T, int >* q_enum =
|
|
|
|
+ static_cast < data < T, int >* >(ptr_);
|
|
|
|
+
|
|
|
|
+ if (q_enum) {
|
|
|
|
+ return std::to_string(o->*(q_enum->value_));
|
|
|
|
+ } else {
|
|
|
|
+ return "NA";
|
|
|
|
+ }
|
|
|
|
+#else
|
|
return "NA";
|
|
return "NA";
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|