1 #ifndef MSP_DATAFILE_VALUE_H_
2 #define MSP_DATAFILE_VALUE_H_
5 #include <msp/core/meta.h>
6 #include <msp/core/variant.h>
22 sig(TypeInfo<T>::signature),
23 data(static_cast<typename TypeInfo<T>::Store>(d))
26 Value(Symbol d): sig(TypeInfo<Symbol>::signature), data(d) { }
29 typename RemoveReference<T>::Type get() const
30 { return get_<typename TypeInfo<T>::Store>(); }
32 char get_signature() const { return sig; }
38 typedef std::vector<Value> ValueArray __attribute__((deprecated));
41 inline T Value::get_() const
43 if(sig!=TypeInfo<T>::signature)
44 throw TypeError("Type mismatch");
46 return data.value<typename TypeInfo<T>::Store>();
50 inline FloatType::Store Value::get_<FloatType::Store>() const
52 if(sig==IntType::signature)
53 return data.value<IntType::Store>();
54 else if(sig!=FloatType::signature)
55 throw TypeError("Type mismatch");
57 return data.value<FloatType::Store>();
60 } // namespace DataFile