Fast RTPS  Version 2.14.1
Fast RTPS
Loading...
Searching...
No Matches
PublisherHistory.h
1// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
20#ifndef PUBLISHERHISTORY_H_
21#define PUBLISHERHISTORY_H_
22#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
23
24#include <chrono>
25#include <mutex>
26
27#include <fastdds/rtps/common/InstanceHandle.h>
28#include <fastdds/rtps/common/Time_t.h>
29#include <fastdds/rtps/history/WriterHistory.h>
30#include <fastdds/rtps/resources/ResourceManagement.h>
31#include <fastrtps/attributes/TopicAttributes.h>
32#include <fastrtps/common/KeyedChanges.h>
33#include <fastrtps/qos/QosPolicies.h>
34
35namespace eprosima {
36namespace fastrtps {
37
43class PublisherHistory : public rtps::WriterHistory
44{
45public:
46
54 const TopicAttributes& topic_att,
55 uint32_t payloadMax,
56 rtps::MemoryManagementPolicy_t mempolicy);
57
59
64
73 const rtps::InstanceHandle_t& instance_handle,
74 std::unique_lock<RecursiveTimedMutex>& lock,
75 const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
76
86 rtps::CacheChange_t* change,
87 rtps::WriteParams& wparams,
88 std::unique_lock<RecursiveTimedMutex>& lock,
89 const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
90
97 size_t* removed);
98
104
111 rtps::CacheChange_t* change);
112
114 rtps::CacheChange_t* a_change) override;
115
117 rtps::CacheChange_t* a_change,
118 const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time) override;
119
121 const rtps::InstanceHandle_t& handle,
122 const rtps::SequenceNumber_t& seq_up_to);
123
131 const rtps::InstanceHandle_t& handle,
132 const std::chrono::steady_clock::time_point& next_deadline_us);
133
141 rtps::InstanceHandle_t& handle,
142 std::chrono::steady_clock::time_point& next_deadline_us);
143
150 const rtps::InstanceHandle_t& handle);
151
160 const rtps::InstanceHandle_t& handle,
161 std::unique_lock<RecursiveTimedMutex>& lock,
162 const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
163
164private:
165
166 typedef std::map<rtps::InstanceHandle_t, KeyedChanges> t_m_Inst_Caches;
167
169 t_m_Inst_Caches keyed_changes_;
171 std::chrono::steady_clock::time_point next_deadline_us_;
173 HistoryQosPolicy history_qos_;
175 ResourceLimitsQosPolicy resource_limited_qos_;
177 TopicAttributes topic_att_;
178
185 bool find_or_add_key(
186 const rtps::InstanceHandle_t& instance_handle,
187 t_m_Inst_Caches::iterator* map_it);
188
196 bool prepare_change(
197 rtps::CacheChange_t* change,
198 std::unique_lock<RecursiveTimedMutex>& lock,
199 const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
200};
201
202} /* namespace fastrtps */
203} /* namespace eprosima */
204
205#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
206#endif // PUBLISHERHISTORY_H_
Class PublisherHistory, implementing a WriterHistory with support for keyed topics and HistoryQOS.
Definition PublisherHistory.h:44
bool remove_change_g(rtps::CacheChange_t *a_change) override
bool removeAllChange(size_t *removed)
Remove all change from the associated history.
bool wait_for_acknowledgement_last_change(const rtps::InstanceHandle_t &handle, std::unique_lock< RecursiveTimedMutex > &lock, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time)
Waits till the last change in the instance history has been acknowledged.
bool remove_instance_changes(const rtps::InstanceHandle_t &handle, const rtps::SequenceNumber_t &seq_up_to)
void rebuild_instances()
Rebuild instances loaded from DB.
bool removeMinChange()
Remove the change with the minimum sequence Number.
bool add_pub_change(rtps::CacheChange_t *change, rtps::WriteParams &wparams, std::unique_lock< RecursiveTimedMutex > &lock, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time)
Add a change comming from the Publisher.
bool get_next_deadline(rtps::InstanceHandle_t &handle, std::chrono::steady_clock::time_point &next_deadline_us)
Returns the deadline for the instance that is next going to 'expire'.
PublisherHistory(const TopicAttributes &topic_att, uint32_t payloadMax, rtps::MemoryManagementPolicy_t mempolicy)
Constructor of the PublisherHistory.
bool is_key_registered(const rtps::InstanceHandle_t &handle)
Checks if the instance's key is registered.
bool remove_change_pub(rtps::CacheChange_t *change)
Remove a change by the publisher History.
bool register_instance(const rtps::InstanceHandle_t &instance_handle, std::unique_lock< RecursiveTimedMutex > &lock, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time)
Tries to reserve resources for the new instance.
bool set_next_deadline(const rtps::InstanceHandle_t &handle, const std::chrono::steady_clock::time_point &next_deadline_us)
Sets the next deadline for the given instance.
bool remove_change_g(rtps::CacheChange_t *a_change, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time) override
Class TopicAttributes, used by the user to define the attributes of the topic associated with a Publi...
Definition TopicAttributes.h:36
fastdds::dds::ResourceLimitsQosPolicy ResourceLimitsQosPolicy
Definition QosPolicies.h:81
fastdds::dds::HistoryQosPolicy HistoryQosPolicy
Definition QosPolicies.h:80
eProsima namespace.
Definition LibrarySettingsAttributes.h:23