2626#include < functional>
2727#include < map>
2828#include < memory>
29+ #include < optional>
2930#include < string>
3031#include < tuple>
3132#include < utility>
@@ -38,17 +39,28 @@ namespace phlex {
3839namespace phlex ::experimental {
3940 class PHLEX_CORE_EXPORT framework_graph {
4041 public:
41- explicit framework_graph ( int max_parallelism = oneapi::tbb::info::default_concurrency());
42- explicit framework_graph (detail:: next_index_t next_index,
43- int max_parallelism = oneapi::tbb::info::default_concurrency());
44- explicit framework_graph (driver_bundle bundle,
45- int max_parallelism = oneapi::tbb::info::default_concurrency());
42+ [[nodiscard]] static framework_graph with_default_driver (
43+ int max_parallelism = oneapi::tbb::info::default_concurrency());
44+ [[nodiscard]] static framework_graph without_driver (
45+ int max_parallelism = oneapi::tbb::info::default_concurrency());
46+
4647 ~framework_graph ();
4748 framework_graph (framework_graph const &) = delete ;
4849 framework_graph& operator =(framework_graph const &) = delete ;
4950 framework_graph (framework_graph&&) = delete ;
5051 framework_graph& operator =(framework_graph&&) = delete ;
5152
53+ void add_driver (driver_bundle bundle);
54+
55+ template <typename Generator>
56+ requires requires (std::shared_ptr<Generator> generator, std::vector<source const *> sources) {
57+ { experimental::driver_proxy{sources}.driver (generator) } -> std::same_as<driver_bundle>;
58+ }
59+ void add_driver (std::shared_ptr<Generator> generator)
60+ {
61+ add_driver (driver_proxy ().driver (std::move (generator)));
62+ }
63+
5264 void execute ();
5365
5466 std::size_t seen_cell_count (std::string const & layer_name, bool missing_ok = false ) const ;
@@ -64,6 +76,11 @@ namespace phlex::experimental {
6476 return {config, graph_, nodes_, registration_errors_};
6577 }
6678
79+ experimental::driver_proxy driver_proxy (std::vector<std::string> strings = {})
80+ {
81+ return experimental::driver_proxy (nodes_.sources_for (strings));
82+ }
83+
6784 // Framework function registrations
6885
6986 // N.B. declare_output() is not directly accessible through framework_graph. Is this
@@ -115,9 +132,9 @@ namespace phlex::experimental {
115132 }
116133
117134 template <std::derived_from<source> Source, typename ... Args>
118- void source (std::string name, Args&&... args)
135+ void add_source (std::string name, Args&&... args)
119136 {
120- return make_glue ().template source <Source>(std::move (name), std::forward<Args>(args)...);
137+ return make_glue ().template add_source <Source>(std::move (name), std::forward<Args>(args)...);
121138 }
122139
123140 template <typename T, typename ... Args>
@@ -170,6 +187,9 @@ namespace phlex::experimental {
170187 void finalize_router (index_router::provider_input_ports_t provider_input_ports,
171188 std::map<std::string, named_index_ports> multilayer_join_index_ports);
172189
190+ enum class driver_mode { default_driver, deferred_driver };
191+ explicit framework_graph (driver_mode mode, int max_parallelism);
192+
173193 resource_usage graph_resource_usage_{};
174194 max_allowed_parallelism parallelism_limit_;
175195 fixed_hierarchy fixed_hierarchy_;
@@ -178,7 +198,7 @@ namespace phlex::experimental {
178198 std::map<std::string, filter> filters_{};
179199 // The graph_ object uses the filters_, nodes_, and hierarchy_ objects implicitly.
180200 tbb::flow::graph graph_{};
181- framework_driver driver_;
201+ std::optional< framework_driver> driver_{} ;
182202 std::vector<std::string> registration_errors_{};
183203 data_cell_tracker cell_tracker_{};
184204 tbb::flow::input_node<ready_flushes_then_emit> src_;
@@ -187,6 +207,7 @@ namespace phlex::experimental {
187207 index_receiver_;
188208 tbb::flow::function_node<data_cell_index_ptr, tbb::flow::continue_msg, tbb::flow::lightweight>
189209 hierarchy_node_;
210+ driver_mode driver_mode_{driver_mode::default_driver};
190211 bool shutdown_on_error_{false };
191212 };
192213}
0 commit comments