Support phlex::sources and implicit providers#637
Conversation
✅ 7 CodeQL alerts resolved compared to main
Review the full CodeQL report for details. |
7ce86e6 to
415a7c9
Compare
415a7c9 to
c4d0b3d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #637 +/- ##
==========================================
- Coverage 83.27% 83.05% -0.22%
==========================================
Files 162 164 +2
Lines 5912 6002 +90
Branches 670 682 +12
==========================================
+ Hits 4923 4985 +62
- Misses 796 824 +28
Partials 193 193
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
c4d0b3d to
4875ba8
Compare
4875ba8 to
4f4b2af
Compare
Clang-Tidy Check ResultsFound 5948 issue(s); none are newly introduced by this patch. All issues by check:
See inline comments for details. Comment |
|
|
||
| TEST_CASE("Implicit providers") | ||
| { | ||
| constexpr auto max_events{3u}; |
There was a problem hiding this comment.
Consider change max_events to num_spills or the like.
| g.execute(); | ||
|
|
||
| CHECK(g.execution_count("passer") == max_events); | ||
| } |
There was a problem hiding this comment.
Consider checking the execution count on the provider itself, in addition to checking that the transform was triggered (by the provider) the right number of times.
|
|
||
| CHECK_THROWS_WITH( | ||
| g.execute(), | ||
| Catch::Matchers::ContainsSubstring("Node with name 'vertices_source' already exists")); |
There was a problem hiding this comment.
Consider changing the message in the exception to say "Source with name ...".
| } | ||
|
|
||
| template <std::derived_from<source> Source, typename... Args> | ||
| void source(std::string name, Args&&... args) |
There was a problem hiding this comment.
Because this creates a new thing in the graph on which it is called, consider renaming to add_source.
This probably should be done for the other node types as well, so an issue that addresses this should be created.
|
|
||
| /// @brief Registers a source (used by the framework to create provider nodes) | ||
| template <std::derived_from<source> Source, typename... Args> | ||
| void source(std::string name, Args&&... args) |
There was a problem hiding this comment.
The same comment as put in graph::source applies here: consider renaming to add_source.
| source_map const& sources, | ||
| tbb::flow::graph& g) | ||
| { | ||
| index_router::provider_input_ports_t result; |
There was a problem hiding this comment.
Consider renaming result to resulting_input_ports or the like.
|
|
||
| auto& bundle = bundles[0]; | ||
| auto const& spec = bundle.specification(); | ||
| auto node = std::make_unique<provider_node>(spec.creator(), |
There was a problem hiding this comment.
Consider filing an issue that makes the argument list of the constructor of provider_node shorter by passing in the provider_bundle rather than passing in the innards of the provider_bundle.
| std::string layer, | ||
| std::string stage); | ||
|
|
||
| std::function<provider_function_t> release_provider_function(); |
There was a problem hiding this comment.
We have accessors for all data members; consider making this class a struct, adjust member names, and removing accessors.
| #define PHLEX_DETAIL_REGISTER_PLUGIN(token_type, func_name, dll_alias, ...) \ | ||
| extern "C" PHLEX_DETAIL_SELECT_SIGNATURE(token_type, dll_alias, __VA_ARGS__) | ||
|
|
||
| // ================================================================================================ |
There was a problem hiding this comment.
Are there tests for these macros? If not, some should be added.
marcpaterno
left a comment
There was a problem hiding this comment.
Please see the already-filed comments.
This PR implements the majority of features discussed here, such as:
phlex::provider_bundleclassphlex::sourcebase classPHLEX_REGISTER_SOURCEmacro andg.source<T>(...)registration