mavtables  0.2.1
MAVLink router and firewall.
Public Member Functions | List of all members
AddressPool< TC > Class Template Reference

#include <AddressPool.hpp>

Inheritance diagram for AddressPool< TC >:
Inheritance graph
Collaboration diagram for AddressPool< TC >:
Collaboration graph

Public Member Functions

 AddressPool (std::chrono::milliseconds timeout=std::chrono::milliseconds(120000))
 
TEST_VIRTUAL ~AddressPool ()=default
 
TEST_VIRTUAL void add (MAVAddress address)
 
TEST_VIRTUAL std::vector< MAVAddressaddresses ()
 
TEST_VIRTUAL bool contains (const MAVAddress &address)
 

Detailed Description

template<class TC = std::chrono::steady_clock>
class AddressPool< TC >

A threadsafe container for addresses that expire after a given time.

Definition at line 34 of file AddressPool.hpp.

Constructor & Destructor Documentation

◆ AddressPool()

template<class TC >
AddressPool< TC >::AddressPool ( std::chrono::milliseconds  timeout = std::chrono::milliseconds(120000))

Construct a new address pool.

Parameters
timeoutThe amount of time (in milliseconds) before a component will be considered offline and removed from the pool, unless its time is updated with add.

Definition at line 60 of file AddressPool.hpp.

◆ ~AddressPool()

template<class TC = std::chrono::steady_clock>
TEST_VIRTUAL AddressPool< TC >::~AddressPool ( )
default

Member Function Documentation

◆ add()

template<class TC >
void AddressPool< TC >::add ( MAVAddress  address)

Add a MAVLink address to the pool.

Note
Addresses will be removed after the timeout (set in the constructor) has run out. Re-adding the address (even before this time runs out) will reset the timeout.
Parameters
addressThe MAVLink address to add or update the timeout for.
Remarks
Threadsafe (locking).

Definition at line 77 of file AddressPool.hpp.

◆ addresses()

template<class TC >
std::vector< MAVAddress > AddressPool< TC >::addresses ( )

Get a vector of all the addresses in the pool.

Note
A copy is returned instead of using iterators in order to make the call thread safe.
Returns
A vector of the addresses in the pool.
Remarks
Threadsafe (locking).

Definition at line 94 of file AddressPool.hpp.

◆ contains()

template<class TC >
bool AddressPool< TC >::contains ( const MAVAddress address)

Determine if the pool contains a given MAVLink address.

Parameters
addressThe MAVLink address to test for.
Return values
trueIf the pool contains address.
falseIf the pool does not contain address.
Remarks
Threadsafe (locking).

Definition at line 129 of file AddressPool.hpp.


The documentation for this class was generated from the following file: