123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- #ifndef SUBSCRIBER_H_
- #define SUBSCRIBER_H_
- #include <fastdds/rtps/common/Guid.h>
- #include <fastdds/rtps/common/Time_t.h>
- #include <fastrtps/attributes/SubscriberAttributes.h>
- #include <fastrtps/qos/DeadlineMissedStatus.h>
- #include <fastrtps/qos/LivelinessChangedStatus.h>
- namespace eprosima {
- namespace fastrtps {
- class SubscriberImpl;
- class SampleInfo_t;
- class RTPS_DllAPI Subscriber
- {
- friend class SubscriberImpl;
- virtual ~Subscriber()
- {
- }
- public:
-
- Subscriber(
- SubscriberImpl* pimpl)
- : mp_impl(pimpl)
- {
- }
-
- const rtps::GUID_t& getGuid();
-
- inline void waitForUnreadMessage()
- {
- const Duration_t one_day{ 24 * 3600, 0 };
- while (!wait_for_unread_samples(one_day))
- {
- }
- }
-
- bool wait_for_unread_samples(
- const Duration_t& timeout);
-
- bool readNextData(
- void* sample,
- SampleInfo_t* info);
-
- bool takeNextData(
- void* sample,
- SampleInfo_t* info);
-
- bool get_first_untaken_info(
- SampleInfo_t* info);
-
- bool updateAttributes(
- const SubscriberAttributes& att);
-
- const SubscriberAttributes& getAttributes() const;
-
- bool isInCleanState() const;
-
- inline uint64_t getUnreadCount() const
- {
- return get_unread_count();
- }
-
- uint64_t get_unread_count() const;
-
- void get_requested_deadline_missed_status(
- RequestedDeadlineMissedStatus& status);
-
- void get_liveliness_changed_status(
- LivelinessChangedStatus& status);
- private:
- SubscriberImpl* mp_impl;
- };
- }
- }
- #endif
|