$darkmode
cloe::utility::TcpTransceiverFactory< T > Class Template Referenceabstract

#include <tcp_transceiver.hpp>

Inheritance diagram for cloe::utility::TcpTransceiverFactory< T >:
Collaboration diagram for cloe::utility::TcpTransceiverFactory< T >:

Public Member Functions

 TcpTransceiverFactory (int attempts, std::chrono::duration< float > delay)
 
 TcpTransceiverFactory (const TcpTransceiverConfiguration &c)
 
 TcpTransceiverFactory (TcpTransceiverConfiguration &&c)
 
int retry_attempts () const
 
void set_retry_attempts (int attempts)
 
std::chrono::duration< float > retry_delay () const
 
void set_retry_delay (std::chrono::duration< float > delay)
 
std::unique_ptr< T > create_or_null (const std::string &host, uint16_t port) const
 
std::unique_ptr< T > create_or_throw (const std::string &host, uint16_t port) const
 
std::unique_ptr< T > create_or_throw (const std::string &host, uint16_t port, AbortFlag &sig) const
 

Protected Member Functions

virtual Logger factory_logger () const =0
 
virtual const char * instance_name () const =0
 

Protected Attributes

TcpTransceiverConfiguration config_
 

Friends

void to_json (Json &j, const TcpTransceiverFactory< T > &f)
 
void from_json (const Json &j, TcpTransceiverFactory< T > &f)
 

Detailed Description

template<typename T>
class cloe::utility::TcpTransceiverFactory< T >

TcpTransceiverFactory helps you create TcpTransceiver types by retrying connection attempts a configurable number of times.

There are two values that can currently be configured: retry attempts and retry delay.

Retry attempts (retry_attempts) is the number of attempts to retry after connection failure. The value 0 indicates no attempts and is effectively the same as not using this factory. Any negative value indicates an infinite number of connection attempts; this is not recommended, but can be useful in certain circumstances.

The retry delay (retry_delay) is fraction of time in seconds that should be waited between connection attempts. The value 0 indicates that no time is waited, and is not recommended, as this can tie up your system.

Member Function Documentation

◆ create_or_null()

template<typename T >
std::unique_ptr<T> cloe::utility::TcpTransceiverFactory< T >::create_or_null ( const std::string &  host,
uint16_t  port 
) const
inline

Create a TcpTransceiver derived type or return nullptr.

◆ create_or_throw() [1/2]

template<typename T >
std::unique_ptr<T> cloe::utility::TcpTransceiverFactory< T >::create_or_throw ( const std::string &  host,
uint16_t  port 
) const
inline

Create an RdbTranscieverTcp or throw a std::ios_base::failure.

◆ create_or_throw() [2/2]

template<typename T >
std::unique_ptr<T> cloe::utility::TcpTransceiverFactory< T >::create_or_throw ( const std::string &  host,
uint16_t  port,
AbortFlag sig 
) const
inline

Create an RdbTranscieverTcp or throw a std::ios_base::failure.

If an abort is signalled, an AsyncAbort is thrown.


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