123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- #ifndef _FASTDDS_RTPS_READER_RTPSREADER_H_
- #define _FASTDDS_RTPS_READER_RTPSREADER_H_
- #include <fastdds/rtps/Endpoint.h>
- #include <fastdds/rtps/attributes/ReaderAttributes.h>
- #include <fastdds/rtps/common/SequenceNumber.h>
- #include <fastrtps/qos/LivelinessChangedStatus.h>
- #include <fastdds/rtps/common/Time_t.h>
- #include <fastdds/rtps/builtin/data/WriterProxyData.h>
- #include <fastrtps/utils/TimedConditionVariable.hpp>
- #include "../history/ReaderHistory.h"
- namespace eprosima {
- namespace fastrtps {
- namespace rtps {
- class LivelinessManager;
- class ReaderListener;
- class WriterProxy;
- struct CacheChange_t;
- struct ReaderHistoryState;
- class WriterProxyData;
- class RTPSReader : public Endpoint
- {
- friend class ReaderHistory;
- friend class RTPSParticipantImpl;
- friend class MessageReceiver;
- friend class EDP;
- friend class WLP;
- protected:
- RTPSReader(
- RTPSParticipantImpl*,
- const GUID_t& guid,
- const ReaderAttributes& att,
- ReaderHistory* hist,
- ReaderListener* listen = nullptr);
- virtual ~RTPSReader();
- public:
-
- RTPS_DllAPI virtual bool matched_writer_add(
- const WriterProxyData& wdata) = 0;
-
- RTPS_DllAPI virtual bool matched_writer_remove(
- const GUID_t& writer_guid) = 0;
-
- RTPS_DllAPI virtual bool matched_writer_is_matched(
- const GUID_t& writer_guid) = 0;
-
- RTPS_DllAPI virtual bool processDataMsg(
- CacheChange_t* change) = 0;
-
- RTPS_DllAPI virtual bool processDataFragMsg(
- CacheChange_t* change,
- uint32_t sampleSize,
- uint32_t fragmentStartingNum,
- uint16_t fragmentsInSubmessage) = 0;
-
- RTPS_DllAPI virtual bool processHeartbeatMsg(
- const GUID_t& writerGUID,
- uint32_t hbCount,
- const SequenceNumber_t& firstSN,
- const SequenceNumber_t& lastSN,
- bool finalFlag,
- bool livelinessFlag) = 0;
-
- RTPS_DllAPI virtual bool processGapMsg(
- const GUID_t& writerGUID,
- const SequenceNumber_t& gapStart,
- const SequenceNumberSet_t& gapList) = 0;
-
- RTPS_DllAPI virtual bool change_removed_by_history(
- CacheChange_t* change,
- WriterProxy* prox = nullptr) = 0;
-
- RTPS_DllAPI ReaderListener* getListener() const;
-
- RTPS_DllAPI bool setListener(
- ReaderListener* target);
-
- RTPS_DllAPI bool reserveCache(
- CacheChange_t** change,
- uint32_t dataCdrSerializedSize);
-
- RTPS_DllAPI void releaseCache(
- CacheChange_t* change);
-
- RTPS_DllAPI virtual bool nextUnreadCache(
- CacheChange_t** change,
- WriterProxy** wp) = 0;
-
- RTPS_DllAPI virtual bool nextUntakenCache(
- CacheChange_t** change,
- WriterProxy** wp) = 0;
- RTPS_DllAPI bool wait_for_unread_cache(
- const eprosima::fastrtps::Duration_t& timeout);
- RTPS_DllAPI uint64_t get_unread_count() const;
-
- RTPS_DllAPI inline bool expectsInlineQos()
- {
- return m_expectsInlineQos;
- }
-
- RTPS_DllAPI inline ReaderHistory* getHistory()
- {
- return mp_history;
- }
-
- virtual bool isInCleanState() = 0;
-
- LivelinessChangedStatus liveliness_changed_status_;
- inline void enableMessagesFromUnkownWriters(
- bool enable)
- {
- m_acceptMessagesFromUnkownWriters = enable;
- }
- void setTrustedWriter(
- const EntityId_t& writer)
- {
- m_acceptMessagesFromUnkownWriters = false;
- m_trustedWriterEntityId = writer;
- }
- protected:
-
- void add_persistence_guid(
- const GUID_t& guid,
- const GUID_t& persistence_guid);
-
- void remove_persistence_guid(
- const GUID_t& guid,
- const GUID_t& persistence_guid);
-
- SequenceNumber_t get_last_notified(
- const GUID_t& guid);
-
- SequenceNumber_t update_last_notified(
- const GUID_t& guid,
- const SequenceNumber_t& seq);
-
- virtual void set_last_notified(
- const GUID_t& persistence_guid,
- const SequenceNumber_t& seq);
-
- History::const_iterator findCacheInFragmentedProcess(
- const SequenceNumber_t& sequence_number,
- const GUID_t& writer_guid,
- CacheChange_t** change,
- History::const_iterator hint) const;
-
- ReaderHistory* mp_history;
-
- ReaderListener* mp_listener;
-
- bool m_acceptMessagesToUnknownReaders;
-
- bool m_acceptMessagesFromUnkownWriters;
-
- EntityId_t m_trustedWriterEntityId;
-
- bool m_expectsInlineQos;
-
- ReaderHistoryState* history_state_;
- uint64_t total_unread_ = 0;
- TimedConditionVariable new_notification_cv_;
-
- LivelinessQosPolicyKind liveliness_kind_;
-
- Duration_t liveliness_lease_duration_;
- private:
- RTPSReader& operator =(
- const RTPSReader&) = delete;
- };
- }
- }
- }
- #endif
|