Class PublisherHistory

Inheritance Relationships

Base Type

Class Documentation

class PublisherHistory : public eprosima::fastrtps::rtps::WriterHistory

Class PublisherHistory, implementing a WriterHistory with support for keyed topics and HistoryQOS. This class is created by the PublisherImpl and should not be used by the user directly.

Public Functions

PublisherHistory(const TopicAttributes &topic_att, uint32_t payloadMax, rtps::MemoryManagementPolicy_t mempolicy)

Constructor of the PublisherHistory.

Parameters
  • topic_att – TopicAttributed

  • payloadMax – Maximum payload size.

  • mempolicy – Set whether the payloads ccan dynamically resized or not.

virtual ~PublisherHistory()
void rebuild_instances()

Rebuild instances loaded from DB. Does nothing if the topic doesn’t have key.

bool register_instance(const rtps::InstanceHandle_t &instance_handle, std::unique_lock<RecursiveTimedMutex> &lock, const std::chrono::time_point<std::chrono::steady_clock> &max_blocking_time)

Tries to reserve resources for the new instance.

Parameters
  • instance_handle – Instance’s key.

  • lock – Lock which should be unlock in case the operation has to wait.

  • max_blocking_time – Maximum time the operation should be waiting.

Returns

True if resources was reserved successfully.

bool add_pub_change(rtps::CacheChange_t *change, rtps::WriteParams &wparams, std::unique_lock<RecursiveTimedMutex> &lock, const std::chrono::time_point<std::chrono::steady_clock> &max_blocking_time)

Add a change comming from the Publisher.

Parameters
  • change – Pointer to the change

  • wparams – Extra write parameters.

  • lock

  • max_blocking_time

Returns

True if added.

bool removeAllChange(size_t *removed)

Remove all change from the associated history.

Parameters

removed – Number of elements removed.

Returns

True if all elements were removed.

bool removeMinChange()

Remove the change with the minimum sequence Number.

Returns

True if removed.

bool remove_change_pub(rtps::CacheChange_t *change)

Remove a change by the publisher History.

Parameters

change – Pointer to the CacheChange_t.

Returns

True if removed.

virtual bool remove_change_g(rtps::CacheChange_t *a_change)
bool remove_instance_changes(const rtps::InstanceHandle_t &handle, const rtps::SequenceNumber_t &seq_up_to)
bool set_next_deadline(const rtps::InstanceHandle_t &handle, const std::chrono::steady_clock::time_point &next_deadline_us)

Sets the next deadline for the given instance.

Parameters
  • handle – The instance handle

  • next_deadline_us – The time point when the deadline will occur

Returns

True if deadline was set successfully

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

Returns the deadline for the instance that is next going to ‘expire’.

Parameters
  • handle – The handle for the instance that will next miss the deadline

  • next_deadline_us – The time point when the deadline will occur

Returns

True if deadline could be retrieved for the given instance

bool is_key_registered(const rtps::InstanceHandle_t &handle)

Checks if the instance’s key is registered.

Parameters

handle[in] Instance’s key. return true if instance’s key is registered in the history.

bool wait_for_acknowledgement_last_change(const rtps::InstanceHandle_t &handle, std::unique_lock<RecursiveTimedMutex> &lock, const std::chrono::time_point<std::chrono::steady_clock> &max_blocking_time)

Waits till the last change in the instance history has been acknowledged.

Parameters
  • handle – Instance’s handle.

  • lock – Lock which should be unlock in case the operation has to wait.

  • max_blocking_time – Maximum time the operation should be waiting.

Returns

true when the last change of the instance history is acknowleged, false when timeout is reached.