58class GatewayGeneric :
public gateway_t
60 using ChannelVector = cxx::vector<channel_t, MAX_CHANNEL_NUMBER>;
61 using ConcurrentChannelVector = concurrent::smart_lock<ChannelVector>;
64 virtual ~GatewayGeneric()
noexcept;
66 GatewayGeneric(
const GatewayGeneric&) =
delete;
67 GatewayGeneric& operator=(
const GatewayGeneric&) =
delete;
68 GatewayGeneric(GatewayGeneric&&) =
delete;
69 GatewayGeneric& operator=(GatewayGeneric&&) =
delete;
71 void runMultithreaded()
noexcept;
72 void shutdown()
noexcept;
83 virtual void discover(
const capro::CaproMessage& msg)
noexcept = 0;
88 virtual void forward(
const channel_t& channel)
noexcept = 0;
90 uint64_t getNumberOfChannels() const noexcept;
93 GatewayGeneric(capro::Interfaces interface,
94 units::Duration discoveryPeriod = 1000_ms,
95 units::Duration forwardingPeriod = 50_ms) noexcept;
114 template <typename IceoryxPubSubOptions>
115 cxx::expected<channel_t, GatewayError>
addChannel(const capro::ServiceDescription& service,
116 const IceoryxPubSubOptions& options) noexcept;
124 cxx::optional<channel_t>
findChannel(const capro::ServiceDescription& service) const noexcept;
138 cxx::expected<GatewayError>
discardChannel(const capro::ServiceDescription& service) noexcept;
141 ConcurrentChannelVector m_channels;
143 std::atomic_bool m_isRunning{
false};
145 units::Duration m_discoveryPeriod;
146 units::Duration m_forwardingPeriod;
148 std::thread m_discoveryThread;
149 std::thread m_forwardingThread;
151 void forwardingLoop() noexcept;
152 void discoveryLoop() noexcept;
cxx::expected< channel_t, GatewayError > addChannel(const capro::ServiceDescription &service, const IceoryxPubSubOptions &options) noexcept
addChannel Creates a channel for the given service and stores a copy of it in an internal collection ...