Template Class BaseSubscriber

Inheritance Relationships

Derived Types

Class Documentation

template<typename port_t = iox::SubscriberPortUserType>
class BaseSubscriber

base class for all types of subscriber

Note

Not intended for public usage! Use the Subscriber or UntypedSubscriber instead!

Param port_t:

[in] type of the underlying port, required for testing

Subclassed by iox::popo::SubscriberImpl< T, mepoo::NoUserHeader >, iox::popo::SubscriberImpl< T, H, BaseSubscriberType >, iox::popo::UntypedSubscriberImpl< BaseSubscriberType >

Public Functions

virtual ~BaseSubscriber() noexcept
uid_t getUid() const noexcept

uid Get the unique ID of the subscriber.

Returns:

The subscriber’s unique ID.

capro::ServiceDescription getServiceDescription() const noexcept

getServiceDescription Get the service description of the subscriber.

Returns:

The service description.

void subscribe() noexcept

subscribe Initiate subscription.

Returns:

SubscribeState getSubscriptionState() const noexcept

getSubscriptionState Get current subscription state.

Returns:

The current subscription state.

void unsubscribe() noexcept

unsubscribe Unsubscribes if currently subscribed, otherwise do nothing.

bool hasData() const noexcept

Check if data is available.

Returns:

True if data is available.

bool hasMissedData() noexcept

Check if data has been missed since the last call of this method.

Data may be missed due to overflowing receive queue.

Returns:

True if data has been missed.

void releaseQueuedData() noexcept

Releases any unread queued data.

Protected Types

using SelfType = BaseSubscriber<port_t>

Only usable by the WaitSet, not for public use. Invalidates the internal triggerHandle.

Only usable by the WaitSet, not for public use

Param uniqueTriggerId:

[in] the id of the corresponding trigger

using PortType = port_t

Protected Functions

BaseSubscriber() noexcept
BaseSubscriber(const capro::ServiceDescription &service, const SubscriberOptions &subscriberOptions) noexcept
BaseSubscriber(const BaseSubscriber &other) = delete
BaseSubscriber &operator=(const BaseSubscriber&) = delete
BaseSubscriber(BaseSubscriber &&rhs) = delete
BaseSubscriber &operator=(BaseSubscriber &&rhs) = delete
cxx::expected<const mepoo::ChunkHeader*, ChunkReceiveResult> takeChunk() noexcept

small helper method to unwrap the expected<optional<ChunkHeader*>> from the tryGetChunk method of the port

void invalidateTrigger(const uint64_t trigger) noexcept
void enableState(iox::popo::TriggerHandle &&triggerHandle, const SubscriberState subscriberState) noexcept

Only usable by the WaitSet, not for public use. Attaches the triggerHandle to the internal trigger.

Parameters:
  • triggerHandle[in] rvalue reference to the triggerHandle. This class takes the ownership of that handle.

  • subscriberState[in] the state which should be attached

WaitSetIsConditionSatisfiedCallback getCallbackForIsStateConditionSatisfied(const SubscriberState subscriberState) const noexcept

Only usable by the WaitSet, not for public use. Returns method pointer to the event corresponding hasTriggered method callback.

Parameters:

subscriberState[in] the state to which the hasTriggeredCallback is required

void disableState(const SubscriberState subscriberState) noexcept

Only usable by the WaitSet, not for public use. Resets the internal triggerHandle.

Parameters:

subscriberState[in] the state which should be detached

void enableEvent(iox::popo::TriggerHandle &&triggerHandle, const SubscriberEvent subscriberState) noexcept

Only usable by the WaitSet, not for public use. Attaches the triggerHandle to the internal trigger.

Parameters:
  • triggerHandle[in] rvalue reference to the triggerHandle. This class takes the ownership of that handle.

  • subscriberEvent[in] the event which should be attached

void disableEvent(const SubscriberEvent subscriberEvent) noexcept

Only usable by the WaitSet, not for public use. Resets the internal triggerHandle.

Parameters:

subscriberEvent[in] the event which should be detached

const port_t &port() const noexcept

const accessor of the underlying port

port_t &port() noexcept

accessor of the underlying port

Protected Attributes

port_t m_port = {nullptr}
TriggerHandle m_trigger

Friends

friend class NotificationAttorney
friend class iox::runtime::ServiceDiscovery