1 #ifndef MSP_DATAFILE_VALUE_H_
2 #define MSP_DATAFILE_VALUE_H_
6 #include <msp/core/attributes.h>
7 #include <msp/core/meta.h>
8 #include <msp/core/variant.h>
22 Value(T &&d, typename std::enable_if<!std::is_same<typename std::remove_reference<T>::type, Value>::value, int>::type = 0):
23 sig(TypeInfo<T>::signature),
24 data(static_cast<typename TypeInfo<T>::Store>(std::forward<T>(d)))
27 Value(const Symbol &d): sig(TypeInfo<Symbol>::signature), data(d) { }
28 Value(Symbol &&d): sig(TypeInfo<Symbol>::signature), data(std::move(d)) { }
31 typename TypeInfo<T>::Load get() const
32 { return get_<typename TypeInfo<T>::Store>(); }
34 char get_signature() const { return sig; }
41 inline T Value::get_() const
43 return data.value<typename TypeInfo<T>::Store>();
47 inline FloatType::Store Value::get_<FloatType::Store>() const
49 if(sig==IntType::signature)
50 return data.value<IntType::Store>();
52 return data.value<FloatType::Store>();
55 } // namespace DataFile