Class LocatorSelector
Defined in File LocatorSelector.hpp
Nested Relationships
Nested Types
Class Documentation
-
class LocatorSelector
A class used for the efficient selection of locators when sending data to multiple entities.
Algorithm:
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.
- Parameters
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.
- Parameters
entry – Pointer to the LocatorSelectorEntry to add.
-
inline bool remove_entry(const GUID_t &guid)
Remove an entry from this selector.
- Parameters
guid – Identifier of the entry to be removed.
-
inline void reset(bool enable_all)
Reset the enabling state of the selector.
- Parameters
enable_all – Indicates whether entries should be initially enabled.
-
inline void enable(const GUID_t &guid)
Enable an entry given its GUID.
- Parameters
guid – GUID of the entry to enable.
-
inline bool state_has_changed() const
Check if enabling state has changed.
- Returns
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.
- Returns
a reference to the entries collection.
-
inline void select(size_t index)
Marks an entry as selected.
- Parameters
index – The index of the entry to mark as selected.
-
inline size_t selected_size() const
Count the number of selected locators.
- Returns
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.
- Parameters
locator – The locator to be checked.
- Returns
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.
- Parameters
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 explicit iterator(const LocatorSelector &locator_selector, Position index_pos)
-
inline virtual iterator &operator++()
Increment operator.
- Returns
LocatorsIterator& reference to the next LocatorsIterator.
-
inline virtual bool operator==(const LocatorsIterator &other) const
Equal to operator.
- Parameters
other – LocatorsIterator to compare.
- Returns
true if equal.
- Returns
false otherwise.
-
inline virtual bool operator!=(const LocatorsIterator &other) const
Not equal to operator.
- Parameters
other – LocatorsIterator to compare.
- Returns
true if not equal.
- Returns
false otherwise.
-
inline pointer operator->() const
-
inline virtual reference operator*() const
Dereference operator.
- Returns
const Locator& Reference to the locator pointed by the LocatorsIterator.
-
inline explicit iterator(const LocatorSelector &locator_selector, Position index_pos)
-
struct IteratorIndex