123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- namespace eprosima {
- namespace fastrtps {
- namespace rtps {
- using LivelinessCallback = std::function<void(
- const GUID_t&,
- const LivelinessQosPolicyKind&,
- const Duration_t&,
- int32_t alive_change,
- int32_t not_alive_change)>;
- class LivelinessManager
- {
- public:
-
- LivelinessManager(
- const LivelinessCallback& callback,
- ResourceEvent& service,
- bool manage_automatic = true);
-
- ~LivelinessManager();
-
- LivelinessManager(const LivelinessManager& other) = delete;
-
- bool add_writer(
- GUID_t guid,
- LivelinessQosPolicyKind kind,
- Duration_t lease_duration);
-
- bool remove_writer(
- GUID_t guid,
- LivelinessQosPolicyKind kind,
- Duration_t lease_duration);
-
- bool assert_liveliness(
- GUID_t guid,
- LivelinessQosPolicyKind kind,
- Duration_t lease_duration);
-
- bool assert_liveliness(LivelinessQosPolicyKind kind);
-
- bool is_any_alive(LivelinessQosPolicyKind kind);
-
- const ResourceLimitedVector<LivelinessData> &get_liveliness_data() const;
- private:
-
-
-
- void assert_writer_liveliness(LivelinessData& writer);
-
- bool calculate_next();
-
-
-
-
-
-
- bool find_writer(
- const GUID_t &guid,
- const LivelinessQosPolicyKind &kind,
- const Duration_t &lease_duration,
- ResourceLimitedVector<LivelinessData>::iterator* wit_out);
-
-
- bool timer_expired();
-
- LivelinessCallback callback_;
-
- bool manage_automatic_;
-
- ResourceLimitedVector<LivelinessData> writers_;
-
- std::mutex mutex_;
-
- LivelinessData* timer_owner_;
-
- TimedEvent timer_;
- };
- }
- }
- }
|