diff options
Diffstat (limited to 'core/pla_sync.hpp')
-rw-r--r-- | core/pla_sync.hpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/core/pla_sync.hpp b/core/pla_sync.hpp new file mode 100644 index 0000000..7114cb4 --- /dev/null +++ b/core/pla_sync.hpp @@ -0,0 +1,47 @@ +#ifndef aVCkmoPnFvf2TxOWrvfVb5qPbZM +#define aVCkmoPnFvf2TxOWrvfVb5qPbZM + +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_same.hpp> + +#include "property_instance.hpp" +#include "property_list.hpp" +#include "quant_types.hpp" +#include "template_helpers.hpp" + +// worker template forward decl +template<typename Data, bool isWrite /* == false */> +struct PLA_Sync_Impl { + static void eval(Data &) {} +}; + +template<typename Data> +struct PLA_Sync_Impl<Data, true> { + static void eval(Data &data) { + data.data.sync(); + } +}; + +// PLA template +struct PLA_Sync { + // action consts + typedef Void result_t; + template<typename ContextProp, bool doWriteResult> struct local_state_t { + typedef ContextProp prop; + static const bool write = doWriteResult; + }; + + result_t result; + + // action parameters + template<typename _PC, typename _ContextData, typename _LocalState> + inline void pre(_PC &, _ContextData &, _LocalState &) {} + + + template<typename _PC, typename ContextData, typename LocalState> + inline void post(_PC &, ContextData &data, LocalState &) { + PLA_Sync_Impl<ContextData, LocalState::write>::eval(data); + } +}; + +#endif // aVCkmoPnFvf2TxOWrvfVb5qPbZM |