summaryrefslogtreecommitdiff
path: root/core/property_instance.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/property_instance.hpp')
-rw-r--r--core/property_instance.hpp65
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
contact: Jan Huwald // Impressum