diff options
author | Jan Huwald <jh@sotun.de> | 2012-05-07 20:01:51 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2012-05-07 20:01:51 (GMT) |
commit | 420d2ef464d4a741028e132e662d5626806a41f5 (patch) | |
tree | 1aca6eb512e4ed0fb5f3c10c528cb998b6ffd695 /core/property_instance.hpp |
Diffstat (limited to 'core/property_instance.hpp')
-rw-r--r-- | core/property_instance.hpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/core/property_instance.hpp b/core/property_instance.hpp new file mode 100644 index 0000000..74a1a98 --- /dev/null +++ b/core/property_instance.hpp @@ -0,0 +1,65 @@ +#ifndef m6EAApyWyIDlhjYO7FswFNLRrB0 +#define m6EAApyWyIDlhjYO7FswFNLRrB0 + +#include <boost/static_assert.hpp> + +#include "checkpoint.hpp" +#include "ephermal_checkpoint.hpp" +#include "pointers.hpp" +#include "quant_types.hpp" +#include "string_helpers.hpp" + +namespace PropertyInstanceImpl { + +template < + typename Prop, + bool doWriteResults, + typename Quant = typename Prop::quant, + typename QuantClass = typename Prop::quant::class_t + > struct PropertyInstance_Container; + +template <typename Prop> +struct PropertyInstance_Container< + Prop, true, typename Prop::quant, ContinuousPropertyClass> { + PropertyInstance_Container() : + data(string(Prop::quant::name) + "_" + string(Prop::name), Prop::initialValue) + {} + typedef Checkpoint<typename Prop::type, + Prop::quant::instance_ptr_t::numInstances()> type; + type data; +}; + +template <typename Prop> +struct PropertyInstance_Container< + Prop, false, typename Prop::quant, ContinuousPropertyClass> { + PropertyInstance_Container() : + data(string(Prop::quant::name) + "_" + string(Prop::name), Prop::initialValue) + {} + typedef EphermalCheckpoint<typename Prop::type, + Prop::quant::instance_ptr_t::numInstances()> type; + type data; +}; + +template <typename Prop, bool doWriteResults> +struct PropertyInstance_Container< + Prop, doWriteResults, typename Prop::quant, DiscretePropertyClass> { + PropertyInstance_Container() : + data(string(Prop::quant::name) + "_" + string(Prop::name), + Prop::instance_ptr_t::maxInstances()) + {} + typedef Vector< + typename Prop::type, + 8 * Prop::size, // size in [bits] + boost::mpl::bool_<doWriteResults> + > type; + type data; +}; + +} // namespace PropertyInstanceImpl + +template <typename Prop, bool doWriteResults> +struct PropertyInstance : + PropertyInstanceImpl::PropertyInstance_Container<Prop, doWriteResults> {}; + + +#endif // m6EAApyWyIDlhjYO7FswFNLRrB0 |