File indexing completed on 2025-01-18 09:50:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_PROPERTY_MAP_PARALLEL_SIMPLE_TRIGGER_HPP
0013 #define BOOST_PROPERTY_MAP_PARALLEL_SIMPLE_TRIGGER_HPP
0014
0015 #include <boost/property_map/parallel/process_group.hpp>
0016
0017 namespace boost { namespace parallel {
0018
0019 namespace detail {
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 template<typename Class, typename T, typename Result>
0030 class simple_trigger_t
0031 {
0032 public:
0033 simple_trigger_t(Class* self,
0034 Result (Class::*pmf)(int, int, const T&,
0035 trigger_receive_context))
0036 : self(self), pmf(pmf) { }
0037
0038 Result
0039 operator()(int source, int tag, const T& data,
0040 trigger_receive_context context) const
0041 {
0042 return (self->*pmf)(source, tag, data, context);
0043 }
0044
0045 private:
0046 Class* self;
0047 Result (Class::*pmf)(int, int, const T&, trigger_receive_context);
0048 };
0049
0050 }
0051
0052
0053
0054
0055
0056
0057
0058
0059 template<typename ProcessGroup, typename Class, typename T>
0060 inline void
0061 simple_trigger(ProcessGroup& pg, int tag, Class* self,
0062 void (Class::*pmf)(int source, int tag, const T& data,
0063 trigger_receive_context context), int)
0064 {
0065 pg.template trigger<T>(tag,
0066 detail::simple_trigger_t<Class, T, void>(self, pmf));
0067 }
0068
0069
0070
0071
0072
0073
0074
0075
0076 template<typename ProcessGroup, typename Class, typename T, typename Result>
0077 inline void
0078 simple_trigger(ProcessGroup& pg, int tag, Class* self,
0079 Result (Class::*pmf)(int source, int tag, const T& data,
0080 trigger_receive_context context), long)
0081 {
0082 pg.template trigger_with_reply<T>
0083 (tag, detail::simple_trigger_t<Class, T, Result>(self, pmf));
0084 }
0085
0086
0087
0088
0089
0090
0091 template<typename ProcessGroup, typename Class, typename T, typename Result>
0092 inline void
0093 simple_trigger(ProcessGroup& pg, int tag, Class* self,
0094 Result (Class::*pmf)(int source, int tag, const T& data,
0095 trigger_receive_context context))
0096 {
0097
0098
0099 simple_trigger(pg, tag, self, pmf, 0);
0100 }
0101
0102 } }
0103
0104 namespace boost { namespace graph { namespace parallel { using boost::parallel::simple_trigger; } } }
0105
0106 #endif