.. _program_listing_file__tmp_ws_src_fastrtps_include_fastdds_rtps_history_History.h: Program Listing for File History.h ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/fastrtps/include/fastdds/rtps/history/History.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // 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 _FASTDDS_RTPS_HISTORY_H_ #define _FASTDDS_RTPS_HISTORY_H_ #include #include #include #include #include #include #include #include #include #include #include namespace eprosima { namespace fastrtps { namespace rtps { class History { protected: History( const HistoryAttributes& att); History( History&&) = delete; History& operator =( History&&) = delete; virtual ~History(); public: using iterator = std::vector::iterator; using reverse_iterator = std::vector::reverse_iterator; using const_iterator = std::vector::const_iterator; HistoryAttributes m_att; FASTRTPS_DEPRECATED("Use new_change on RTPSWriter or reserveCache on RTPSReader") RTPS_DllAPI inline bool reserve_Cache( CacheChange_t** change, const std::function& calculateSizeFunc) { return do_reserve_cache(change, calculateSizeFunc()); } FASTRTPS_DEPRECATED("Use new_change on RTPSWriter or reserveCache on RTPSReader") RTPS_DllAPI inline bool reserve_Cache( CacheChange_t** change, uint32_t dataSize) { return do_reserve_cache(change, dataSize); } FASTRTPS_DEPRECATED("Use release_change on RTPSWriter or releaseCache on RTPSReader") RTPS_DllAPI inline void release_Cache( CacheChange_t* ch) { do_release_cache(ch); } RTPS_DllAPI bool isFull() { return m_isHistoryFull; } RTPS_DllAPI size_t getHistorySize() { std::lock_guard guard(*mp_mutex); return m_changes.size(); } RTPS_DllAPI const_iterator find_change_nts( CacheChange_t* ch); RTPS_DllAPI virtual iterator remove_change_nts( const_iterator removal, bool release = true); RTPS_DllAPI bool remove_all_changes(); RTPS_DllAPI bool remove_change( CacheChange_t* ch); RTPS_DllAPI const_iterator find_change( CacheChange_t* ch) { std::lock_guard guard(*mp_mutex); return find_change_nts(ch); } RTPS_DllAPI virtual bool matches_change( const CacheChange_t* ch_inner, CacheChange_t* ch_outer); RTPS_DllAPI iterator remove_change( const_iterator removal, bool release = true) { std::lock_guard guard(*mp_mutex); return remove_change_nts(removal, release); } RTPS_DllAPI iterator changesBegin() { return m_changes.begin(); } RTPS_DllAPI reverse_iterator changesRbegin() { return m_changes.rbegin(); } RTPS_DllAPI iterator changesEnd() { return m_changes.end(); } RTPS_DllAPI reverse_iterator changesRend() { return m_changes.rend(); } RTPS_DllAPI bool get_min_change( CacheChange_t** min_change); RTPS_DllAPI bool get_max_change( CacheChange_t** max_change); RTPS_DllAPI inline uint32_t getTypeMaxSerialized() { return m_att.payloadMaxSize; } RTPS_DllAPI inline RecursiveTimedMutex* getMutex() const { assert(mp_mutex != nullptr); return mp_mutex; } RTPS_DllAPI bool get_change( const SequenceNumber_t& seq, const GUID_t& guid, CacheChange_t** change) const; const_iterator get_change_nts( const SequenceNumber_t& seq, const GUID_t& guid, CacheChange_t** change, const_iterator hint) const; bool get_earliest_change( CacheChange_t** change); protected: std::vector m_changes; bool m_isHistoryFull = false; RecursiveTimedMutex* mp_mutex = nullptr; void print_changes_seqNum2(); RTPS_DllAPI virtual bool do_reserve_cache( CacheChange_t** change, uint32_t size) = 0; RTPS_DllAPI virtual void do_release_cache( CacheChange_t* ch) = 0; }; } // namespace rtps } // namespace fastrtps } // namespace eprosima #endif /* _FASTDDS_RTPS_HISTORY_H_ */