SNode.C
Loading...
Searching...
No Matches
net::config::ConfigPhysicalSocketClient Class Reference

#include <ConfigPhysicalSocketClient.h>

Inheritance diagram for net::config::ConfigPhysicalSocketClient:
Collaboration diagram for net::config::ConfigPhysicalSocketClient:

Public Types

using Socket = ConfigPhysicalSocketClient
 

Public Member Functions

ConfigPhysicalSocketClientsetReconnect (bool reconnect=true)
 
bool getReconnect () const
 
ConfigPhysicalSocketClientsetReconnectTime (double time)
 
double getReconnectTime () const
 
ConfigPhysicalSocketClientsetConnectTimeout (const utils::Timeval &connectTimeout)
 
utils::Timeval getConnectTimeout () const
 
- Public Member Functions inherited from net::config::ConfigPhysicalSocket
const std::map< int, const net::phy::PhysicalSocketOption > & getSocketOptions ()
 
ConfigPhysicalSocketaddSocketOption (int optLevel, int optName, int optValue)
 
ConfigPhysicalSocketaddSocketOption (int optLevel, int optName, const std::string &optValue)
 
ConfigPhysicalSocketaddSocketOption (int optLevel, int optName, const std::vector< char > &optValue)
 
ConfigPhysicalSocketremoveSocketOption (int optName)
 
ConfigPhysicalSocketsetReuseAddress (bool reuseAddress=true)
 
bool getReuseAddress () const
 
ConfigPhysicalSocketsetRetry (bool retry=true)
 
bool getRetry () const
 
ConfigPhysicalSocketsetRetryOnFatal (bool retry=true)
 
bool getRetryOnFatal () const
 
ConfigPhysicalSocketsetRetryTimeout (double sec)
 
double getRetryTimeout () const
 
ConfigPhysicalSocketsetRetryTries (unsigned int tries=0)
 
unsigned int getRetryTries () const
 
ConfigPhysicalSocketsetRetryBase (double base)
 
double getRetryBase () const
 
ConfigPhysicalSocketsetRetryLimit (unsigned int limit)
 
unsigned int getRetryLimit () const
 
ConfigPhysicalSocketsetRetryJitter (double percent)
 
double getRetryJitter () const
 

Protected Member Functions

 ConfigPhysicalSocketClient (ConfigInstance *instance)
 
- Protected Member Functions inherited from net::config::ConfigPhysicalSocket
 ConfigPhysicalSocket (ConfigInstance *instance)
 
CLI::Option * addSocketOption (const std::string &name, int optLevel, int optName, const std::string &description, const std::string &typeName, const std::string &defaultValue, const CLI::Validator &validator)
 
- Protected Member Functions inherited from net::config::ConfigSection
 ConfigSection (ConfigInstance *instance, const std::string &name, const std::string &description)
 
 ConfigSection (const ConfigSection &)=delete
 
 ConfigSection (ConfigSection &&)=delete
 
ConfigSectionoperator= (const ConfigSection &)=delete
 
ConfigSectionoperator= (ConfigSection &&)=delete
 
CLI::Option * addOption (const std::string &name, const std::string &description)
 
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName)
 
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
 
template<typename ValueTypeT >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
 
template<typename ValueTypeT >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
 
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName)
 
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator)
 
template<typename ValueTypeT >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue)
 
template<typename ValueTypeT >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator)
 
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue)
 
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue, const CLI::Validator &validator)
 
void required (CLI::Option *opt, bool req=true)
 
bool required () const
 
template<typename ValueType >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
 
template<typename ValueType >
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
 
template<typename ValueType >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
 
template<typename ValueType >
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
 

Private Types

using Super = ConfigPhysicalSocket
 

Private Attributes

CLI::Option * reconnectOpt = nullptr
 
CLI::Option * reconnectTimeOpt = nullptr
 
CLI::Option * connectTimeoutOpt = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from net::config::ConfigSection
CLI::App * section = nullptr
 

Detailed Description

Definition at line 40 of file ConfigPhysicalSocketClient.h.

Member Typedef Documentation

◆ Socket

◆ Super

Constructor & Destructor Documentation

◆ ConfigPhysicalSocketClient()

net::config::ConfigPhysicalSocketClient::ConfigPhysicalSocketClient ( ConfigInstance * instance)
explicitprotected

Definition at line 37 of file ConfigPhysicalSocketClient.cpp.

38 : Super(instance) {
40 "--reconnect{true}",
41 [this]() {
42 if (!this->reconnectOpt->as<bool>()) {
43 this->reconnectTimeOpt->clear();
44 }
45 },
46 "Auto-reconnection in the event of a connection interruption",
47 "bool",
48 XSTR(RECONNECT),
49 CLI::IsMember({"true", "false"}));
50
52 "--reconnect-time",
53 "Duration after disconnect before reconnect",
54 "sec",
55 RECONNECT_TIME,
56 CLI::NonNegativeNumber);
58
60 "--connect-timeout",
61 "Connect timeout",
62 "timeout",
63 CONNECT_TIMEOUT,
64 CLI::NonNegativeNumber);
65 }
#define XSTR(s)
CLI::Option * addOption(const std::string &name, const std::string &description)
CLI::Option * addFlagFunction(const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue)

Member Function Documentation

◆ getConnectTimeout()

utils::Timeval net::config::ConfigPhysicalSocketClient::getConnectTimeout ( ) const

Definition at line 105 of file ConfigPhysicalSocketClient.cpp.

105 {
106 const double connectTimeout = connectTimeoutOpt->as<double>();
107 return utils::Timeval(connectTimeout);
108 }

◆ getReconnect()

bool net::config::ConfigPhysicalSocketClient::getReconnect ( ) const

Definition at line 81 of file ConfigPhysicalSocketClient.cpp.

81 {
82 return reconnectOpt->as<bool>();
83 }

◆ getReconnectTime()

double net::config::ConfigPhysicalSocketClient::getReconnectTime ( ) const

Definition at line 93 of file ConfigPhysicalSocketClient.cpp.

93 {
94 return reconnectTimeOpt->as<double>();
95 }

◆ setConnectTimeout()

ConfigPhysicalSocketClient & net::config::ConfigPhysicalSocketClient::setConnectTimeout ( const utils::Timeval & connectTimeout)

Definition at line 97 of file ConfigPhysicalSocketClient.cpp.

97 {
99 ->default_val(connectTimeout)
100 ->clear();
101
102 return *this;
103 }

◆ setReconnect()

ConfigPhysicalSocketClient & net::config::ConfigPhysicalSocketClient::setReconnect ( bool reconnect = true)

Definition at line 67 of file ConfigPhysicalSocketClient.cpp.

67 {
69 ->default_val(reconnect ? "true" : "false")
70 ->clear();
71
72 if (reconnect) {
73 reconnectTimeOpt->remove_needs(reconnectOpt);
74 } else {
76 }
77
78 return *this;
79 }

◆ setReconnectTime()

ConfigPhysicalSocketClient & net::config::ConfigPhysicalSocketClient::setReconnectTime ( double time)

Definition at line 85 of file ConfigPhysicalSocketClient.cpp.

85 {
87 ->default_val(time)
88 ->clear();
89
90 return *this;
91 }

Member Data Documentation

◆ connectTimeoutOpt

CLI::Option* net::config::ConfigPhysicalSocketClient::connectTimeoutOpt = nullptr
private

Definition at line 64 of file ConfigPhysicalSocketClient.h.

◆ reconnectOpt

CLI::Option* net::config::ConfigPhysicalSocketClient::reconnectOpt = nullptr
private

Definition at line 61 of file ConfigPhysicalSocketClient.h.

◆ reconnectTimeOpt

CLI::Option* net::config::ConfigPhysicalSocketClient::reconnectTimeOpt = nullptr
private

Definition at line 62 of file ConfigPhysicalSocketClient.h.


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