Skip to content
Merged
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
2 changes: 1 addition & 1 deletion form/form_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace {

}

PHLEX_EXPERIMENTAL_REGISTER_ALGORITHMS(m, config)
PHLEX_REGISTER_ALGORITHMS(m, config)
{
std::cout << "Registering FORM output module...\n";

Expand Down
2 changes: 1 addition & 1 deletion phlex/concurrency.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <cstddef>

namespace phlex::experimental {
namespace phlex {
struct concurrency {
static concurrency const unlimited;
static concurrency const serial;
Expand Down
2 changes: 1 addition & 1 deletion phlex/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <ranges>
#include <string>

namespace phlex::experimental {
namespace phlex {
std::vector<std::string> configuration::keys() const
{
std::vector<std::string> result;
Expand Down
2 changes: 1 addition & 1 deletion phlex/configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <utility>
#include <vector>

namespace phlex::experimental {
namespace phlex {

namespace detail {
template <typename T>
Expand Down
2 changes: 1 addition & 1 deletion phlex/core/concurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "oneapi/tbb/flow_graph.h"

namespace phlex::experimental {
namespace phlex {
concurrency const concurrency::unlimited{tbb::flow::unlimited};
concurrency const concurrency::serial{tbb::flow::serial};
}
4 changes: 2 additions & 2 deletions phlex/core/detail/filter_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include <string>

namespace {
phlex::experimental::product_query const output_dummy{phlex::experimental::product_specification{
phlex::product_query const output_dummy{phlex::experimental::product_specification{
phlex::experimental::algorithm_name{"for_output_only", ""},
"for_output_only",
phlex::experimental::type_id{}}};
std::vector<phlex::experimental::product_query> const for_output_only{output_dummy};
std::vector<phlex::product_query> const for_output_only{output_dummy};
}

namespace phlex::experimental {
Expand Down
5 changes: 4 additions & 1 deletion phlex/core/detail/make_algorithm_name.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

#include <string>

namespace phlex {
class configuration;
}

namespace phlex::experimental {
class algorithm_name;
class configuration;

namespace detail {
algorithm_name make_algorithm_name(configuration const* config, std::string name);
Expand Down
2 changes: 1 addition & 1 deletion phlex/core/detail/maybe_predicates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
namespace phlex::experimental::detail {
std::optional<std::vector<std::string>> maybe_predicates(configuration const* config)
{
return config->get_if_present<std::vector<std::string>>("when");
return config->get_if_present<std::vector<std::string>>("experimental_when");
}
}
8 changes: 4 additions & 4 deletions phlex/core/detail/maybe_predicates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#include <string>
#include <vector>

namespace phlex::experimental {
namespace phlex {
class configuration;
}

namespace detail {
std::optional<std::vector<std::string>> maybe_predicates(configuration const* config);
}
namespace phlex::experimental::detail {
std::optional<std::vector<std::string>> maybe_predicates(configuration const* config);
}

#endif // PHLEX_CORE_DETAIL_MAYBE_PREDICATES_HPP
4 changes: 3 additions & 1 deletion phlex/core/framework_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
#include <utility>
#include <vector>

namespace phlex::experimental {
namespace phlex {
class configuration;
}

namespace phlex::experimental {
class layer_sentry {
public:
layer_sentry(flush_counters& counters, message_sender& sender, product_store_ptr store);
Expand Down
5 changes: 4 additions & 1 deletion phlex/core/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ namespace phlex::experimental {
class products_consumer;

using end_of_message_ptr = std::shared_ptr<end_of_message>;
using framework_driver = async_driver<data_cell_index_ptr>;
}

namespace phlex {
using framework_driver = experimental::async_driver<data_cell_index_ptr>;
}

#endif // PHLEX_CORE_FWD_HPP
Expand Down
5 changes: 4 additions & 1 deletion phlex/core/glue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
#include <tuple>
#include <utility>

namespace phlex::experimental {
namespace phlex {
class configuration;
}

namespace phlex::experimental {
struct node_catalog;

namespace detail {
Expand Down
5 changes: 4 additions & 1 deletion phlex/core/graph_proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
#include <utility>
#include <vector>

namespace phlex::experimental {
namespace phlex {
class configuration;
}

namespace phlex::experimental {
// ==============================================================================
// Registering user functions

Expand Down
24 changes: 13 additions & 11 deletions phlex/core/product_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
return {std::move(spec), std::move(data_layer)};
}

std::ostream& operator<<(std::ostream& os, product_query const& query)
{
os << query.to_string();
return os;

Check warning on line 21 in phlex/core/product_query.cpp

View check run for this annotation

Codecov / codecov/patch

phlex/core/product_query.cpp#L20-L21

Added lines #L20 - L21 were not covered by tests
}
}

namespace phlex {
std::string product_query::to_string() const
{
if (layer.empty()) {
Expand All @@ -23,14 +31,6 @@
return fmt::format("{} ϵ {}", spec.full(), layer);
}

product_tag operator""_in(char const* product_name, std::size_t length)
{
if (length == 0ull) {
throw std::runtime_error("Cannot specify product with empty name.");
}
return {product_specification::create(product_name)};
}

bool operator==(product_query const& a, product_query const& b)
{
return std::tie(a.spec, a.layer) == std::tie(b.spec, b.layer);
Expand All @@ -43,9 +43,11 @@
return std::tie(a.spec, a.layer) < std::tie(b.spec, b.layer);
}

std::ostream& operator<<(std::ostream& os, product_query const& query)
experimental::product_tag operator""_in(char const* product_name, std::size_t length)
{
os << query.to_string();
return os;
if (length == 0ull) {
throw std::runtime_error("Cannot specify product with empty name.");
}
return {experimental::product_specification::create(product_name)};
}
}
25 changes: 14 additions & 11 deletions phlex/core/product_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,26 @@
#include <string>
#include <vector>

namespace phlex::experimental {
namespace phlex {
struct product_query {
product_specification spec;
experimental::product_specification spec;
std::string layer;
std::string to_string() const;
};

bool operator==(product_query const& a, product_query const& b);
bool operator!=(product_query const& a, product_query const& b);
bool operator<(product_query const& a, product_query const& b);

using product_queries = std::vector<product_query>;
}

namespace phlex::experimental {
struct product_tag {
product_specification spec;
product_query operator()(std::string layer) &&;
};

using product_queries = std::vector<product_query>;

inline auto& to_name(product_query const& query) { return query.spec.name(); }
inline auto& to_layer(product_query& query) { return query.layer; }

product_tag operator""_in(char const* str, std::size_t);
bool operator==(product_query const& a, product_query const& b);
bool operator!=(product_query const& a, product_query const& b);
bool operator<(product_query const& a, product_query const& b);
std::ostream& operator<<(std::ostream& os, product_query const& query);

namespace detail {
Expand Down Expand Up @@ -69,4 +68,8 @@ namespace phlex::experimental {
}
}

namespace phlex {
experimental::product_tag operator""_in(char const* str, std::size_t);
}

#endif // PHLEX_CORE_PRODUCT_QUERY_HPP
2 changes: 1 addition & 1 deletion phlex/core/registration_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace phlex::experimental {
});
}

void output_api::when(std::vector<std::string> predicates)
void output_api::experimental_when(std::vector<std::string> predicates)
{
if (!reg_.has_predicates()) {
reg_.set_predicates(std::move(predicates));
Expand Down
11 changes: 7 additions & 4 deletions phlex/core/registration_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
#include <functional>
#include <memory>

namespace phlex::experimental {
namespace phlex {
class configuration;
}

namespace phlex::experimental {

// ====================================================================================
// Registration API
Expand Down Expand Up @@ -310,11 +313,11 @@ namespace phlex::experimental {
detail::output_function_t&& f,
concurrency c);

void when(std::vector<std::string> predicates);
void experimental_when(std::vector<std::string> predicates);

void when(std::convertible_to<std::string> auto&&... names)
void experimental_when(std::convertible_to<std::string> auto&&... names)
{
when({std::forward<decltype(names)>(names)...});
experimental_when({std::forward<decltype(names)>(names)...});
}

private:
Expand Down
6 changes: 3 additions & 3 deletions phlex/core/upstream_predicates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ namespace phlex::experimental {
registrar_.set_predicates(detail::maybe_predicates(config));
}

auto& when(std::vector<std::string> predicates)
auto& experimental_when(std::vector<std::string> predicates)
{
if (!registrar_.has_predicates()) {
registrar_.set_predicates(std::move(predicates));
}
return *this;
}

auto& when(std::convertible_to<std::string> auto&&... names)
auto& experimental_when(std::convertible_to<std::string> auto&&... names)
{
return when({std::forward<decltype(names)>(names)...});
return experimental_when({std::forward<decltype(names)>(names)...});
}

template <std::size_t M>
Expand Down
6 changes: 2 additions & 4 deletions phlex/detail/plugin_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
#define PHLEX_DETAIL_NARGS(...) BOOST_PP_DEC(BOOST_PP_VARIADIC_SIZE(__VA_OPT__(, ) __VA_ARGS__))

#define PHLEX_DETAIL_CREATE_1ARG(token_type, func_name, m) \
void func_name(token_type<phlex::experimental::void_tag>& m, \
phlex::experimental::configuration const&)
void func_name(token_type<phlex::experimental::void_tag>& m, phlex::configuration const&)

#define PHLEX_DETAIL_CREATE_2ARGS(token_type, func_name, m, pset) \
void func_name(token_type<phlex::experimental::void_tag>& m, \
phlex::experimental::configuration const& config)
void func_name(token_type<phlex::experimental::void_tag>& m, phlex::configuration const& config)

#define PHLEX_DETAIL_SELECT_SIGNATURE(token_type, func_name, ...) \
BOOST_PP_IF(BOOST_PP_EQUAL(PHLEX_DETAIL_NARGS(__VA_ARGS__), 1), \
Expand Down
31 changes: 3 additions & 28 deletions phlex/model/data_cell_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using namespace std::string_literals;

namespace {

std::vector<std::size_t> all_numbers(phlex::experimental::data_cell_index const& id)
std::vector<std::size_t> all_numbers(phlex::data_cell_index const& id)
{
if (!id.has_parent()) {
return {};
Expand All @@ -34,7 +34,7 @@ namespace {

}

namespace phlex::experimental {
namespace phlex {

data_cell_index::data_cell_index() :
layer_name_{"job"}, layer_hash_{phlex::experimental::hash(layer_name_)}
Expand All @@ -57,7 +57,7 @@ namespace phlex::experimental {
data_cell_index const& data_cell_index::base() { return *base_ptr(); }
data_cell_index_ptr data_cell_index::base_ptr()
{
static phlex::experimental::data_cell_index_ptr base_id{new data_cell_index};
static data_cell_index_ptr base_id{new data_cell_index};
return base_id;
}

Expand Down Expand Up @@ -108,31 +108,6 @@ namespace phlex::experimental {
begin(these_numbers), end(these_numbers), begin(those_numbers), end(those_numbers));
}

data_cell_index_ptr id_for(std::vector<std::size_t> nums)
{
auto current = data_cell_index::base_ptr();
for (auto const num : nums) {
current = current->make_child(num, "");
}
return current;
}

data_cell_index_ptr id_for(char const* c_str)
{
std::vector<std::string> strs;
split(strs, c_str, boost::is_any_of(":"));

erase_if(strs, [](auto& str) { return empty(str); });

std::vector<std::size_t> nums;
std::transform(begin(strs), end(strs), back_inserter(nums), [](auto const& str) {
return std::stoull(str);
});
return id_for(std::move(nums));
}

data_cell_index_ptr operator""_id(char const* c_str, std::size_t) { return id_for(c_str); }

data_cell_index_ptr data_cell_index::parent() const noexcept { return parent_; }

data_cell_index_ptr data_cell_index::parent(std::string const& layer_name) const
Expand Down
Loading
Loading