Fast RTPS  Version 2.1.0
Fast RTPS
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 <fastdds/rtps/resources/ResourceManagement.h>
25 
26 #include <fastdds/rtps/history/WriterHistory.h>
27 #include <fastrtps/qos/QosPolicies.h>
28 #include <fastrtps/common/KeyedChanges.h>
29 #include <fastrtps/attributes/TopicAttributes.h>
30 
31 namespace eprosima {
32 namespace fastrtps {
33 
39 class PublisherHistory : public rtps::WriterHistory
40 {
41 public:
42 
50  const TopicAttributes& topic_att,
51  uint32_t payloadMax,
52  rtps::MemoryManagementPolicy_t mempolicy);
53 
54  virtual ~PublisherHistory();
55 
60 
69  const rtps::InstanceHandle_t& instance_handle,
70  std::unique_lock<RecursiveTimedMutex>& lock,
71  const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
72 
82  rtps::CacheChange_t* change,
83  rtps::WriteParams& wparams,
84  std::unique_lock<RecursiveTimedMutex>& lock,
85  const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
86 
93  size_t* removed);
94 
100 
107  rtps::CacheChange_t* change);
108 
109  virtual bool remove_change_g(
110  rtps::CacheChange_t* a_change);
111 
113  const rtps::InstanceHandle_t& handle,
114  const rtps::SequenceNumber_t& seq_up_to);
115 
123  const rtps::InstanceHandle_t& handle,
124  const std::chrono::steady_clock::time_point& next_deadline_us);
125 
133  rtps::InstanceHandle_t& handle,
134  std::chrono::steady_clock::time_point& next_deadline_us);
135 
142  const rtps::InstanceHandle_t& handle);
143 
144 private:
145 
146  typedef std::map<rtps::InstanceHandle_t, KeyedChanges> t_m_Inst_Caches;
147 
149  t_m_Inst_Caches keyed_changes_;
151  std::chrono::steady_clock::time_point next_deadline_us_;
153  HistoryQosPolicy history_qos_;
155  ResourceLimitsQosPolicy resource_limited_qos_;
157  TopicAttributes topic_att_;
158 
165  bool find_or_add_key(
166  const rtps::InstanceHandle_t& instance_handle,
167  t_m_Inst_Caches::iterator* map_it);
168 };
169 
170 } /* namespace fastrtps */
171 } /* namespace eprosima */
172 
173 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
174 #endif // PUBLISHERHISTORY_H_
Class PublisherHistory, implementing a WriterHistory with support for keyed topics and HistoryQOS.
Definition: PublisherHistory.h:40
bool removeAllChange(size_t *removed)
Remove all change from the associated history.
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.
virtual bool remove_change_g(rtps::CacheChange_t *a_change)
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.
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