Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions form/form_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,11 @@ namespace {
form::experimental::ensure_builtin_form_product_types_registered();
}

phlex::detail::provider_bundles create_providers(
phlex::product_selector const& selector) override
phlex::provider_bundles create_providers(phlex::product_selector const& selector) override
{
using namespace phlex::experimental;
using namespace phlex::detail;
phlex::detail::provider_bundles bundles;
phlex::provider_bundles bundles;

std::string const* product_type_name =
form::experimental::find_form_product_type_name(selector.type);
Expand Down Expand Up @@ -113,11 +112,11 @@ namespace {
};

bundles.push_back(
phlex::detail::provider_bundle{.provider_function = provider_func,
.max_concurrency = phlex::concurrency::serial,
.spec = std::move(spec),
.layer = std::string(selector_layer.trans_get_string()),
.stage = std::string(selector_stage.trans_get_string())});
phlex::provider_bundle{.provider_function = provider_func,
.max_concurrency = phlex::concurrency::serial,
.spec = std::move(spec),
.layer = std::string(selector_layer.trans_get_string()),
.stage = std::string(selector_stage.trans_get_string())});
}

return bundles;
Expand Down
9 changes: 6 additions & 3 deletions phlex/core/provider_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@
#include <vector>

namespace phlex::detail {

// Function type for type-erased data-product types (used by implicit providers)
using provider_function = std::function<product_ptr(data_cell_index const&)>;
}

namespace phlex {
struct PHLEX_CORE_EXPORT provider_bundle {
phlex::detail::provider_function provider_function;
detail::provider_function provider_function;
concurrency max_concurrency;
product_specification spec;
detail::product_specification spec;
std::string layer;
std::string stage;
};

using provider_bundles = std::vector<provider_bundle>;
}

namespace phlex::detail {
class PHLEX_CORE_EXPORT provider_node {
public:
provider_node(tbb::flow::graph& g, provider_bundle bundle);
Expand Down
10 changes: 2 additions & 8 deletions test/framework_graph_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@ using phlex::detail::framework_driver;

namespace {
struct test_source final : phlex::source {
phlex::detail::provider_bundles create_providers(product_selector const&) override
{
return {};
}
provider_bundles create_providers(product_selector const&) override { return {}; }
};

struct other_source final : phlex::source {
phlex::detail::provider_bundles create_providers(product_selector const&) override
{
return {};
}
provider_bundles create_providers(product_selector const&) override { return {}; }
};

struct test_driver_builder {
Expand Down
23 changes: 11 additions & 12 deletions test/max-parallelism/provide_parallelism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@
namespace {
class max_parallelism_source : public phlex::source {
public:
phlex::detail::provider_bundles create_providers(
phlex::product_selector const& selector) override
phlex::provider_bundles create_providers(phlex::product_selector const& selector) override
{
using namespace phlex::experimental;
using namespace phlex::detail;
phlex::detail::provider_bundles bundles;
phlex::provider_bundles bundles;
std::string const layer = "job";
std::string const stage = "CURRENT";
product_specification spec{"input", "max_parallelism", make_type_id<std::size_t>()};

if (selector.match(spec, identifier{layer}, identifier{stage})) {
bundles.push_back(phlex::detail::provider_bundle{
.provider_function =
[](phlex::data_cell_index const&) {
return product_for(max_allowed_parallelism::active_value());
},
.max_concurrency = phlex::concurrency::unlimited,
.spec = std::move(spec),
.layer = layer,
.stage = stage});
bundles.push_back(phlex::provider_bundle{.provider_function =
[](phlex::data_cell_index const&) {
return product_for(
max_allowed_parallelism::active_value());
},
.max_concurrency = phlex::concurrency::unlimited,
.spec = std::move(spec),
.layer = layer,
.stage = stage});
}
return bundles;
}
Expand Down
12 changes: 6 additions & 6 deletions test/output_products_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace {
}

class test_source : public detail::source {
detail::provider_bundles create_providers(product_selector const& selector) override
provider_bundles create_providers(product_selector const& selector) override
{
using namespace experimental;
using namespace phlex::detail;
Expand All @@ -53,11 +53,11 @@ namespace {
product_specification spec{"provide_name", "", make_type_id<std::string>()};

if (selector.match(spec, identifier{layer}, identifier{stage})) {
bundles.push_back(phlex::detail::provider_bundle{.provider_function = give_me_a_name,
.max_concurrency = concurrency::unlimited,
.spec = std::move(spec),
.layer = layer,
.stage = stage});
bundles.push_back(provider_bundle{.provider_function = give_me_a_name,
.max_concurrency = concurrency::unlimited,
.spec = std::move(spec),
.layer = layer,
.stage = stage});
}
return bundles;
}
Expand Down
2 changes: 1 addition & 1 deletion test/product_selecting_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace {

class archived_count_source : public source {
public:
detail::provider_bundles create_providers(product_selector const& selector) override
provider_bundles create_providers(product_selector const& selector) override
{
using namespace experimental::literals;
phlex::detail::product_specification spec{
Expand Down
24 changes: 11 additions & 13 deletions test/provider_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace {
// Vertices source for implicit provider test
class vertices_source : public phlex::source {
public:
phlex::detail::provider_bundles create_providers(product_selector const& selector) override
provider_bundles create_providers(product_selector const& selector) override
{
using namespace experimental;
using namespace phlex::detail;
Expand All @@ -48,22 +48,20 @@ namespace {
"vertices_maker", "happy_vertices", make_type_id<toy::vertex_collection>()};

if (selector.match(spec, identifier{layer}, identifier{stage})) {
bundles.push_back(
phlex::detail::provider_bundle{.provider_function = give_me_vertices_erased,
.max_concurrency = concurrency::unlimited,
.spec = std::move(spec),
.layer = layer,
.stage = stage});
bundles.push_back(provider_bundle{.provider_function = give_me_vertices_erased,
.max_concurrency = concurrency::unlimited,
.spec = std::move(spec),
.layer = layer,
.stage = stage});
}

product_specification int_spec{"vertices_maker", "num_happy_vertices", make_type_id<int>()};
if (selector.match(int_spec, identifier{layer}, identifier{stage})) {
bundles.push_back(
phlex::detail::provider_bundle{.provider_function = give_me_vertices_erased,
.max_concurrency = concurrency::unlimited,
.spec = std::move(int_spec),
.layer = layer,
.stage = stage});
bundles.push_back(provider_bundle{.provider_function = give_me_vertices_erased,
.max_concurrency = concurrency::unlimited,
.spec = std::move(int_spec),
.layer = layer,
.stage = stage});
}
return bundles;
}
Expand Down
2 changes: 1 addition & 1 deletion test/source_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace phlex;

namespace {
class empty_source final : public source {
detail::provider_bundles create_providers(product_selector const&) override { return {}; }
provider_bundles create_providers(product_selector const&) override { return {}; }
};
}

Expand Down
Loading