Fast DDS  Version 3.0.1
Fast DDS
Loading...
Searching...
No Matches
WriterHistory Class Reference

Class WriterHistory, container of the different CacheChanges of a writer. More...

#include <WriterHistory.hpp>

Inheritance diagram for WriterHistory:

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_tcreate_change (ChangeKind_t change_kind, InstanceHandle_t handle=c_InstanceHandle_Unknown)
 Create a new CacheChange_t object.
 
FASTDDS_EXPORTED_API CacheChange_tcreate_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_tremove_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.
 
- Public Member Functions inherited from History
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 RecursiveTimedMutexgetMutex () 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.
 
- Protected Member Functions inherited from History
 History (const HistoryAttributes &att)
 
 History (History &&)=delete
 
Historyoperator= (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.
 
BaseWritermp_writer = nullptr
 Pointer to the associated writer.
 
uint32_t high_mark_for_frag_ = 0
 
- Protected Attributes inherited from History
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.
 
RecursiveTimedMutexmp_mutex = nullptr
 Mutex for the History.
 

Friends

class BaseWriter
 
class PersistentWriter
 
class IPersistenceService
 

Additional Inherited Members

- Public Types inherited from History
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
 
- Public Attributes inherited from History
HistoryAttributes m_att
 Attributes of the History.
 

Detailed Description

Class WriterHistory, container of the different CacheChanges of a writer.

Constructor & Destructor Documentation

◆ WriterHistory() [1/3]

FASTDDS_EXPORTED_API WriterHistory ( const HistoryAttributes att)

Construct a WriterHistory.

Parameters
attAttributes configuring the WriterHistory.

◆ WriterHistory() [2/3]

FASTDDS_EXPORTED_API WriterHistory ( const HistoryAttributes att,
const std::shared_ptr< IPayloadPool > &  payload_pool 
)

Construct a WriterHistory with a custom payload pool.

Parameters
attAttributes configuring the WriterHistory.
payload_poolPool of payloads to be used by the WriterHistory.

◆ WriterHistory() [3/3]

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.

Parameters
attAttributes configuring the WriterHistory.
payload_poolPool of payloads to be used by the WriterHistory.
change_poolPool of changes to be used by the WriterHistory.

◆ ~WriterHistory()

virtual FASTDDS_EXPORTED_API ~WriterHistory ( )
overridevirtual

Member Function Documentation

◆ add_change() [1/2]

FASTDDS_EXPORTED_API bool add_change ( CacheChange_t a_change)

Add a CacheChange_t to the WriterHistory.

Parameters
a_changePointer to the CacheChange_t to be added.
Returns
True if added.

◆ add_change() [2/2]

FASTDDS_EXPORTED_API bool add_change ( CacheChange_t a_change,
WriteParams wparams 
)

Add a CacheChange_t to the WriterHistory.

Parameters
a_changePointer to the CacheChange_t to be added.
wparamsExtra write parameters.
Returns
True if added.

◆ add_change_()

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) 
)
protected

Introduce a change into the history, and let the associated writer send it.

Parameters
[in,out]a_changeThe change to be added. Its sequenceNumber and sourceTimestamp will be filled by this method. Its wparams will be filled from parameter wparams.
[in,out]wparamsOn 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_timeMaximum time point the writer is allowed to be blocked till the change is put into the wire or the sending queue.
Returns
whether a_change could be added to the history.

◆ add_change_with_commit_hook()

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 
)
inlineprotected

Introduce a change into the history, and let the associated writer send it.

Parameters
[in,out]a_changeThe change to be added. Its sequenceNumber and sourceTimestamp will be filled by this method. Its wparams will be filled from parameter wparams.
[in,out]wparamsOn 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_commitFunctor 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_timeMaximum time point the writer is allowed to be blocked till the change is put into the wire or the sending queue.
Returns
whether a_change could be added to the history.

◆ create_change() [1/2]

FASTDDS_EXPORTED_API CacheChange_t * create_change ( ChangeKind_t  change_kind,
InstanceHandle_t  handle = c_InstanceHandle_Unknown 
)

Create a new CacheChange_t object.

Parameters
change_kindKind of the change.
handleInstanceHandle_t of the change.
Returns
Pointer to the new CacheChange_t object.
Precondition
A writer has been associated with this history

◆ create_change() [2/2]

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.

Parameters
payload_sizeSize of the payload.
change_kindKind of the change.
handleInstanceHandle_t of the change.
Returns
Pointer to the new CacheChange_t object.
Precondition
A writer has been associated with this history

◆ do_release_cache()

FASTDDS_EXPORTED_API void do_release_cache ( CacheChange_t ch)
overrideprotectedvirtual

Implements History.

◆ get_change_pool()

FASTDDS_EXPORTED_API const std::shared_ptr< IChangePool > & get_change_pool ( ) const

Get the change pool used by this history.

Returns
Reference to the change pool used by this history.

◆ get_payload_pool()

FASTDDS_EXPORTED_API const std::shared_ptr< IPayloadPool > & get_payload_pool ( ) const

Get the payload pool used by this history.

Returns
Reference to the payload pool used by this history.

◆ matches_change()

FASTDDS_EXPORTED_API bool matches_change ( const CacheChange_t inner,
CacheChange_t outer 
)
overridevirtual

Criteria to search a specific CacheChange_t on history.

Parameters
innerchange to compare
outerchange for comparison
Returns
true if inner matches outer criteria

Reimplemented from History.

◆ next_sequence_number()

FASTDDS_EXPORTED_API SequenceNumber_t next_sequence_number ( ) const
inline

◆ release_change()

FASTDDS_EXPORTED_API bool release_change ( CacheChange_t ch)

Release a change when it is not being used anymore.

Parameters
chPointer to the cache change to be released.
Returns
whether the operation succeeded or not
Precondition
  • A writer has been associated with this history
  • ch is not nullptr
  • ch points to a cache change obtained from a call to this->create_change
Postcondition
memory pointed to by ch is not accessed

◆ remove_change() [1/4]

FASTDDS_EXPORTED_API bool remove_change ( CacheChange_t ch)

Introduce base class method into scope.

◆ remove_change() [2/4]

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.

◆ remove_change() [3/4]

FASTDDS_EXPORTED_API bool remove_change ( const SequenceNumber_t sequence_number)

◆ remove_change() [4/4]

FASTDDS_EXPORTED_API iterator remove_change ( const_iterator  removal,
bool  release = true 
)
inline

Introduce base class method into scope.

◆ remove_change_and_reuse()

FASTDDS_EXPORTED_API CacheChange_t * remove_change_and_reuse ( const SequenceNumber_t sequence_number)

◆ remove_change_g() [1/2]

virtual FASTDDS_EXPORTED_API bool remove_change_g ( CacheChange_t a_change)
virtual

◆ remove_change_g() [2/2]

virtual FASTDDS_EXPORTED_API bool remove_change_g ( CacheChange_t a_change,
const std::chrono::time_point< std::chrono::steady_clock > &  max_blocking_time 
)
virtual

◆ remove_change_nts() [1/2]

FASTDDS_EXPORTED_API iterator remove_change_nts ( const_iterator  removal,
bool  release = true 
)
overridevirtual

Remove a specific change from the history.

No Thread Safe

Parameters
removaliterator to the change for removal
releasespecifies if the change should be return to the pool
Returns
iterator to the next change if any

Reimplemented from History.

◆ remove_change_nts() [2/2]

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 
)
overridevirtual

Remove a specific change from the history.

No Thread Safe

Parameters
removaliterator to the change for removal
releasespecifies if the change should be return to the pool
[in]max_blocking_timeMaximum time this method has to complete the task.
Returns
iterator to the next change if any

Reimplemented from History.

◆ remove_min_change() [1/2]

FASTDDS_EXPORTED_API bool remove_min_change ( )

Remove the CacheChange_t with the minimum sequenceNumber.

Returns
True if correctly removed.

◆ remove_min_change() [2/2]

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.

Parameters
[in]max_blocking_timeMaximum time this method has to complete the task.
Returns
True if correctly removed.

Friends And Related Symbol Documentation

◆ BaseWriter

friend class BaseWriter
friend

◆ IPersistenceService

friend class IPersistenceService
friend

◆ PersistentWriter

friend class PersistentWriter
friend

Member Data Documentation

◆ high_mark_for_frag_

uint32_t high_mark_for_frag_ = 0
protected

◆ m_lastCacheChangeSeqNum

SequenceNumber_t m_lastCacheChangeSeqNum {}
protected

Last CacheChange Sequence Number added to the History.

◆ mp_writer

BaseWriter* mp_writer = nullptr
protected

Pointer to the associated writer.


The documentation for this class was generated from the following file: