class eprosima::fastrtps::rtps::LocatorSelector

A class used for the efficient selection of locators when sending data to multiple entities.


  • Entries are added/removed with add_entry/remove_entry when matched/unmatched.

  • When data is to be sent:

    • A reference to this object is passed to the message group

    • For each submessage:

      • A call to reset is performed

      • A call to enable is performed per desired destination

      • If state_has_changed() returns true:

        • the message group is flushed

        • selection_start is called

        • for each transport:

          • transport_starts is called

          • transport handles the selection state of each entry

          • select may be called

      • Submessage is added to the message group

Public Functions

LocatorSelector(const ResourceLimitedContainerConfig &entries_allocation)

Construct a LocatorSelector.

  • entries_allocation: Allocation configuration regarding the number of remote entities.

void clear()

Clears all internal data.

bool add_entry(LocatorSelectorEntry *entry)

Add an entry to this selector.


bool remove_entry(const GUID_t &guid)

Remove an entry from this selector.

  • guid: Identifier of the entry to be removed.

void reset(bool enable_all)

Reset the enabling state of the selector.

  • enable_all: Indicates whether entries should be initially enabled.

void enable(const GUID_t &guid)

Enable an entry given its GUID.

  • guid: GUID of the entry to enable.

bool state_has_changed() const

Check if enabling state has changed.


true if the enabling state has changed, false otherwise.

void selection_start()

Reset the selection state of the selector.

ResourceLimitedVector<LocatorSelectorEntry*> &transport_starts()

Called when the selection algorithm starts for a specific transport.

Will set the temporary transport_should_process flag for all enabled entries.


a reference to the entries collection.

void select(size_t index)

Marks an entry as selected.

  • index: The index of the entry to mark as selected.

size_t selected_size() const

Count the number of selected locators.


the number of selected locators.

bool is_selected(const Locator_t locator) const

Check if a locator is present in the selections of this object.


True if the locator has been selected, false otherwise.

  • locator: The locator to be checked.

template<class UnaryPredicate>
void for_each(UnaryPredicate action) const

Performs an action on each selected locator.

  • action: Unary function that accepts a locator as argument. The function shall not modify its argument. This can either be a function pointer or a function object.

class iterator : public eprosima::fastdds::rtps::LocatorsIterator
struct IteratorIndex