Class WriterHistory, container of the different CacheChanges of a writer. More...
#include <WriterHistory.hpp>
Public Member Functions | |
FASTDDS_EXPORTED_API | WriterHistory (const HistoryAttributes &att) |
Construct a WriterHistory. | |
FASTDDS_EXPORTED_API | WriterHistory (const HistoryAttributes &att, const std::shared_ptr< IPayloadPool > &payload_pool) |
Construct a WriterHistory with a custom payload pool. | |
FASTDDS_EXPORTED_API | WriterHistory (const HistoryAttributes &att, const std::shared_ptr< IPayloadPool > &payload_pool, const std::shared_ptr< IChangePool > &change_pool) |
Construct a WriterHistory with custom payload and change pools. | |
virtual FASTDDS_EXPORTED_API | ~WriterHistory () override |
FASTDDS_EXPORTED_API const std::shared_ptr< IPayloadPool > & | get_payload_pool () const |
Get the payload pool used by this history. | |
FASTDDS_EXPORTED_API const std::shared_ptr< IChangePool > & | get_change_pool () const |
Get the change pool used by this history. | |
FASTDDS_EXPORTED_API CacheChange_t * | create_change (ChangeKind_t change_kind, InstanceHandle_t handle=c_InstanceHandle_Unknown) |
Create a new CacheChange_t object. | |
FASTDDS_EXPORTED_API CacheChange_t * | create_change (uint32_t payload_size, ChangeKind_t change_kind, InstanceHandle_t handle=c_InstanceHandle_Unknown) |
Create a new CacheChange_t object with a specific payload size. | |
FASTDDS_EXPORTED_API bool | add_change (CacheChange_t *a_change) |
Add a CacheChange_t to the WriterHistory. | |
FASTDDS_EXPORTED_API bool | add_change (CacheChange_t *a_change, WriteParams &wparams) |
Add a CacheChange_t to the WriterHistory. | |
FASTDDS_EXPORTED_API iterator | remove_change_nts (const_iterator removal, bool release=true) override |
Remove a specific change from the history. | |
FASTDDS_EXPORTED_API iterator | remove_change_nts (const_iterator removal, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time, bool release=true) override |
Remove a specific change from the history. | |
FASTDDS_EXPORTED_API bool | matches_change (const CacheChange_t *inner, CacheChange_t *outer) override |
Criteria to search a specific CacheChange_t on history. | |
virtual FASTDDS_EXPORTED_API bool | remove_change_g (CacheChange_t *a_change) |
virtual FASTDDS_EXPORTED_API bool | remove_change_g (CacheChange_t *a_change, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time) |
FASTDDS_EXPORTED_API bool | remove_change (const SequenceNumber_t &sequence_number) |
FASTDDS_EXPORTED_API CacheChange_t * | remove_change_and_reuse (const SequenceNumber_t &sequence_number) |
FASTDDS_EXPORTED_API bool | remove_min_change () |
Remove the CacheChange_t with the minimum sequenceNumber. | |
FASTDDS_EXPORTED_API bool | remove_min_change (const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time) |
Remove the CacheChange_t with the minimum sequenceNumber. | |
FASTDDS_EXPORTED_API SequenceNumber_t | next_sequence_number () const |
FASTDDS_EXPORTED_API bool | release_change (CacheChange_t *ch) |
Release a change when it is not being used anymore. | |
FASTDDS_EXPORTED_API bool | remove_change (CacheChange_t *ch) |
Introduce base class method into scope. | |
FASTDDS_EXPORTED_API bool | remove_change (CacheChange_t *ch, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time) |
Introduce base class method into scope. | |
FASTDDS_EXPORTED_API iterator | remove_change (const_iterator removal, bool release=true) |
Introduce base class method into scope. | |
![]() | |
FASTDDS_EXPORTED_API bool | isFull () |
Check if the history is full. | |
FASTDDS_EXPORTED_API size_t | getHistorySize () |
Get the History size. | |
FASTDDS_EXPORTED_API const_iterator | find_change_nts (CacheChange_t *ch) |
Find a specific change in the history using the matches_change method criteria. | |
FASTDDS_EXPORTED_API bool | remove_all_changes () |
Remove all changes from the History. | |
FASTDDS_EXPORTED_API bool | remove_change (CacheChange_t *ch) |
Remove a specific change from the history. | |
FASTDDS_EXPORTED_API bool | remove_change (CacheChange_t *ch, const std::chrono::time_point< std::chrono::steady_clock > &max_blocking_time) |
Remove a specific change from the history. | |
FASTDDS_EXPORTED_API const_iterator | find_change (CacheChange_t *ch) |
Find a specific change in the history using the matches_change method criteria. | |
FASTDDS_EXPORTED_API iterator | remove_change (const_iterator removal, bool release=true) |
Remove a specific change from the history. | |
FASTDDS_EXPORTED_API iterator | changesBegin () |
Get the beginning of the changes history iterator. | |
FASTDDS_EXPORTED_API reverse_iterator | changesRbegin () |
FASTDDS_EXPORTED_API iterator | changesEnd () |
Get the end of the changes history iterator. | |
FASTDDS_EXPORTED_API reverse_iterator | changesRend () |
FASTDDS_EXPORTED_API bool | get_min_change (CacheChange_t **min_change) |
Get the minimum CacheChange_t. | |
FASTDDS_EXPORTED_API bool | get_max_change (CacheChange_t **max_change) |
Get the maximum CacheChange_t. | |
FASTDDS_EXPORTED_API uint32_t | getTypeMaxSerialized () |
Get the maximum serialized payload size. | |
FASTDDS_EXPORTED_API RecursiveTimedMutex * | getMutex () const |
Get the mutex. | |
FASTDDS_EXPORTED_API 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) |
A method to get the change with the earliest timestamp. | |
Protected Member Functions | |
FASTDDS_EXPORTED_API void | do_release_cache (CacheChange_t *ch) override |
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)) |
Introduce a change into the history, and let the associated writer send it. | |
template<typename PreCommitHook > | |
bool | add_change_with_commit_hook (CacheChange_t *a_change, WriteParams &wparams, PreCommitHook pre_commit, std::chrono::time_point< std::chrono::steady_clock > max_blocking_time) |
Introduce a change into the history, and let the associated writer send it. | |
![]() | |
History (const HistoryAttributes &att) | |
History (History &&)=delete | |
History & | operator= (History &&)=delete |
virtual | ~History () |
void | print_changes_seqNum2 () |
Print the seqNum of the changes in the History (for debuggisi, mng purposes). | |
History::iterator | remove_iterator_constness (const_iterator c_it) |
Removes the constness of a const_iterator to obtain a regular iterator. | |
Protected Attributes | |
SequenceNumber_t | m_lastCacheChangeSeqNum {} |
Last CacheChange Sequence Number added to the History. | |
BaseWriter * | mp_writer = nullptr |
Pointer to the associated writer. | |
uint32_t | high_mark_for_frag_ = 0 |
![]() | |
std::vector< CacheChange_t * > | m_changes |
Vector of pointers to the CacheChange_t. | |
bool | m_isHistoryFull = false |
Variable to know if the history is full without needing to block the History mutex. | |
RecursiveTimedMutex * | mp_mutex = nullptr |
Mutex for the History. | |
Friends | |
class | BaseWriter |
class | PersistentWriter |
class | IPersistenceService |
Additional Inherited Members | |
![]() | |
using | iterator = std::vector<CacheChange_t*>::iterator |
using | reverse_iterator = std::vector<CacheChange_t*>::reverse_iterator |
using | const_iterator = std::vector<CacheChange_t*>::const_iterator |
![]() | |
HistoryAttributes | m_att |
Attributes of the History. | |
Class WriterHistory, container of the different CacheChanges of a writer.
FASTDDS_EXPORTED_API WriterHistory | ( | const HistoryAttributes & | att | ) |
Construct a WriterHistory.
att | Attributes configuring the WriterHistory. |
FASTDDS_EXPORTED_API WriterHistory | ( | const HistoryAttributes & | att, |
const std::shared_ptr< IPayloadPool > & | payload_pool ) |
Construct a WriterHistory with a custom payload pool.
att | Attributes configuring the WriterHistory. |
payload_pool | Pool of payloads to be used by the WriterHistory. |
FASTDDS_EXPORTED_API WriterHistory | ( | const HistoryAttributes & | att, |
const std::shared_ptr< IPayloadPool > & | payload_pool, | ||
const std::shared_ptr< IChangePool > & | change_pool ) |
Construct a WriterHistory with custom payload and change pools.
att | Attributes configuring the WriterHistory. |
payload_pool | Pool of payloads to be used by the WriterHistory. |
change_pool | Pool of changes to be used by the WriterHistory. |
|
overridevirtual |
FASTDDS_EXPORTED_API bool add_change | ( | CacheChange_t * | a_change | ) |
Add a CacheChange_t to the WriterHistory.
a_change | Pointer to the CacheChange_t to be added. |
FASTDDS_EXPORTED_API bool add_change | ( | CacheChange_t * | a_change, |
WriteParams & | wparams ) |
Add a CacheChange_t to the WriterHistory.
a_change | Pointer to the CacheChange_t to be added. |
wparams | Extra write parameters. |
|
protected |
Introduce a change into the history, and let the associated writer send it.
[in,out] | a_change | The change to be added. Its sequenceNumber and sourceTimestamp will be filled by this method. Its wparams will be filled from parameter wparams . |
[in,out] | wparams | On input, it holds the WriteParams to be copied into a_change . On output, will be filled with the sample identity assigned to a_change . |
[in] | max_blocking_time | Maximum time point the writer is allowed to be blocked till the change is put into the wire or the sending queue. |
a_change
could be added to the history.
|
inlineprotected |
Introduce a change into the history, and let the associated writer send it.
[in,out] | a_change | The change to be added. Its sequenceNumber and sourceTimestamp will be filled by this method. Its wparams will be filled from parameter wparams . |
[in,out] | wparams | On input, it holds the WriteParams to be copied into a_change . On output, will be filled with the sample identity assigned to a_change . |
[in] | pre_commit | Functor called after a_change has been added to the history, and its information has been filled, but before the writer is notified of the insertion. |
[in] | max_blocking_time | Maximum time point the writer is allowed to be blocked till the change is put into the wire or the sending queue. |
a_change
could be added to the history. FASTDDS_EXPORTED_API CacheChange_t * create_change | ( | ChangeKind_t | change_kind, |
InstanceHandle_t | handle = c_InstanceHandle_Unknown ) |
Create a new CacheChange_t object.
change_kind | Kind of the change. |
handle | InstanceHandle_t of the change. |
FASTDDS_EXPORTED_API CacheChange_t * create_change | ( | uint32_t | payload_size, |
ChangeKind_t | change_kind, | ||
InstanceHandle_t | handle = c_InstanceHandle_Unknown ) |
Create a new CacheChange_t object with a specific payload size.
payload_size | Size of the payload. |
change_kind | Kind of the change. |
handle | InstanceHandle_t of the change. |
|
overrideprotectedvirtual |
Implements History.
FASTDDS_EXPORTED_API const std::shared_ptr< IChangePool > & get_change_pool | ( | ) | const |
Get the change pool used by this history.
FASTDDS_EXPORTED_API const std::shared_ptr< IPayloadPool > & get_payload_pool | ( | ) | const |
Get the payload pool used by this history.
|
overridevirtual |
Criteria to search a specific CacheChange_t on history.
inner | change to compare |
outer | change for comparison |
Reimplemented from History.
|
inline |
FASTDDS_EXPORTED_API bool release_change | ( | CacheChange_t * | ch | ) |
Release a change when it is not being used anymore.
ch | Pointer to the cache change to be released. |
ch
is not nullptr
ch
points to a cache change obtained from a call to this->create_change
ch
is not accessed FASTDDS_EXPORTED_API bool remove_change | ( | CacheChange_t * | ch | ) |
Introduce base class method into scope.
FASTDDS_EXPORTED_API bool remove_change | ( | CacheChange_t * | ch, |
const std::chrono::time_point< std::chrono::steady_clock > & | max_blocking_time ) |
Introduce base class method into scope.
FASTDDS_EXPORTED_API bool remove_change | ( | const SequenceNumber_t & | sequence_number | ) |
|
inline |
Introduce base class method into scope.
FASTDDS_EXPORTED_API CacheChange_t * remove_change_and_reuse | ( | const SequenceNumber_t & | sequence_number | ) |
|
virtual |
|
virtual |
|
overridevirtual |
Remove a specific change from the history.
No Thread Safe
removal | iterator to the change for removal |
release | specifies if the change should be return to the pool |
Reimplemented from History.
|
overridevirtual |
Remove a specific change from the history.
No Thread Safe
removal | iterator to the change for removal | |
release | specifies if the change should be return to the pool | |
[in] | max_blocking_time | Maximum time this method has to complete the task. |
Reimplemented from History.
FASTDDS_EXPORTED_API bool remove_min_change | ( | ) |
Remove the CacheChange_t with the minimum sequenceNumber.
FASTDDS_EXPORTED_API bool remove_min_change | ( | const std::chrono::time_point< std::chrono::steady_clock > & | max_blocking_time | ) |
Remove the CacheChange_t with the minimum sequenceNumber.
[in] | max_blocking_time | Maximum time this method has to complete the task. |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
Last CacheChange Sequence Number added to the History.
|
protected |
Pointer to the associated writer.