#ifndef RAA4DT8yVWXBMqy1rxYiM12MKFA #define RAA4DT8yVWXBMqy1rxYiM12MKFA #include #include #include #include #include #include #include #include #include #include "property_instance.hpp" #include "template_helpers.hpp" namespace PLImpl { using namespace boost::mpl; // forward decls template struct PL_Contains; /// PL - Property List // template template struct PL { // compile time data structure (types) typedef typename front::type head_t; typedef typename pop_front::type tail_t; typedef typename head_t::first prop_t; typedef typename head_t::second doWriteResult_t; typedef typename if_, PL, PL >::type next_t; typedef PropertyInstance data_t; // access methods // template params: // - PropComp: the list of all properties // - Action: the action class to call template inline typename Action::result_t call(PropComp &pc, Action &action) { typename Action::template local_state_t state; action.pre(pc, data, state); tail.call(pc, action); action.post(pc, data, state); return action.result; } // data members data_t data; next_t tail; // integrity checks: // 1. each property may be used only once BOOST_MPL_ASSERT(( not_< PL_Contains< next_t, prop_t > > )); // TODO (beauty): dependencies (once they are implemented anywhere) }; // the empty tail template<> struct PL { typedef Void prop_t; typedef PL tail_t; typedef Void data_t; template inline typename Action::result_t call(PropComp &pc, Action &action) { return typename Action::result_t(); } }; /// PL Template Helpers template struct PL_Contains : boost::mpl::or_< boost::is_same, PL_Contains > { }; template struct PL_Contains, Needle> : boost::mpl::false_ { }; }; using PLImpl::PL; using PLImpl::PL_Contains; #endif // RAA4DT8yVWXBMqy1rxYiM12MKFA