#ifndef LVOy9pHh2bcXzO1tZ5oxb80UXy8 #define LVOy9pHh2bcXzO1tZ5oxb80UXy8 #include #include #include "property_instance.hpp" #include "property_list.hpp" #include "quant_types.hpp" #include "template_helpers.hpp" // worker template forward decl template struct PLA_Set_Impl; // PLA template template struct PLA_Set { // action consts typedef Void result_t; template struct local_state_t { typedef ContextProp prop; static const bool write = _doWriteResult; }; // action parameters typedef typename Prop::instance_ptr_t instance_t; typedef typename boost::mpl::if_, Time, FakeTime>::type time_t; typedef typename Prop::type value_t; instance_t instance; time_t time; value_t value; result_t result; inline PLA_Set(instance_t instance, value_t value) : instance(instance), value(value) { // ctor only allowed for discrete properties BOOST_STATIC_ASSERT((boost::is_same::value)); } inline PLA_Set(time_t time, instance_t instance, value_t value) : instance(instance), time(time), value(value) { } // action methods template inline void pre(_PropComp &pc, _ContextData &data, _LocalState &state) { } template inline void post(PropComp &pl, ContextData &data, LocalState &state) { BOOST_MPL_ASSERT(( PL_Contains, Prop> )); PLA_Set_Impl ::eval(data, instance, time, value); } }; // worker template implementation // * do nothing at the wrong type template struct PLA_Set_Impl { static inline void eval(Data &data, typename PLA_Set::instance_t instance, typename PLA_Set::time_t time, typename Prop::type &value) { } }; // * store pointer to the data structure at the correct type template struct PLA_Set_Impl { static inline void eval(Data &data, typename PLA_Set::instance_t instance, typename PLA_Set::time_t time, typename Prop::type &value) { data.data.set(time, instance(), value); } }; template struct PLA_Set_Impl { static inline void eval(Data &data, typename PLA_Set::instance_t instance, typename PLA_Set::time_t time, typename Prop::type &value) { data.data.set(instance(), value); } }; #endif // LVOy9pHh2bcXzO1tZ5oxb80UXy8