1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#ifndef H3OuNUuw3KK0wmZozXqMmrvzz3M
#define H3OuNUuw3KK0wmZozXqMmrvzz3M
#include <inttypes.h>
#include <boost/mpl/bool.hpp>
#include "context.hpp"
#include "index_global.hpp"
#include "index_spike.hpp"
#include "index_spike_arrival.hpp"
#include "pointers.hpp"
#include "quant_types.hpp"
#include "time.hpp"
////////////////////////////////////////////////////////////////////////////////
// event related actions
////////////////////////////////////////////////////////////////////////////////
// evolve in time - default case: value remains the same
template<typename PropComp, typename Prop, typename Quant, typename Context>
struct ContinuousProperty_Evolve {
static inline typename Prop::type eval
(PropComp &, Context context, Time t, Time dt);
};
// apply an incoming event - default case: do not send anything
template<typename PropComp, typename Prop, typename Quant, typename EventQuant,
typename Context, typename IntentMap, typename Transaction>
struct ContinuousProperty_Apply {
static inline void eval(PropComp &, Context, Time, IntentMap &, Transaction &) {}
};
// apply an incoming event: do we change the prop val at all?
template<typename Prop, typename SrcQ>
struct ContinuousProperty_ApplyChangesProp : boost::mpl::bool_<false> {};
// generate an outgoing event - default case: generate nothing
template<typename Prop, typename Quant, typename EventQuant>
struct ContinuousProperty_Generate {
template<typename PropComp, typename Context, typename MQ, typename MI>
static inline void eval(PropComp &, Context, Time, typename Prop::type &,
MI &, MQ &) {}
static const bool changesValue = false;
};
////////////////////////////////////////////////////////////////////////////////
// definition helpers
////////////////////////////////////////////////////////////////////////////////
#define GEN_CP(Quant, nameT, nameS, ValueType, InitialVal) \
struct nameT { \
typedef ValueType type; \
typedef Quant quant; \
typedef Quant::instance_ptr_t instance_ptr_t; \
\
static const ValueType initialValue; \
static const uint32_t size = sizeof(ValueType); \
static const char* const name; \
}; \
\
const char* const nameT::name = nameS; \
const ValueType nameT::initialValue{InitialVal};
#define GEN_CPL_EVOLVE(nameT) \
template<typename PropComp, typename Context> \
struct ContinuousProperty_Evolve<PropComp, nameT, nameT::quant, Context> { \
inline static nameT::type eval(PropComp &pc, Context context, Time t, Time td)
#define GEN_CP_EVOLVE(nameT, ReturnVal) \
GEN_CPL_EVOLVE(nameT) { \
return ReturnVal; \
} \
};
#define GEN_CP_APPLY(Property, EventQuant, ChangeProp) \
template<> \
struct ContinuousProperty_ApplyChangesProp<Property, EventQuant> \
: boost::mpl::bool_<ChangeProp> {}; \
\
template<typename PropComp, typename Quant, typename Context, typename IntentMap, typename Transaction> \
struct ContinuousProperty_Apply<PropComp, Property, Quant, EventQuant, Context, IntentMap, Transaction> { \
typedef boost::mpl::bool_<ChangeProp> changeProp_t; \
static inline void eval(PropComp &pc, Context context, Time t, IntentMap &intent, Transaction &transaction)
#define GEN_CP_GENERATE(CQ, DQ, Prop) \
template<> \
struct ContinuousProperty_Generate<Prop, CQ, DQ> { \
static const bool changesValue = true; \
template<typename PropComp, typename Context, typename MQ, typename MI> \
static inline void eval(PropComp &pc, Context context, Time t, \
Prop::type &value, MI &indices, MQ &queues)
#endif // H3OuNUuw3KK0wmZozXqMmrvzz3M
|