class 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

inline LocatorSelector(const ResourceLimitedContainerConfig &entries_allocation)

Construct a LocatorSelector.


entries_allocation – Allocation configuration regarding the number of remote entities.

inline void clear()

Clears all internal data.

inline bool add_entry(LocatorSelectorEntry *entry)

Add an entry to this selector.


entry – Pointer to the LocatorSelectorEntry to add.

inline bool remove_entry(const GUID_t &guid)

Remove an entry from this selector.


guid – Identifier of the entry to be removed.

inline void reset(bool enable_all)

Reset the enabling state of the selector.


enable_all – Indicates whether entries should be initially enabled.

inline void enable(const GUID_t &guid)

Enable an entry given its GUID.


guid – GUID of the entry to enable.

inline bool state_has_changed() const

Check if enabling state has changed.


true if the enabling state has changed, false otherwise.

inline void selection_start()

Reset the selection state of the selector.

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

inline void select(size_t index)

Marks an entry as selected.


index – The index of the entry to mark as selected.

inline size_t selected_size() const

Count the number of selected locators.


the number of selected locators.

inline bool is_selected(const Locator_t locator) const

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


locator – The locator to be checked.


True if the locator has been selected, false otherwise.

template<class UnaryPredicate>
inline 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

Public Functions

inline virtual iterator &operator++()

Increment operator.


LocatorsIterator& reference to the next LocatorsIterator.

inline virtual bool operator==(const LocatorsIterator &other) const

Equal to operator.


otherLocatorsIterator to compare.


true if equal.


false otherwise.

inline virtual bool operator!=(const LocatorsIterator &other) const

Not equal to operator.


otherLocatorsIterator to compare.


true if not equal.


false otherwise.

inline virtual reference operator*() const

Dereference operator.


const Locator& Reference to the locator pointed by the LocatorsIterator.

struct IteratorIndex