Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
Signed-off-by: Ralph J. Steinhagen <[email protected]>
  • Loading branch information
RalphSteinhagen committed Sep 15, 2023
1 parent 0c825f0 commit a8d7c24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/port.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ using namespace fair::literals;
using supported_type = std::variant<uint8_t, uint32_t, int8_t, int16_t, int32_t, float, double, std::complex<float>, std::complex<double>, DataSet<double>, DataSet<float> /*, ...*/>;

enum class port_direction_t { INPUT, OUTPUT, ANY }; // 'ANY' only for query and not to be used for port declarations

template<typename... Args>
constexpr port_direction_t
find_port_direction(fair::meta::typelist<Args...>, port_direction_t default_value = port_direction_t::ANY) {
if constexpr ((... || fair::meta::is_any_of_v<Args, port_direction_t>) ) {
return (... ? (air::meta::is_any_of_v<Args, port_direction_t> ? static_cast<port_direction_t>(Args::value) : default_value) : default_value);
} else {
return default_value;
}
}

enum class connection_result_t { SUCCESS, FAILED };
enum class port_type_t {
STREAM, /*!< used for single-producer-only ond usually synchronous one-to-one or one-to-many communications */
Expand Down
3 changes: 3 additions & 0 deletions include/typelist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ struct typelist {
}())>;
};

template<typename T, typename... Ts>
constexpr bool is_any_of_v = std::disjunction_v<std::is_same<T, Ts>...>;

namespace detail {
template<template<typename...> typename OtherTypelist, typename... Args>
meta::typelist<Args...>
Expand Down

0 comments on commit a8d7c24

Please sign in to comment.