A class used for the efficient selection of locators when sending data to multiple entities.
More...
#include <LocatorSelector.hpp>
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
◆ LocatorSelector()
Construct a LocatorSelector.
- Parameters
-
entries_allocation | Allocation configuration regarding the number of remote entities. |
◆ add_entry()
Add an entry to this selector.
- Parameters
-
◆ begin()
◆ clear()
Clears all internal data.
◆ enable()
void enable |
( |
const GUID_t & |
guid | ) |
|
|
inline |
Enable an entry given its GUID.
- Parameters
-
guid | GUID of the entry to enable. |
◆ end()
◆ for_each()
template<class UnaryPredicate >
void for_each |
( |
UnaryPredicate |
action | ) |
const |
|
inline |
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. |
◆ is_selected()
bool is_selected |
( |
const Locator_t |
locator | ) |
const |
|
inline |
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.
◆ remove_entry()
bool remove_entry |
( |
const GUID_t & |
guid | ) |
|
|
inline |
Remove an entry from this selector.
- Parameters
-
guid | Identifier of the entry to be removed. |
◆ reset()
void reset |
( |
bool |
enable_all | ) |
|
|
inline |
Reset the enabling state of the selector.
- Parameters
-
enable_all | Indicates whether entries should be initially enabled. |
◆ select()
void select |
( |
size_t |
index | ) |
|
|
inline |
Marks an entry as selected.
- Parameters
-
index | The index of the entry to mark as selected. |
◆ selected_size()
size_t selected_size |
( |
| ) |
const |
|
inline |
Count the number of selected locators.
- Returns
- the number of selected locators.
◆ selection_start()
Reset the selection state of the selector.
◆ state_has_changed()
bool state_has_changed |
( |
| ) |
const |
|
inline |
Check if enabling state has changed.
- Returns
- true if the enabling state has changed, false otherwise.
◆ 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.
The documentation for this class was generated from the following file: