iceoryx_doc  1.0.1
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iox::roudi::PortIntrospection< PublisherPort, SubscriberPort > Class Template Reference

This class handles the port introspection for RouDi. It is recommended to use the PortIntrospectionType alias which sets the intended template parameter required for the actual introspection. The class manages a thread that periodically updates a field with port introspection data to which clients may subscribe. More...

#include <port_introspection.hpp>

Public Member Functions

 PortIntrospection (PortIntrospection const &)=delete
 
PortIntrospectionoperator= (PortIntrospection const &)=delete
 
 PortIntrospection (PortIntrospection &&)=delete
 
PortIntrospectionoperator= (PortIntrospection &&)=delete
 
bool addPublisher (typename PublisherPort::MemberType_t &port)
 add a publisher port to be tracked by introspection More...
 
bool addSubscriber (typename SubscriberPort::MemberType_t &port)
 add a subscriber port to be tracked by introspection More...
 
bool removePublisher (const PublisherPort &port)
 remove a publisher port from introspection More...
 
bool removeSubscriber (const SubscriberPort &port)
 remove a subscriber port from introspection More...
 
void reportMessage (const capro::CaproMessage &message) noexcept
 report a capro message to introspection (since this could change the state of active connections) More...
 
void reportMessage (const capro::CaproMessage &message, const UniquePortId &id)
 report a capro message to introspection (since this could change the state of active connections) More...
 
bool registerPublisherPort (PublisherPort &&publisherPortGeneric, PublisherPort &&publisherPortThroughput, PublisherPort &&publisherPortSubscriberPortsData) noexcept
 register publisher port used to send introspection More...
 
void setSendInterval (const units::Duration interval) noexcept
 set the time interval used to send new introspection data More...
 
void run () noexcept
 start the internal send thread
 
void stop () noexcept
 stop the internal send thread
 

Protected Member Functions

void sendPortData () noexcept
 sends the port data; this is used from the unittests
 
void sendThroughputData () noexcept
 sends the throughput data; this is used from the unittests
 
void sendSubscriberPortsData () noexcept
 sends the subscriberport changing data, this is used from the unittests
 
void send () noexcept
 calls the three specific send functions from above, this is used from the periodic task
 

Protected Attributes

cxx::optional< PublisherPort > m_publisherPort
 
cxx::optional< PublisherPort > m_publisherPortThroughput
 
cxx::optional< PublisherPort > m_publisherPortSubscriberPortsData
 

Detailed Description

template<typename PublisherPort, typename SubscriberPort>
class iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >

This class handles the port introspection for RouDi. It is recommended to use the PortIntrospectionType alias which sets the intended template parameter required for the actual introspection. The class manages a thread that periodically updates a field with port introspection data to which clients may subscribe.

Member Function Documentation

◆ addPublisher()

template<typename PublisherPort , typename SubscriberPort >
bool iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::addPublisher ( typename PublisherPort::MemberType_t &  port)
inline

add a publisher port to be tracked by introspection

Parameters
[in]portto be added
Returns
returns false if the port could not be added and true otherwise

◆ addSubscriber()

template<typename PublisherPort , typename SubscriberPort >
bool iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::addSubscriber ( typename SubscriberPort::MemberType_t &  port)
inline

add a subscriber port to be tracked by introspection

Parameters
[in]portto be added
Returns
returns false if the port could not be added and true otherwise

◆ registerPublisherPort()

template<typename PublisherPort , typename SubscriberPort >
bool iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::registerPublisherPort ( PublisherPort &&  publisherPortGeneric,
PublisherPort &&  publisherPortThroughput,
PublisherPort &&  publisherPortSubscriberPortsData 
)
inlinenoexcept

register publisher port used to send introspection

Parameters
[in]publisherPortpublisher port to be registered
Returns
true if registration was successful, false otherwise

◆ removePublisher()

template<typename PublisherPort , typename SubscriberPort >
bool iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::removePublisher ( const PublisherPort &  port)
inline

remove a publisher port from introspection

Parameters
[in]portpublisher port to be removed
Returns
returns false if the port could not be removed (since it did not exist) and true otherwise

◆ removeSubscriber()

template<typename PublisherPort , typename SubscriberPort >
bool iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::removeSubscriber ( const SubscriberPort &  port)
inline

remove a subscriber port from introspection

Parameters
[in]portsubscriber port to be removed
Returns
returns false if the port could not be removed (since it did not exist) and true otherwise

◆ reportMessage() [1/2]

template<typename PublisherPort , typename SubscriberPort >
void iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::reportMessage ( const capro::CaproMessage message)
inlinenoexcept

report a capro message to introspection (since this could change the state of active connections)

Parameters
[in]messagecapro message to be processed

◆ reportMessage() [2/2]

template<typename PublisherPort , typename SubscriberPort >
void iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::reportMessage ( const capro::CaproMessage message,
const UniquePortId id 
)
inline

report a capro message to introspection (since this could change the state of active connections)

Parameters
[in]messagecapro message to be processed
[in]idunique port id
Note
introduced for identifying the subscriber port whose connection state has to be updated, e.g. if a subscriber unsubscribes only its connection state should be updated - not the states of all subscribers which are subscribed to the same topic

◆ setSendInterval()

template<typename PublisherPort , typename SubscriberPort >
void iox::roudi::PortIntrospection< PublisherPort, SubscriberPort >::setSendInterval ( const units::Duration  interval)
inlinenoexcept

set the time interval used to send new introspection data

Parameters
[in]intervalduration between two send invocations

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