Class LivelinessManager

Class Documentation

class LivelinessManager

A class managing the liveliness of a set of writers. Writers are represented by their LivelinessData.

Uses a shared timed event and informs outside classes on liveliness changes

Public Functions

LivelinessManager(const LivelinessCallback &callback, ResourceEvent &service, bool manage_automatic = true)

Constructor.

Parameters:
  • callback – A callback that will be invoked when a writer changes its liveliness status

  • serviceResourceEvent object that will operate with the events.

  • manage_automatic – True to manage writers with automatic liveliness, false otherwise

~LivelinessManager()

Constructor.

LivelinessManager(const LivelinessManager &other) = delete

LivelinessManager.

Parameters:

other

bool add_writer(GUID_t guid, LivelinessQosPolicyKind kind, Duration_t lease_duration)

Adds a writer to the set.

Parameters:
  • guid – GUID of the writer

  • kind – Liveliness kind

  • lease_duration – Liveliness lease duration

Returns:

True if the writer was successfully added

bool remove_writer(GUID_t guid, LivelinessQosPolicyKind kind, Duration_t lease_duration)

Removes a writer.

Parameters:
  • guid – GUID of the writer

  • kind – Liveliness kind

  • lease_duration – Liveliness lease duration

Returns:

True if the writer was successfully removed

bool assert_liveliness(GUID_t guid, LivelinessQosPolicyKind kind, Duration_t lease_duration)

Asserts liveliness of a writer in the set.

Parameters:
  • guid – The writer to assert liveliness of

  • kind – The kind of the writer

  • lease_duration – The lease duration

Returns:

True if liveliness was successfully asserted

bool assert_liveliness(LivelinessQosPolicyKind kind, GuidPrefix_t guid_prefix)

Asserts liveliness of writers with given liveliness kind and GuidPrefix.

Parameters:
  • kind – Liveliness kind

  • guid_prefix – The guid prefix of the writers to assert liveliness of

Returns:

True if liveliness was successfully asserted

bool is_any_alive(LivelinessQosPolicyKind kind)

A method to check any writer of the given kind is alive.

Parameters:

kind – The liveliness kind to check for

Returns:

True if at least one writer of this kind is alive. False otherwise

const ResourceLimitedVector<LivelinessData> &get_liveliness_data() const

A method to return liveliness data.

Should only be used for testing purposes

Returns:

Vector of liveliness data