#include <ConnectionFactory.hpp>
template<class C = Connection, class AP = AddressPool<>, class PQ = PacketQueue>
class ConnectionFactory< C, AP, PQ >
A factory for making related connections that use a common semaphore.
Definition at line 36 of file ConnectionFactory.hpp.
◆ ConnectionFactory()
template<class C , class AP , class PQ >
Construct a connection factory.
- Template Parameters
-
C | The Connection class (or derived class) to use. |
AP | The AddressPool class (or derived class) to use. |
PQ | The PacketQueue class (or derived class) to use, must accept a callback function in it's constructor. |
- Parameters
-
filter | The packet filter to use for determining whether and with what priority to add a packet to the queue for transmission. This will be given to each constructed Connection. Cannot be nullptr. |
mirror | Set to true if all Connection's made by this factory are to be mirror connections. A mirror connection is one that will receive all packets, regardless of destination address. The default is false. |
- Exceptions
-
std::invalid_argument | if the given filter pointer is null. |
Definition at line 67 of file ConnectionFactory.hpp.
◆ ~ConnectionFactory()
template<class C = Connection, class AP = AddressPool<>, class PQ = PacketQueue>
◆ get()
template<class C , class AP , class PQ >
std::unique_ptr< C > ConnectionFactory< C, AP, PQ >::get |
( |
std::string |
name = "unknown" | ) |
|
Construct and return a new connection.
This connection will share a common semaphore with all other connections made by this factory instance.
- Parameters
-
name | The name of the new connection. |
- Returns
- The new connection.
Definition at line 87 of file ConnectionFactory.hpp.
◆ wait_for_packet()
template<class C , class AP , class PQ >
bool ConnectionFactory< C, AP, PQ >::wait_for_packet |
( |
const std::chrono::nanoseconds & |
timeout | ) |
|
Wait for a packet to be available on any connection made by this factory.
- Parameters
-
timeout | How long to block waiting for a packet. Set to 0s for non blocking. |
- Return values
-
true | There is a packet on at lest one of the connections created by this factory instance. |
false | The wait timed out, there is no packet available on any of the connections created by this factory instance. |
Definition at line 109 of file ConnectionFactory.hpp.
The documentation for this class was generated from the following file: