123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- #ifndef SUBSCRIBERHISTORY_H_
- #define SUBSCRIBERHISTORY_H_
- #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
- #include <fastdds/dds/topic/TopicDataType.hpp>
- #include <fastdds/rtps/resources/ResourceManagement.h>
- #include <fastrtps/qos/ReaderQos.h>
- #include <fastdds/rtps/history/ReaderHistory.h>
- #include <fastrtps/qos/QosPolicies.h>
- #include <fastrtps/common/KeyedChanges.h>
- #include <fastrtps/subscriber/SampleInfo.h>
- #include <fastrtps/attributes/TopicAttributes.h>
- #include <chrono>
- #include <functional>
- namespace eprosima {
- namespace fastrtps {
- class SubscriberHistory : public rtps::ReaderHistory
- {
- public:
-
- SubscriberHistory(
- const TopicAttributes& topic_att,
- fastdds::dds::TopicDataType* type,
- const fastrtps::ReaderQos& qos,
- uint32_t payloadMax,
- rtps::MemoryManagementPolicy_t mempolicy);
- virtual ~SubscriberHistory();
-
- bool received_change(
- rtps::CacheChange_t* change,
- size_t unknown_missing_changes_up_to);
-
-
- bool readNextData(
- void* data,
- SampleInfo_t* info,
- std::chrono::steady_clock::time_point& max_blocking_time);
- bool takeNextData(
- void* data,
- SampleInfo_t* info,
- std::chrono::steady_clock::time_point& max_blocking_time);
-
-
- bool get_first_untaken_info(
- SampleInfo_t* info);
-
- bool remove_change_sub(
- rtps::CacheChange_t* change);
-
- bool set_next_deadline(
- const rtps::InstanceHandle_t& handle,
- const std::chrono::steady_clock::time_point& next_deadline_us);
-
- bool get_next_deadline(
- rtps::InstanceHandle_t& handle,
- std::chrono::steady_clock::time_point& next_deadline_us);
- private:
- using t_m_Inst_Caches = std::map<rtps::InstanceHandle_t, KeyedChanges>;
-
- t_m_Inst_Caches keyed_changes_;
-
- std::chrono::steady_clock::time_point next_deadline_us_;
-
- HistoryQosPolicy history_qos_;
-
- ResourceLimitsQosPolicy resource_limited_qos_;
-
- TopicAttributes topic_att_;
-
- fastdds::dds::TopicDataType* type_;
-
- fastrtps::ReaderQos qos_;
-
- void* get_key_object_;
-
- std::function<bool(rtps::CacheChange_t*, size_t)> receive_fn_;
-
- bool find_key(
- rtps::CacheChange_t* a_change,
- t_m_Inst_Caches::iterator* map_it);
-
- bool find_key_for_change(
- rtps::CacheChange_t* a_change,
- t_m_Inst_Caches::iterator& map_it);
-
-
- bool received_change_keep_all_no_key(
- rtps::CacheChange_t* change,
- size_t unknown_missing_changes_up_to);
- bool received_change_keep_last_no_key(
- rtps::CacheChange_t* change,
- size_t unknown_missing_changes_up_to);
- bool received_change_keep_all_with_key(
- rtps::CacheChange_t* change,
- size_t unknown_missing_changes_up_to);
- bool received_change_keep_last_with_key(
- rtps::CacheChange_t* change,
- size_t unknown_missing_changes_up_to);
-
- bool add_received_change(
- rtps::CacheChange_t* a_change);
- bool add_received_change_with_key(
- rtps::CacheChange_t* a_change,
- std::vector<rtps::CacheChange_t*>& instance_changes);
- bool deserialize_change(
- rtps::CacheChange_t* change,
- uint32_t ownership_strength,
- void* data,
- SampleInfo_t* info);
- };
- }
- }
- #endif
- #endif
|