iox::GatewayGeneric🔗
A reference generic gateway implementation. More...
#include <iceoryx_posh/gateway/gateway_generic.hpp>
Inherits from iox::GatewayBase
Public Functions🔗
Name | |
---|---|
virtual | ~GatewayGeneric() |
GatewayGeneric(const GatewayGeneric & ) | |
GatewayGeneric & | operator=(const GatewayGeneric & ) |
GatewayGeneric(GatewayGeneric && ) | |
GatewayGeneric & | operator=(GatewayGeneric && ) |
void | runMultithreaded() |
void | shutdown() |
virtual void | loadConfiguration(const config::GatewayConfig & config) =0 loadConfiguration Load the provided configuration. |
virtual void | discover(const capro::CaproMessage & msg) =0 discover Process discovery messages coming from iceoryx. |
virtual void | forward(const channel_t & channel) =0 forward Forward data between the two terminals of the channel used by the implementation. |
uint64_t | getNumberOfChannels() const |
Protected Functions🔗
Name | |
---|---|
GatewayGeneric(capro::Interfaces interface, units::Duration discoveryPeriod =1000_ms, units::Duration forwardingPeriod =50_ms) | |
template <typename IceoryxPubSubOptions > cxx::expected< channel_t, GatewayError > |
addChannel(const capro::ServiceDescription & service, const IceoryxPubSubOptions & options) addChannel Creates a channel for the given service and stores a copy of it in an internal collection for later access. |
cxx::optional< channel_t > | findChannel(const capro::ServiceDescription & service) const findChannel Searches for a channel for the given service in the internally stored collection and returns it one exists. |
void | forEachChannel(const cxx::function_ref< void(channel_t &)> f) const forEachChannel Executs the given function for each channel in the internally stored collection. |
cxx::expected< GatewayError > | discardChannel(const capro::ServiceDescription & service) discardChannel Discard the channel for the given service in the internal collection if one exists. |
Additional inherited members🔗
Public Types inherited from iox::GatewayBase
Name | |
---|---|
using capro::CaproMessage | CaproMessage |
Public Functions inherited from iox::GatewayBase
Name | |
---|---|
GatewayBase(const capro::Interfaces f_interface) Constructor for creating generic gateway based on type of interface. |
|
GatewayBase(const GatewayBase & other) | |
GatewayBase(GatewayBase && other) =default | |
virtual | ~GatewayBase() |
bool | getCaProMessage(CaproMessage & msg) Get function for type of capro message - service or event or field. |
Protected Functions inherited from iox::GatewayBase
Name | |
---|---|
GatewayBase() =default | |
capro::Interfaces | getInterface() const |
Protected Attributes inherited from iox::GatewayBase
Name | |
---|---|
popo::InterfacePort | m_interfaceImpl |
Detailed Description🔗
template <typename channel_t ,
typename gateway_t =GatewayBase>
class iox::gw::GatewayGeneric;
A reference generic gateway implementation.
This class can be extended to quickly implement any type of gateway, only custom initialization, configuration, discovery and forwarding logic needs to be provided.
When run, the gateway will automatically call the respective methods when required.
Public Functions Documentation🔗
function ~GatewayGeneric🔗
virtual ~GatewayGeneric()
function GatewayGeneric🔗
GatewayGeneric(
const GatewayGeneric &
)
function operator=🔗
GatewayGeneric & operator=(
const GatewayGeneric &
)
function GatewayGeneric🔗
GatewayGeneric(
GatewayGeneric &&
)
function operator=🔗
GatewayGeneric & operator=(
GatewayGeneric &&
)
function runMultithreaded🔗
void runMultithreaded()
function shutdown🔗
void shutdown()
function loadConfiguration🔗
virtual void loadConfiguration(
const config::GatewayConfig & config
) =0
loadConfiguration Load the provided configuration.
Parameters:
- config A generic gateway implementation.
function discover🔗
virtual void discover(
const capro::CaproMessage & msg
) =0
discover Process discovery messages coming from iceoryx.
Parameters:
- msg The discovery message.
function forward🔗
virtual void forward(
const channel_t & channel
) =0
forward Forward data between the two terminals of the channel used by the implementation.
Parameters:
- channel The channel to propogate data across.
function getNumberOfChannels🔗
uint64_t getNumberOfChannels() const
Protected Functions Documentation🔗
function GatewayGeneric🔗
GatewayGeneric(
capro::Interfaces interface,
units::Duration discoveryPeriod =1000_ms,
units::Duration forwardingPeriod =50_ms
)
function addChannel🔗
template <typename IceoryxPubSubOptions >
cxx::expected< channel_t, GatewayError > addChannel(
const capro::ServiceDescription & service,
const IceoryxPubSubOptions & options
)
addChannel Creates a channel for the given service and stores a copy of it in an internal collection for later access.
Parameters:
- service The service to create a channel for.
- options The PublisherOptions or SubscriberOptions with historyCapacity and queueCapacity.
Return: an expected containing a copy of the added channel, otherwise an error
Note:
- Wildcard services are not allowed and will be ignored.
- Channels are supposed to be lightweight, consisting only of pointers to the terminals and a copy of the service description, therefore a copy is provided to any entity that requires them. When no more copies of a channel exists in the system, the terminals will automatically be cleaned up via the custom deleters included in their pointers.
The service description is perhaps too large for copying since they contain strings, however this should be addressed with a service description repository feature.
function findChannel🔗
cxx::optional< channel_t > findChannel(
const capro::ServiceDescription & service
) const
findChannel Searches for a channel for the given service in the internally stored collection and returns it one exists.
Parameters:
- service The service to find a channel for.
Return: An optional containining the matching channel if one exists, otherwise an empty optional.
function forEachChannel🔗
void forEachChannel(
const cxx::function_ref< void(channel_t &)> f
) const
forEachChannel Executs the given function for each channel in the internally stored collection.
Parameters:
- f The function to execute.
Note: This operation allows thread-safe access to the internal collection.
function discardChannel🔗
cxx::expected< GatewayError > discardChannel(
const capro::ServiceDescription & service
)
discardChannel Discard the channel for the given service in the internal collection if one exists.
Parameters:
- service The service whose channels hiould be discarded.
Return: an empty expected on success, otherwise an error
Updated on 18 December 2023 at 13:02:35 CET