Program Listing for File PublisherHistory.h
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastrtps/publisher/PublisherHistory.h
)
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef PUBLISHERHISTORY_H_
#define PUBLISHERHISTORY_H_
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
#include <chrono>
#include <mutex>
#include <fastdds/rtps/common/InstanceHandle.h>
#include <fastdds/rtps/common/Time_t.h>
#include <fastdds/rtps/history/WriterHistory.h>
#include <fastdds/rtps/resources/ResourceManagement.h>
#include <fastrtps/attributes/TopicAttributes.h>
#include <fastrtps/common/KeyedChanges.h>
#include <fastrtps/qos/QosPolicies.h>
namespace eprosima {
namespace fastrtps {
class PublisherHistory : public rtps::WriterHistory
{
public:
PublisherHistory(
const TopicAttributes& topic_att,
uint32_t payloadMax,
rtps::MemoryManagementPolicy_t mempolicy);
virtual ~PublisherHistory();
void rebuild_instances();
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);
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);
bool removeAllChange(
size_t* removed);
bool removeMinChange();
bool remove_change_pub(
rtps::CacheChange_t* change);
virtual bool remove_change_g(
rtps::CacheChange_t* a_change);
bool remove_instance_changes(
const rtps::InstanceHandle_t& handle,
const rtps::SequenceNumber_t& seq_up_to);
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);
bool is_key_registered(
const rtps::InstanceHandle_t& handle);
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);
private:
typedef std::map<rtps::InstanceHandle_t, KeyedChanges> t_m_Inst_Caches;
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_;
bool find_or_add_key(
const rtps::InstanceHandle_t& instance_handle,
t_m_Inst_Caches::iterator* map_it);
bool prepare_change(
rtps::CacheChange_t* change,
std::unique_lock<RecursiveTimedMutex>& lock,
const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
};
} /* namespace fastrtps */
} /* namespace eprosima */
#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
#endif // PUBLISHERHISTORY_H_