#ifndef H3OuNUuw3KK0wmZozXqMmrvzz3M #define H3OuNUuw3KK0wmZozXqMmrvzz3M #include #include #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 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 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 struct ContinuousProperty_ApplyChangesProp : boost::mpl::bool_ {}; // generate an outgoing event - default case: generate nothing template struct ContinuousProperty_Generate { template 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 \ struct ContinuousProperty_Evolve { \ 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 \ : boost::mpl::bool_ {}; \ \ template \ struct ContinuousProperty_Apply { \ typedef boost::mpl::bool_ 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 { \ static const bool changesValue = true; \ template \ static inline void eval(PropComp &pc, Context context, Time t, \ Prop::type &value, MI &indices, MQ &queues) #endif // H3OuNUuw3KK0wmZozXqMmrvzz3M