Class History

Inheritance Relationships

Derived Types

Class Documentation

class History

Class History, container of the different CacheChanges and the methods to access them.

Subclassed by eprosima::fastrtps::rtps::ReaderHistory, eprosima::fastrtps::rtps::WriterHistory

Public Types

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 Functions

inline RTPS_DllAPI bool reserve_Cache (CacheChange_t **change, const std::function< uint32_t()> &calculateSizeFunc)

Reserve a CacheChange_t from the CacheChange pool.

Warning

This method has been deprecated and will be removed on v3.0.0

Parameters
  • change[out] Pointer to pointer to the CacheChange_t to reserve

  • calculateSizeFunc[in] Function to calculate the size of the payload.

Returns

True if reserved

inline RTPS_DllAPI bool reserve_Cache (CacheChange_t **change, uint32_t dataSize)

Reserve a CacheChange_t from the CacheChange pool.

Warning

This method has been deprecated and will be removed on v3.0.0

Parameters
  • change[out] Pointer to pointer to the CacheChange_t to reserve

  • dataSize[in] Required size for the payload.

Returns

True if reserved

inline RTPS_DllAPI void release_Cache (CacheChange_t *ch)

release a previously reserved CacheChange_t.

Warning

This method has been deprecated and will be removed on v3.0.0

Parameters

ch – Pointer to the CacheChange_t.

inline RTPS_DllAPI bool isFull ()

Check if the history is full

Returns

true if the History is full.

inline RTPS_DllAPI size_t getHistorySize ()

Get the History size.

Returns

Size of the history.

RTPS_DllAPI const_iterator find_change_nts (CacheChange_t *ch)

Find a specific change in the history using the matches_change method criteria. No Thread Safe

Parameters

ch – Pointer to the CacheChange_t to search for.

Returns

an iterator if a suitable change is found

virtual RTPS_DllAPI iterator remove_change_nts (const_iterator removal, bool release=true)

Remove a specific change from the history. No Thread Safe

Parameters
  • removal – iterator to the CacheChange_t to remove.

  • release – defaults to true and hints if the CacheChange_t should return to the pool

Returns

iterator to the next CacheChange_t or end iterator.

RTPS_DllAPI bool remove_all_changes ()

Remove all changes from the History

Returns

True if everything was correctly removed.

RTPS_DllAPI bool remove_change (CacheChange_t *ch)

Remove a specific change from the history.

Parameters

ch – Pointer to the CacheChange_t.

Returns

True if removed.

inline RTPS_DllAPI const_iterator find_change (CacheChange_t *ch)

Find a specific change in the history using the matches_change method criteria.

Parameters

ch – Pointer to the CacheChange_t to search for.

Returns

an iterator if a suitable change is found

virtual RTPS_DllAPI bool matches_change (const CacheChange_t *ch_inner, CacheChange_t *ch_outer)

Verifies if an element of the changes collection matches a given change Derived classes have more info on how to identify univocally a change and should override.

Parameters
  • ch_inner – element of the collection to compare with the given change

  • ch_outer – Pointer to the CacheChange_t to identify.

Returns

true if the iterator identifies this change.

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

Remove a specific change from the history.

Parameters
  • removal – iterator to the CacheChange_t to remove.

  • release – defaults to true and hints if the CacheChange_t should return to the pool

Returns

iterator to the next CacheChange_t or end iterator.

inline RTPS_DllAPI iterator changesBegin ()

Get the beginning of the changes history iterator.

Returns

Iterator to the beginning of the vector.

inline RTPS_DllAPI reverse_iterator changesRbegin ()
inline RTPS_DllAPI iterator changesEnd ()

Get the end of the changes history iterator.

Returns

Iterator to the end of the vector.

inline RTPS_DllAPI reverse_iterator changesRend ()
RTPS_DllAPI bool get_min_change (CacheChange_t **min_change)

Get the minimum CacheChange_t.

Parameters

min_change – Pointer to pointer to the minimum change.

Returns

True if correct.

RTPS_DllAPI bool get_max_change (CacheChange_t **max_change)

Get the maximum CacheChange_t.

Parameters

max_change – Pointer to pointer to the maximum change.

Returns

True if correct.

inline RTPS_DllAPI uint32_t getTypeMaxSerialized ()

Get the maximum serialized payload size

Returns

Maximum serialized payload size

inline RTPS_DllAPI RecursiveTimedMutex * getMutex () const

Get the mutex

Returns

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)

A method to get the change with the earliest timestamp.

Parameters

change – Pointer to pointer to earliest change

Returns

True on success

Public Members

HistoryAttributes m_att

Attributes of the History.

Protected Functions

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

virtual RTPS_DllAPI bool do_reserve_cache (CacheChange_t **change, uint32_t size)=0
virtual RTPS_DllAPI void do_release_cache (CacheChange_t *ch)=0

Protected Attributes

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.