Fast RTPS  Version 2.4.0
Fast RTPS

Class SubscriberHistory, container of the different CacheChanges of a subscriber. More...

#include <SubscriberHistory.h>

Inheritance diagram for SubscriberHistory:

Public Types

using instance_info = std::pair< rtps::InstanceHandle_t, std::vector< rtps::CacheChange_t * > * >
 

Public Member Functions

 SubscriberHistory (const TopicAttributes &topic_att, fastdds::dds::TopicDataType *type, const fastrtps::ReaderQos &qos, uint32_t payloadMax, rtps::MemoryManagementPolicy_t mempolicy)
 Constructor. More...
 
 ~SubscriberHistory () override
 
iterator remove_change_nts (const_iterator removal, bool release=true) override
 Remove a specific change from the history. More...
 
bool received_change (rtps::CacheChange_t *change, size_t unknown_missing_changes_up_to) override
 Called when a change is received by the Subscriber. More...
 
bool get_first_untaken_info (SampleInfo_t *info)
 Returns information about the first untaken sample. More...
 
bool remove_change_sub (rtps::CacheChange_t *change)
 This method is called to remove a change from the SubscriberHistory. More...
 
bool remove_change_sub (rtps::CacheChange_t *change, iterator &it)
 This method is called to remove a change from the SubscriberHistory. More...
 
bool set_next_deadline (const rtps::InstanceHandle_t &handle, const std::chrono::steady_clock::time_point &next_deadline_us)
 A method to set the next deadline for the given instance. More...
 
bool get_next_deadline (rtps::InstanceHandle_t &handle, std::chrono::steady_clock::time_point &next_deadline_us)
 A method to get the next instance handle that will miss the deadline and the time when the deadline will occur. More...
 
std::pair< bool, instance_infolookup_instance (const rtps::InstanceHandle_t &handle, bool exact)
 Get the list of changes corresponding to an instance handle. More...
 
Read or take data methods.

Methods to read or take data from the History.

Parameters
dataPointer to the object where you want to read or take the information.
infoPointer to a SampleInfo_t object where you want
max_blocking_timeMaximum time the function can be blocked. to store the information about the retrieved data
bool readNextData (void *data, SampleInfo_t *info, std::chrono::steady_clock::time_point &max_blocking_time)
 
bool takeNextData (void *data, SampleInfo_t *info, std::chrono::steady_clock::time_point &max_blocking_time)
 

Detailed Description

Class SubscriberHistory, container of the different CacheChanges of a subscriber.

Member Typedef Documentation

◆ instance_info

using instance_info = std::pair<rtps::InstanceHandle_t, std::vector<rtps::CacheChange_t*>*>

Constructor & Destructor Documentation

◆ SubscriberHistory()

SubscriberHistory ( const TopicAttributes topic_att,
fastdds::dds::TopicDataType *  type,
const fastrtps::ReaderQos qos,
uint32_t  payloadMax,
rtps::MemoryManagementPolicy_t  mempolicy 
)

Constructor.

Requires information about the subscriber.

Parameters
topic_attTopicAttributes.
typeTopicDataType.
qosReaderQoS policy.
payloadMaxMaximum payload size per change.
mempolicySet whether the payloads ccan dynamically resized or not.

◆ ~SubscriberHistory()

~SubscriberHistory ( )
override

Member Function Documentation

◆ get_first_untaken_info()

bool get_first_untaken_info ( SampleInfo_t info)

Returns information about the first untaken sample.

Parameters
[out]infoPointer to a SampleInfo_t structure to store first untaken sample information.
Returns
true if sample info was returned. false if there is no sample to take.

◆ get_next_deadline()

bool get_next_deadline ( rtps::InstanceHandle_t &  handle,
std::chrono::steady_clock::time_point &  next_deadline_us 
)

A method to get the next instance handle that will miss the deadline and the time when the deadline will occur.

Parameters
handleThe handle to the instance
next_deadline_usThe time point when the instance will miss the deadline
Returns
True if the deadline was retrieved successfully

◆ lookup_instance()

std::pair<bool, instance_info> lookup_instance ( const rtps::InstanceHandle_t &  handle,
bool  exact 
)

Get the list of changes corresponding to an instance handle.

Parameters
handleThe handle to the instance.
exactIndicates if the handle should match exactly (true) or if the first instance greater than the input handle should be returned.
Returns
A pair where:
  • first is a boolean indicating if an instance was found
  • second is a pair where:
    • first is the handle of the returned instance
    • second is a pointer to a std::vector<rtps::CacheChange_t*> with the list of changes for the returned instance
Remarks
When used on a NO_KEY topic, an instance will only be returned when called with handle = HANDLE_NIL and exact = false.

◆ readNextData()

bool readNextData ( void *  data,
SampleInfo_t info,
std::chrono::steady_clock::time_point &  max_blocking_time 
)

◆ received_change()

bool received_change ( rtps::CacheChange_t *  change,
size_t  unknown_missing_changes_up_to 
)
override

Called when a change is received by the Subscriber.

Will add the change to the history.

Precondition
Change should not be already present in the history.
Parameters
[in]changeThe received change
unknown_missing_changes_up_toNumber of missing changes before this one
Returns

◆ remove_change_nts()

iterator remove_change_nts ( const_iterator  removal,
bool  release = true 
)
override

Remove a specific change from the history.

No Thread Safe

Parameters
removaliterator to the CacheChange_t to remove.
releasedefaults to true and hints if the CacheChange_t should return to the pool
Returns
iterator to the next CacheChange_t or end iterator.

◆ remove_change_sub() [1/2]

bool remove_change_sub ( rtps::CacheChange_t *  change)

This method is called to remove a change from the SubscriberHistory.

Parameters
changePointer to the CacheChange_t.
Returns
True if removed.

◆ remove_change_sub() [2/2]

bool remove_change_sub ( rtps::CacheChange_t *  change,
iterator &  it 
)

This method is called to remove a change from the SubscriberHistory.

Parameters
[in]changePointer to the CacheChange_t.
[in,out]itIterator pointing to change on input. Will point to next valid change on output.
Returns
True if removed.

◆ set_next_deadline()

bool set_next_deadline ( const rtps::InstanceHandle_t &  handle,
const std::chrono::steady_clock::time_point &  next_deadline_us 
)

A method to set the next deadline for the given instance.

Parameters
handleThe handle to the instance
next_deadline_usThe time point when the deadline will occur
Returns
True if the deadline was set correctly

◆ takeNextData()

bool takeNextData ( void *  data,
SampleInfo_t info,
std::chrono::steady_clock::time_point &  max_blocking_time 
)

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