Fast DDS  Version 3.1.2
Fast DDS
Loading...
Searching...
No Matches
ReaderHistory Class Reference

Class ReaderHistory, container of the different CacheChanges of a reader. More...

#include <ReaderHistory.hpp>

Inheritance diagram for ReaderHistory:

Public Member Functions

FASTDDS_EXPORTED_API ReaderHistory (const HistoryAttributes &att)
 Constructor of the ReaderHistory.
 
FASTDDS_EXPORTED_API ~ReaderHistory () override
 
virtual FASTDDS_EXPORTED_API bool can_change_be_added_nts (const GUID_t &writer_guid, uint32_t total_payload_size, size_t unknown_missing_changes_up_to, bool &will_never_be_accepted) const
 Check if a new change can be added to this history.
 
virtual FASTDDS_EXPORTED_API bool received_change (CacheChange_t *change, size_t unknown_missing_changes_up_to)
 Virtual method that is called when a new change is received.
 
virtual FASTDDS_EXPORTED_API bool received_change (CacheChange_t *change, size_t unknown_missing_changes_up_to, fastdds::dds::SampleRejectedStatusKind &rejection_reason)
 Virtual method that is called when a new change is received.
 
FASTDDS_EXPORTED_API virtual bool completed_change (rtps::CacheChange_t *change)
 Called when a fragmented change is received completely by the Subscriber.
 
virtual FASTDDS_EXPORTED_API bool completed_change (CacheChange_t *change, size_t unknown_missing_changes_up_to, fastdds::dds::SampleRejectedStatusKind &rejection_reason)
 Called when a fragmented change is received completely by the Subscriber.
 
FASTDDS_EXPORTED_API bool add_change (CacheChange_t *a_change)
 Add a CacheChange_t to the ReaderHistory.
 
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.
 
FASTDDS_EXPORTED_API bool remove_changes_with_guid (const GUID_t &a_guid)
 Remove all changes from the History that have a certain guid.
 
bool remove_fragmented_changes_until (const SequenceNumber_t &seq_num, const GUID_t &writer_guid)
 Remove all fragmented changes from certain writer up to certain sequence number.
 
FASTDDS_EXPORTED_API bool get_min_change_from (CacheChange_t **min_change, const GUID_t &writerGuid)
 
virtual FASTDDS_EXPORTED_API void writer_unmatched (const GUID_t &writer_guid, const SequenceNumber_t &last_notified_seq)
 Called when a writer is unmatched from the reader holding this history.
 
virtual FASTDDS_EXPORTED_API void writer_update_its_ownership_strength_nts (const GUID_t &writer_guid, const uint32_t ownership_strength)
 This function should be called by reader if a writer updates its ownership strength.
 
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
 
template<typename Pred >
void remove_changes_with_pred (Pred pred)
 
- 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

RTPSReadermp_reader
 Pointer to the reader.
 
- 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 RTPSReader
 

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 ReaderHistory, container of the different CacheChanges of a reader.

Constructor & Destructor Documentation

◆ ReaderHistory()

FASTDDS_EXPORTED_API ReaderHistory ( const HistoryAttributes & att)

Constructor of the ReaderHistory.

It needs a HistoryAttributes.

◆ ~ReaderHistory()

FASTDDS_EXPORTED_API ~ReaderHistory ( )
override

Member Function Documentation

◆ add_change()

FASTDDS_EXPORTED_API bool add_change ( CacheChange_t * a_change)

Add a CacheChange_t to the ReaderHistory.

Parameters
a_changePointer to the CacheChange to add.
Returns
True if added.

◆ can_change_be_added_nts()

virtual FASTDDS_EXPORTED_API bool can_change_be_added_nts ( const GUID_t & writer_guid,
uint32_t total_payload_size,
size_t unknown_missing_changes_up_to,
bool & will_never_be_accepted ) const
virtual

Check if a new change can be added to this history.

Parameters
[in]writer_guidGUID of the writer where the change came from.
[in]total_payload_sizeTotal payload size of the incoming change.
[in]unknown_missing_changes_up_toThe number of changes from the same writer with a lower sequence number that could potentially be received in the future.
[out]will_never_be_acceptedWhen the method returns false, this parameter will inform whether the change could be accepted in the future or not.
Precondition
change should not be present in the history
Returns
Whether a call to received_change will succeed when called with the same arguments.

◆ completed_change() [1/2]

virtual FASTDDS_EXPORTED_API bool completed_change ( CacheChange_t * change,
size_t unknown_missing_changes_up_to,
fastdds::dds::SampleRejectedStatusKind & rejection_reason )
inlinevirtual

Called when a fragmented change is received completely by the Subscriber.

Will find its instance and store it.

Precondition
Change should be already present in the history.
Parameters
[in]changeThe received change
[in]unknown_missing_changes_up_toNumber of missing changes before this one
[out]rejection_reasonIn case of been rejected the sample, it will contain the reason of the rejection.
Returns

◆ completed_change() [2/2]

FASTDDS_EXPORTED_API virtual bool completed_change ( rtps::CacheChange_t * change)
inlinevirtual

Called when a fragmented change is received completely by the Subscriber.

Will find its instance and store it.

Precondition
Change should be already present in the history.
Parameters
[in]changeThe received change
Returns

◆ do_release_cache()

FASTDDS_EXPORTED_API void do_release_cache ( CacheChange_t * ch)
overrideprotectedvirtual

Implements History.

◆ get_min_change_from()

FASTDDS_EXPORTED_API bool get_min_change_from ( CacheChange_t ** min_change,
const GUID_t & writerGuid )

◆ 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.

◆ received_change() [1/2]

virtual FASTDDS_EXPORTED_API bool received_change ( CacheChange_t * change,
size_t unknown_missing_changes_up_to )
virtual

Virtual method that is called when a new change is received.

In this implementation this method just calls add_change. The user can overload this method in case he needs to perform additional checks before adding the change.

Parameters
changePointer to the change
unknown_missing_changes_up_toThe number of changes from the same writer with a lower sequence number that could potentially be received in the future.
Returns
True if added.

◆ received_change() [2/2]

virtual FASTDDS_EXPORTED_API bool received_change ( CacheChange_t * change,
size_t unknown_missing_changes_up_to,
fastdds::dds::SampleRejectedStatusKind & rejection_reason )
inlinevirtual

Virtual method that is called when a new change is received.

In this implementation this method just calls add_change. The user can overload this method in case he needs to perform additional checks before adding the change.

Parameters
[in]changePointer to the change
[in]unknown_missing_changes_up_toThe number of changes from the same writer with a lower sequence number that could potentially be received in the future.
[out]rejection_reasonIn case of been rejected the sample, it will contain the reason of the rejection.
Returns
True if added.

◆ remove_change() [1/3]

FASTDDS_EXPORTED_API bool remove_change ( CacheChange_t * ch)

Introduce base class method into scope.

◆ remove_change() [2/3]

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/3]

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

Introduce base class method into scope.

◆ 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 must be returned 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
[in]max_blocking_timeMaximum time this method has to complete the task.
releasespecifies if the change must be returned to the pool
Returns
iterator to the next change if any

Reimplemented from History.

◆ remove_changes_with_guid()

FASTDDS_EXPORTED_API bool remove_changes_with_guid ( const GUID_t & a_guid)

Remove all changes from the History that have a certain guid.

Parameters
a_guidPointer to the target guid to search for.
Returns
True if successful, even if no changes have been removed.

◆ remove_changes_with_pred()

template<typename Pred >
void remove_changes_with_pred ( Pred pred)
inlineprotected

◆ remove_fragmented_changes_until()

bool remove_fragmented_changes_until ( const SequenceNumber_t & seq_num,
const GUID_t & writer_guid )

Remove all fragmented changes from certain writer up to certain sequence number.

Parameters
seq_numFirst SequenceNumber_t not to be removed.
writer_guidGUID of the writer for which changes should be looked for.
Returns
True if successful, even if no changes have been removed.

◆ writer_unmatched()

virtual FASTDDS_EXPORTED_API void writer_unmatched ( const GUID_t & writer_guid,
const SequenceNumber_t & last_notified_seq )
virtual

Called when a writer is unmatched from the reader holding this history.

This method will remove all the changes on the history that came from the writer being unmatched and which have not yet been notified to the user.

Parameters
writer_guidGUID of the writer being unmatched.
last_notified_seqLast sequence number from the specified writer that was notified to the user.

◆ writer_update_its_ownership_strength_nts()

virtual FASTDDS_EXPORTED_API void writer_update_its_ownership_strength_nts ( const GUID_t & writer_guid,
const uint32_t ownership_strength )
inlinevirtual

This function should be called by reader if a writer updates its ownership strength.

Parameters
[in]writer_guidGuid of the writer which changes its ownership strength.
[out]ownership_strengthNew value of the writer's Ownership strength.

Friends And Related Symbol Documentation

◆ RTPSReader

friend class RTPSReader
friend

Member Data Documentation

◆ mp_reader

RTPSReader* mp_reader
protected

Pointer to the reader.


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