#pragma once #include #include #include #include #include #include #include #include #include #include namespace flow { template struct ct_node { using is_subgraph = void; using type_t = decltype(stdx::ct_string_to_type()); using name_t = decltype(stdx::ct_string_to_type()); using func_t = F; constexpr static auto ct_name = Name; constexpr static auto identity = Identity; constexpr static auto condition = Cond{}; constexpr auto operator*() const { if constexpr (Identity == subgraph_identity::REFERENCE) { return ct_node{}; } else { return ct_node{}; } } }; namespace detail { template [[nodiscard]] constexpr auto make_node() { return ct_node{}; } constexpr auto empty_func = []() {}; } // namespace detail template requires(stdx::is_function_object_v and std::is_empty_v) [[nodiscard]] constexpr auto action(F const &) { return detail::make_node<"action", Name, F>(); } template [[nodiscard]] constexpr auto action() { return action(cib::func_decl); } template [[nodiscard]] constexpr auto step() { return action(cib::func_decl); } template [[nodiscard]] constexpr auto milestone() { return detail::make_node<"milestone", Name, decltype(detail::empty_func)>(); } inline namespace literals { template [[nodiscard]] constexpr auto operator""_action() { return action(); } template [[nodiscard]] constexpr auto operator""_step() { return action(); } template [[nodiscard]] constexpr auto operator""_milestone() { return milestone(); } } // namespace literals template constexpr auto make_runtime_conditional(Cond, ct_node) { if constexpr (Identity == subgraph_identity::VALUE) { return ct_node{}; } else { return ct_node{}; } } } // namespace flow