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/discrete_property.hpp |
Diffstat (limited to 'core/discrete_property.hpp')
-rw-r--r-- | core/discrete_property.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/core/discrete_property.hpp b/core/discrete_property.hpp new file mode 100644 index 0000000..741049f --- /dev/null +++ b/core/discrete_property.hpp @@ -0,0 +1,39 @@ +#ifndef iNnFGNqFLlBaWFgGGH0sLM3mh40 +#define iNnFGNqFLlBaWFgGGH0sLM3mh40 + +#include "pointers.hpp" +#include "string_helpers.hpp" +#include "template_helpers.hpp" + +/// Macros + +#define GEN_DP(Quant, nameT, nameS, ValueType) \ +struct nameT { \ + typedef ValueType type; \ + typedef Quant quant; \ + typedef Quant::instance_ptr_t instance_ptr_t; \ + static const uint32_t size = sizeof(ValueType); \ + static const char* const name; \ +}; \ + \ +const char* const nameT::name = nameS; + +#define GEN_DP_DELAY(DQuant, CQuant, Rule) \ +template<> \ +struct DiscreteProperty_ComputeDelay<DQuant, CQuant> { \ + template<typename PC, typename Context, typename Transaction> \ + inline static Time eval(PC &pc, Context context, \ + Transaction transaction, Time t) { \ + return Rule; \ + } \ +}; + +/// default impls + +template<typename DQuant, typename CQuant> +struct DiscreteProperty_ComputeDelay { + template<typename PC, typename Context, typename Transaction> + inline static Time eval(PC &, Context, Transaction, Time) DO_NOT_CALL +}; + +#endif // iNnFGNqFLlBaWFgGGH0sLM3mh40 |