123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- // 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.
- /**
- * @file WriterHistory.h
- *
- */
- #ifndef _FASTDDS_RTPS_WRITERHISTORY_H_
- #define _FASTDDS_RTPS_WRITERHISTORY_H_
- #include <fastdds/rtps/history/History.h>
- namespace eprosima {
- namespace fastrtps{
- namespace rtps {
- class RTPSWriter;
- class WriteParams;
- /**
- * Class WriterHistory, container of the different CacheChanges of a writer
- * @ingroup WRITER_MODULE
- */
- class WriterHistory : public History
- {
- friend class RTPSWriter;
- friend class PersistentWriter;
- WriterHistory(WriterHistory&&) = delete;
- WriterHistory& operator=(WriterHistory&&) = delete;
- public:
- /**
- * Constructor of the WriterHistory.
- */
- RTPS_DllAPI WriterHistory(const HistoryAttributes& att);
- RTPS_DllAPI virtual ~WriterHistory() override;
- /**
- * Add a CacheChange_t to the WriterHistory.
- * @param a_change Pointer to the CacheChange_t to be added.
- * @return True if added.
- */
- RTPS_DllAPI bool add_change(CacheChange_t* a_change);
- /**
- * Add a CacheChange_t to the WriterHistory.
- * @param a_change Pointer to the CacheChange_t to be added.
- * @param wparams Extra write parameters.
- * @return True if added.
- */
- RTPS_DllAPI bool add_change(
- CacheChange_t* a_change,
- WriteParams &wparams);
- /**
- * Remove a specific change from the history.
- * @param a_change Pointer to the CacheChange_t.
- * @return True if removed.
- */
- RTPS_DllAPI bool remove_change(CacheChange_t* a_change) override;
- virtual bool remove_change_g(CacheChange_t* a_change);
- RTPS_DllAPI bool remove_change(const SequenceNumber_t& sequence_number);
- RTPS_DllAPI CacheChange_t* remove_change_and_reuse(const SequenceNumber_t& sequence_number);
- /**
- * Remove the CacheChange_t with the minimum sequenceNumber.
- * @return True if correctly removed.
- */
- RTPS_DllAPI bool remove_min_change();
- RTPS_DllAPI SequenceNumber_t next_sequence_number() const { return m_lastCacheChangeSeqNum + 1; }
- protected:
- bool add_change_(CacheChange_t* a_change, WriteParams &wparams,
- std::chrono::time_point<std::chrono::steady_clock> max_blocking_time
- = std::chrono::steady_clock::now() + std::chrono::hours(24));
- //!Last CacheChange Sequence Number added to the History.
- SequenceNumber_t m_lastCacheChangeSeqNum;
- //!Pointer to the associated RTPSWriter;
- RTPSWriter* mp_writer;
- };
- }
- } /* namespace fastrtps */
- } /* namespace eprosima */
- #endif /* _FASTDDS_RTPS_WRITERHISTORY_H_ */
|