Fast DDS  Version 3.0.1
Fast DDS
Loading...
Searching...
No Matches
LocatorSelector Class Reference

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

#include <LocatorSelector.hpp>

Classes

class  iterator
 
struct  IteratorIndex
 

Public Member Functions

 LocatorSelector (const ResourceLimitedContainerConfig &entries_allocation)
 Construct a LocatorSelector.
 
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.
 
void reset (bool enable_all)
 Reset the enabling state of the selector.
 
void enable (const GUID_t &guid)
 Enable an entry given its GUID.
 
bool state_has_changed () const
 Check if enabling state has changed.
 
void selection_start ()
 Reset the selection state of the selector.
 
ResourceLimitedVector< LocatorSelectorEntry * > & transport_starts ()
 Called when the selection algorithm starts for a specific transport.
 
void select (size_t index)
 Marks an entry as selected.
 
size_t selected_size () const
 Count 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.
 
template<class UnaryPredicate >
void for_each (UnaryPredicate action) const
 Performs an action on each selected locator.
 
iterator begin () const
 
iterator end () const
 

Detailed Description

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

Constructor & Destructor Documentation

◆ LocatorSelector()

LocatorSelector ( const ResourceLimitedContainerConfig entries_allocation)
inline

Construct a LocatorSelector.

Parameters
entries_allocationAllocation configuration regarding the number of remote entities.

Member Function Documentation

◆ add_entry()

bool add_entry ( LocatorSelectorEntry entry)
inline

Add an entry to this selector.

Parameters
entryPointer to the LocatorSelectorEntry to add.

◆ begin()

iterator begin ( ) const
inline

◆ clear()

void clear ( )
inline

Clears all internal data.

◆ enable()

void enable ( const GUID_t guid)
inline

Enable an entry given its GUID.

Parameters
guidGUID of the entry to enable.

◆ end()

iterator end ( ) const
inline

◆ for_each()

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

Performs an action on each selected locator.

Parameters
actionUnary 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
locatorThe 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
guidIdentifier of the entry to be removed.

◆ reset()

void reset ( bool  enable_all)
inline

Reset the enabling state of the selector.

Parameters
enable_allIndicates whether entries should be initially enabled.

◆ select()

void select ( size_t  index)
inline

Marks an entry as selected.

Parameters
indexThe 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()

void selection_start ( )
inline

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()

ResourceLimitedVector< LocatorSelectorEntry * > & transport_starts ( )
inline

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: