18#ifndef IOX_POSH_POPO_BASE_SUBSCRIBER_HPP
19#define IOX_POSH_POPO_BASE_SUBSCRIBER_HPP
21#include "iceoryx_hoofs/cxx/expected.hpp"
22#include "iceoryx_hoofs/cxx/optional.hpp"
23#include "iceoryx_hoofs/cxx/unique_ptr.hpp"
24#include "iceoryx_posh/internal/popo/ports/subscriber_port_user.hpp"
25#include "iceoryx_posh/popo/enum_trigger_type.hpp"
26#include "iceoryx_posh/popo/sample.hpp"
27#include "iceoryx_posh/popo/subscriber_options.hpp"
28#include "iceoryx_posh/popo/wait_set.hpp"
29#include "iceoryx_posh/runtime/posh_runtime.hpp"
35class ServiceDiscovery;
39using uid_t = UniquePortId;
41enum class SubscriberEvent : EventEnumIdentifier
46enum class SubscriberState : StateEnumIdentifier
54template <
typename port_t = iox::SubscriberPortUserType>
106 friend class iox::runtime::ServiceDiscovery;
113 using PortType = port_t;
125 cxx::expected<const mepoo::ChunkHeader*, ChunkReceiveResult>
takeChunk() noexcept;
127 void invalidateTrigger(const uint64_t trigger) noexcept;
137 WaitSetIsConditionSatisfiedCallback
156 const port_t&
port() const noexcept;
164 port_t m_port{
nullptr};
171#include "iceoryx_posh/internal/popo/base_subscriber.inl"
base class for all types of subscriber
Definition: base_subscriber.hpp:56
WaitSetIsConditionSatisfiedCallback getCallbackForIsStateConditionSatisfied(const SubscriberState subscriberState) const noexcept
Only usable by the WaitSet, not for public use. Returns method pointer to the event corresponding has...
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.
capro::ServiceDescription getServiceDescription() const noexcept
getServiceDescription Get the service description of the subscriber.
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.
void subscribe() noexcept
subscribe Initiate subscription.
uid_t getUid() const noexcept
uid Get the unique ID of the subscriber.
const port_t & port() const noexcept
const accessor of the underlying port
void disableState(const SubscriberState subscriberState) noexcept
Only usable by the WaitSet, not for public use. Resets the internal triggerHandle.
bool hasData() const noexcept
Check if data is available.
void unsubscribe() noexcept
unsubscribe Unsubscribes if currently subscribed, otherwise do nothing.
cxx::expected< const mepoo::ChunkHeader *, ChunkReceiveResult > takeChunk() noexcept
small helper method to unwrap the expected<optional<ChunkHeader*>> from the tryGetChunk method of the...
void releaseQueuedData() noexcept
Releases any unread queued data.
void disableEvent(const SubscriberEvent subscriberEvent) noexcept
Only usable by the WaitSet, not for public use. Resets the internal triggerHandle.
bool hasMissedData() noexcept
Check if data has been missed since the last call of this method.
SubscribeState getSubscriptionState() const noexcept
getSubscriptionState Get current subscription state.
Class which allows accessing private methods to friends of NotificationAttorney. Used for example by ...
Definition: notification_attorney.hpp:33
TriggerHandle is threadsafe without restrictions in a single process. Not qualified for inter process...
Definition: trigger_handle.hpp:38
This struct is used to configure the subscriber.
Definition: subscriber_options.hpp:33