Template Class PortIntrospection
Defined in File port_introspection.hpp
Nested Relationships
Nested Types
Class Documentation
-
template<typename PublisherPort, typename SubscriberPort>
class PortIntrospection 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.
Public Functions
-
PortIntrospection() noexcept
-
~PortIntrospection() noexcept
-
PortIntrospection(PortIntrospection const&) = delete
-
PortIntrospection &operator=(PortIntrospection const&) = delete
-
PortIntrospection(PortIntrospection&&) = delete
-
PortIntrospection &operator=(PortIntrospection&&) = delete
-
bool addPublisher(typename PublisherPort::MemberType_t &port) noexcept
add a publisher port to be tracked by introspection
- Parameters:
port – [in] to be added
- Returns:
returns false if the port could not be added and true otherwise
-
bool addSubscriber(typename SubscriberPort::MemberType_t &port) noexcept
add a subscriber port to be tracked by introspection
- Parameters:
port – [in] to be added
- Returns:
returns false if the port could not be added and true otherwise
-
bool removePublisher(const PublisherPort &port) noexcept
remove a publisher port from introspection
- Parameters:
port – [in] publisher port to be removed
- Returns:
returns false if the port could not be removed (since it did not exist) and true otherwise
-
bool removeSubscriber(const SubscriberPort &port) noexcept
remove a subscriber port from introspection
- Parameters:
port – [in] subscriber port to be removed
- Returns:
returns false if the port could not be removed (since it did not exist) and true otherwise
-
void reportMessage(const capro::CaproMessage &message) noexcept
report a capro message to introspection (since this could change the state of active connections)
- Parameters:
message – [in] capro message to be processed
-
void reportMessage(const capro::CaproMessage &message, const popo::UniquePortId &id) noexcept
report a capro message to introspection (since this could change the state of active connections)
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
- Parameters:
message – [in] capro message to be processed
id – [in] unique port id
-
bool registerPublisherPort(PublisherPort &&publisherPortGeneric, PublisherPort &&publisherPortThroughput, PublisherPort &&publisherPortSubscriberPortsData) noexcept
register publisher port used to send introspection
- Parameters:
publisherPort – [in] publisher port to be registered
- Returns:
true if registration was successful, false otherwise
-
void setSendInterval(const units::Duration interval) noexcept
set the time interval used to send new introspection data
- Parameters:
interval – [in] duration between two send invocations
-
void run() noexcept
start the internal send thread
-
void stop() noexcept
stop the internal send thread
Protected 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
-
PortIntrospection() noexcept