55#include " phlex/concurrency.hpp"
66#include " phlex/configuration.hpp"
77#include " phlex/core/graph_proxy.hpp"
8-
9- #include " boost/preprocessor.hpp"
8+ #include " phlex/detail/plugin_macros.hpp"
109
1110namespace phlex ::experimental {
1211 template <typename T>
13- class source_token : graph_proxy<T> {
12+ class source_graph_proxy : graph_proxy<T> {
1413 using base = graph_proxy<T>;
1514
1615 public:
1716 using base::graph_proxy;
1817
18+ // FIXME: make sure functions called from make<T>(...) are restricted to the functions below:
19+ // Users can call make<T>(...).provide(...) but not make<T>(...).fold(...)
1920 using base::make;
2021
22+ // Only provide(...) should be accessible
2123 using base::provide;
2224 };
2325
@@ -26,23 +28,8 @@ namespace phlex::experimental {
2628 }
2729}
2830
29- #define SOURCE_NARGS (...) BOOST_PP_DEC(BOOST_PP_VARIADIC_SIZE(__VA_OPT__(, ) __VA_ARGS__))
30-
31- #define CREATE_SOURCE_1ARG (m ) \
32- void create_src (phlex::experimental::source_token<phlex::experimental::void_tag>& m, \
33- phlex::experimental::configuration const &)
34- #define CREATE_SOURCE_2ARGS (m, pset ) \
35- void create_src (phlex::experimental::source_token<phlex::experimental::void_tag>& m, \
36- phlex::experimental::configuration const & config)
37-
38- #define SELECT_SOURCE_SIGNATURE (...) \
39- BOOST_PP_IF (BOOST_PP_EQUAL(SOURCE_NARGS(__VA_ARGS__), 1), \
40- CREATE_SOURCE_1ARG, \
41- CREATE_SOURCE_2ARGS)(__VA_ARGS__)
42-
4331#define PHLEX_EXPERIMENTAL_REGISTER_PROVIDERS (...) \
44- static SELECT_SOURCE_SIGNATURE (__VA_ARGS__); \
45- BOOST_DLL_ALIAS (create_src, create_source) \
46- SELECT_SOURCE_SIGNATURE(__VA_ARGS__)
32+ PHLEX_DETAIL_REGISTER_PLUGIN ( \
33+ phlex::experimental::source_graph_proxy, create, create_source, __VA_ARGS__)
4734
4835#endif // PHLEX_SOURCE_HPP
0 commit comments