Class Subscriber, contains the public API that allows the user to control the reception of messages.
More...
#include <Subscriber.h>
Class Subscriber, contains the public API that allows the user to control the reception of messages.
This class should not be instantiated directly. DomainRTPSParticipant class should be used to correctly create this element.
using namespace eprosima::pubsub;
using namespace eprosima::rtps;
Rparam.historyMaxSize = 15;
Rparam.reliability.reliabilityKind = RELIABLE;
Locator_t loc;
loc.port = 10046;
Subscriber* sub = DomainRTPSParticipant::createSubscriber(p, Rparam);
Class SubscriberAttributes, used by the user to define the attributes of a Subscriber.
Definition SubscriberAttributes.h:39
rtps::LocatorList_t unicastLocatorList
Unicast locator list.
Definition SubscriberAttributes.h:52
TopicAttributes topic
Topic Attributes.
Definition SubscriberAttributes.h:43
Class Subscriber, contains the public API that allows the user to control the reception of messages.
Definition Subscriber.h:44
string_255 topicName
Topic Name.
Definition TopicAttributes.h:101
string_255 topicDataType
Topic Data Type.
Definition TopicAttributes.h:103
◆ Subscriber()
Constructor from a SubscriberImpl pointer.
- Parameters
-
pimpl | Actual implementation of the subscriber |
◆ get_first_untaken_info()
Returns information about the first untaken sample.
- Parameters
-
[out] | info | Pointer to a SampleInfo_t structure to store first untaken sample information. |
- Returns
- true if sample info was returned. false if there is no sample to take.
◆ get_listening_locators()
void get_listening_locators |
( |
rtps::LocatorList_t & |
locators | ) |
const |
Get the list of locators on which this subscriber is listening.
- Parameters
-
[out] | locators | LocatorList_t where the list of locators will be stored. |
◆ get_liveliness_changed_status()
Returns the liveliness changed status.
- Parameters
-
status | Liveliness changed status |
◆ get_requested_deadline_missed_status()
Get the requested deadline missed status.
- Parameters
-
status | The deadline missed status |
◆ get_unread_count()
uint64_t get_unread_count |
( |
| ) |
const |
Get the unread count.
- Returns
- Unread count
◆ getAttributes()
Get the Attributes of the Subscriber.
- Returns
- Attributes of the subscriber
◆ getGuid()
const rtps::GUID_t & getGuid |
( |
| ) |
|
Get the associated GUID.
- Returns
- Associated GUID
◆ getUnreadCount()
uint64_t getUnreadCount |
( |
| ) |
const |
|
inline |
Get the unread count.
- Returns
- Unread count
◆ isInCleanState()
bool isInCleanState |
( |
| ) |
const |
Returns there is a clean state with all Publishers.
It occurs when the Subscriber received all samples sent by Publishers. In other words, its WriterProxies are up to date.
- Returns
- There is a clean state with all Publishers.
◆ readNextData()
Reads next unread sample from the Subscriber.
- Parameters
-
sample | Pointer to the object where you want the sample stored. |
info | Pointer to a SampleInfo_t structure that informs you about your sample. |
- Returns
- True if a sample was read.
- Note
- This method is blocked for a period of time. ReliabilityQosPolicy.max_blocking_time on SubscriberAttributes defines this period of time.
◆ takeNextData()
Takes next sample from the Subscriber.
The sample is removed from the subscriber.
- Parameters
-
sample | Pointer to the object where you want the sample stored. |
info | Pointer to a SampleInfo_t structure that informs you about your sample. |
- Returns
- True if a sample was taken.
- Note
- This method is blocked for a period of time. ReliabilityQosPolicy.max_blocking_time on SubscriberAttributes defines this period of time.
◆ updateAttributes()
Update the Attributes of the subscriber;.
- Parameters
-
- Returns
- True if correctly updated, false if ANY of the updated parameters cannot be updated
◆ wait_for_unread_samples()
bool wait_for_unread_samples |
( |
const Duration_t & |
timeout | ) |
|
Blocks the current thread until an unread sample is available.
- Parameters
-
timeout | Maximum time the function will be blocked if any sample is received. |
- Returns
- true in case unread samples are available. In other case, false.
◆ waitForUnreadMessage()
void waitForUnreadMessage |
( |
| ) |
|
|
inline |
Method to block the current thread until an unread message is available.
◆ SubscriberImpl
friend class SubscriberImpl |
|
friend |
The documentation for this class was generated from the following file: