iceoryx_posh 2.0.5
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
iox::gw::GatewayGeneric< channel_t, gateway_t > Class Template Referenceabstract

A reference generic gateway implementation. More...

#include <iceoryx_posh/gateway/gateway_generic.hpp>

Inheritance diagram for iox::gw::GatewayGeneric< channel_t, gateway_t >:
Inheritance graph
[legend]
Collaboration diagram for iox::gw::GatewayGeneric< channel_t, gateway_t >:
Collaboration graph
[legend]

Public Member Functions

 GatewayGeneric (const GatewayGeneric &)=delete
 
GatewayGenericoperator= (const GatewayGeneric &)=delete
 
 GatewayGeneric (GatewayGeneric &&)=delete
 
GatewayGenericoperator= (GatewayGeneric &&)=delete
 
void runMultithreaded () noexcept
 
void shutdown () noexcept
 
virtual void loadConfiguration (const config::GatewayConfig &config) noexcept=0
 loadConfiguration Load the provided configuration.
 
virtual void discover (const capro::CaproMessage &msg) noexcept=0
 discover Process discovery messages coming from iceoryx.
 
virtual void forward (const channel_t &channel) noexcept=0
 forward Forward data between the two terminals of the channel used by the implementation.
 
uint64_t getNumberOfChannels () const noexcept
 
- Public Member Functions inherited from iox::gw::GatewayBase
 GatewayBase (const capro::Interfaces f_interface) noexcept
 Constructor for creating generic gateway based on type of interface.
 
GatewayBaseoperator= (const GatewayBase &other)=delete
 
 GatewayBase (const GatewayBase &other)=delete
 
 GatewayBase (GatewayBase &&other) noexcept=default
 
GatewayBaseoperator= (GatewayBase &&) noexcept=default
 
bool getCaProMessage (CaproMessage &msg) noexcept
 Get function for type of capro message - service or event or field.
 

Protected Member Functions

 GatewayGeneric (capro::Interfaces interface, units::Duration discoveryPeriod=1000_ms, units::Duration forwardingPeriod=50_ms) noexcept
 
template<typename IceoryxPubSubOptions >
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 for later access.
 
cxx::optional< channel_t > findChannel (const capro::ServiceDescription &service) const noexcept
 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 noexcept
 forEachChannel Executs the given function for each channel in the internally stored collection.
 
cxx::expected< GatewayError > discardChannel (const capro::ServiceDescription &service) noexcept
 discardChannel Discard the channel for the given service in the internal collection if one exists.
 
- Protected Member Functions inherited from iox::gw::GatewayBase
capro::Interfaces getInterface () const noexcept
 

Additional Inherited Members

- Public Types inherited from iox::gw::GatewayBase
using CaproMessage = capro::CaproMessage
 
- Protected Attributes inherited from iox::gw::GatewayBase
popo::InterfacePort m_interfaceImpl {nullptr}
 

Detailed Description

template<typename channel_t, typename gateway_t = GatewayBase>
class iox::gw::GatewayGeneric< channel_t, gateway_t >

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.

Member Function Documentation

◆ addChannel()

template<typename channel_t , typename gateway_t = GatewayBase>
template<typename IceoryxPubSubOptions >
cxx::expected< channel_t, GatewayError > iox::gw::GatewayGeneric< channel_t, gateway_t >::addChannel ( const capro::ServiceDescription service,
const IceoryxPubSubOptions &  options 
)
protectednoexcept

addChannel Creates a channel for the given service and stores a copy of it in an internal collection for later access.

Parameters
serviceThe service to create a channel for.
optionsThe PublisherOptions or SubscriberOptions with historyCapacity and queueCapacity.
Returns
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.

◆ discardChannel()

template<typename channel_t , typename gateway_t = GatewayBase>
cxx::expected< GatewayError > iox::gw::GatewayGeneric< channel_t, gateway_t >::discardChannel ( const capro::ServiceDescription service)
protectednoexcept

discardChannel Discard the channel for the given service in the internal collection if one exists.

Parameters
serviceThe service whose channels hiould be discarded.
Returns
an empty expected on success, otherwise an error

◆ discover()

template<typename channel_t , typename gateway_t = GatewayBase>
virtual void iox::gw::GatewayGeneric< channel_t, gateway_t >::discover ( const capro::CaproMessage &  msg)
pure virtualnoexcept

discover Process discovery messages coming from iceoryx.

Parameters
msgThe discovery message.

◆ findChannel()

template<typename channel_t , typename gateway_t = GatewayBase>
cxx::optional< channel_t > iox::gw::GatewayGeneric< channel_t, gateway_t >::findChannel ( const capro::ServiceDescription service) const
protectednoexcept

findChannel Searches for a channel for the given service in the internally stored collection and returns it one exists.

Parameters
serviceThe service to find a channel for.
Returns
An optional containining the matching channel if one exists, otherwise an empty optional.

◆ forEachChannel()

template<typename channel_t , typename gateway_t = GatewayBase>
void iox::gw::GatewayGeneric< channel_t, gateway_t >::forEachChannel ( const cxx::function_ref< void(channel_t &)>  f) const
protectednoexcept

forEachChannel Executs the given function for each channel in the internally stored collection.

Parameters
fThe function to execute.
Note
This operation allows thread-safe access to the internal collection.

◆ forward()

template<typename channel_t , typename gateway_t = GatewayBase>
virtual void iox::gw::GatewayGeneric< channel_t, gateway_t >::forward ( const channel_t &  channel)
pure virtualnoexcept

forward Forward data between the two terminals of the channel used by the implementation.

Parameters
channelThe channel to propogate data across.

◆ loadConfiguration()

template<typename channel_t , typename gateway_t = GatewayBase>
virtual void iox::gw::GatewayGeneric< channel_t, gateway_t >::loadConfiguration ( const config::GatewayConfig config)
pure virtualnoexcept

loadConfiguration Load the provided configuration.

Parameters
configA generic gateway implementation.

The documentation for this class was generated from the following file: