18 #ifndef IOX_POSH_POPO_BASE_SUBSCRIBER_HPP
19 #define IOX_POSH_POPO_BASE_SUBSCRIBER_HPP
21 #include "iceoryx_posh/internal/popo/ports/subscriber_port_user.hpp"
22 #include "iceoryx_posh/popo/enum_trigger_type.hpp"
23 #include "iceoryx_posh/popo/sample.hpp"
24 #include "iceoryx_posh/popo/subscriber_options.hpp"
25 #include "iceoryx_posh/popo/wait_set.hpp"
26 #include "iceoryx_posh/runtime/posh_runtime.hpp"
27 #include "iceoryx_utils/cxx/expected.hpp"
28 #include "iceoryx_utils/cxx/optional.hpp"
29 #include "iceoryx_utils/cxx/unique_ptr.hpp"
35 using uid_t = UniquePortId;
37 enum class SubscriberEvent : EventEnumIdentifier
42 enum class SubscriberState : StateEnumIdentifier
49 template <
typename port_t = iox::SubscriberPortUserType>
107 using PortType = port_t;
119 cxx::expected<const mepoo::ChunkHeader*, ChunkReceiveResult>
takeChunk() noexcept;
121 void invalidateTrigger(const uint64_t trigger) noexcept;
131 WaitSetIsConditionSatisfiedCallback
136 void disableState(const SubscriberState subscriberState) noexcept;
145 void disableEvent(const SubscriberEvent subscriberEvent) noexcept;
150 const port_t&
port() const noexcept;
155 port_t&
port() noexcept;
158 port_t m_port{
nullptr};
165 #include "iceoryx_posh/internal/popo/base_subscriber.inl"
class for the identification of a communication event including information on the service,...
Definition: service_description.hpp:86
base class for all types of subscriber
Definition: base_subscriber.hpp:51
WaitSetIsConditionSatisfiedCallback getCallbackForIsStateConditionSatisfied(const SubscriberState subscriberState) const noexcept
Only usable by the WaitSet, not for public use. Returns method pointer to the event corresponding has...
Definition: base_subscriber.inl:139
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.
Definition: base_subscriber.inl:111
capro::ServiceDescription getServiceDescription() const noexcept
getServiceDescription Get the service description of the subscriber.
Definition: base_subscriber.inl:53
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.
Definition: base_subscriber.inl:162
void subscribe() noexcept
subscribe Initiate subscription.
Definition: base_subscriber.inl:59
uid_t getUid() const noexcept
uid Get the unique ID of the subscriber.
Definition: base_subscriber.inl:46
const port_t & port() const noexcept
const accessor of the underlying port
Definition: base_subscriber.inl:199
void disableState(const SubscriberState subscriberState) noexcept
Only usable by the WaitSet, not for public use. Resets the internal triggerHandle.
Definition: base_subscriber.inl:150
bool hasData() const noexcept
Check if data is available.
Definition: base_subscriber.inl:77
void unsubscribe() noexcept
unsubscribe Unsubscribes if currently subscribed, otherwise do nothing.
Definition: base_subscriber.inl:71
cxx::expected< const mepoo::ChunkHeader *, ChunkReceiveResult > takeChunk() noexcept
small helper method to unwrap the expected<optional<ChunkHeader*>> from the tryGetChunk method of the...
Definition: base_subscriber.inl:89
void releaseQueuedData() noexcept
Releases any unread queued data.
Definition: base_subscriber.inl:95
void disableEvent(const SubscriberEvent subscriberEvent) noexcept
Only usable by the WaitSet, not for public use. Resets the internal triggerHandle.
Definition: base_subscriber.inl:187
bool hasMissedData() noexcept
Check if data has been missed since the last call of this method.
Definition: base_subscriber.inl:83
SubscribeState getSubscriptionState() const noexcept
getSubscriptionState Get current subscription state.
Definition: base_subscriber.inl:65
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
Definition: service_description.hpp:29
This struct is used to configure the subscriber.
Definition: subscriber_options.hpp:31