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, std::map< int, 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 optLevel, int optName)
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 62 of file ConfigPhysicalSocketClient.h.

Member Typedef Documentation

◆ Socket

◆ Super

Constructor & Destructor Documentation

◆ ConfigPhysicalSocketClient()

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

Definition at line 59 of file ConfigPhysicalSocketClient.cpp.

60 : Super(instance) {
62 "--reconnect{true}",
63 [this]() {
64 if (!this->reconnectOpt->as<bool>()) {
65 this->reconnectTimeOpt->clear();
66 }
67 },
68 "Auto-reconnection in the event of a connection interruption",
69 "bool",
70 XSTR(RECONNECT),
71 CLI::IsMember({"true", "false"}));
72
74 "--reconnect-time",
75 "Duration after disconnect before reconnect",
76 "sec",
77 RECONNECT_TIME,
78 CLI::NonNegativeNumber);
80
82 "--connect-timeout",
83 "Connect timeout",
84 "timeout",
85 CONNECT_TIMEOUT,
86 CLI::NonNegativeNumber);
87 }
#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)

References net::config::ConfigSection::addFlagFunction(), net::config::ConfigPhysicalSocket::ConfigPhysicalSocket(), reconnectOpt, and reconnectTimeOpt.

Here is the call graph for this function:

Member Function Documentation

◆ getConnectTimeout()

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

Definition at line 127 of file ConfigPhysicalSocketClient.cpp.

127 {
128 const double connectTimeout = connectTimeoutOpt->as<double>();
129 return utils::Timeval(connectTimeout);
130 }

References connectTimeoutOpt, and utils::Timeval::Timeval().

Here is the call graph for this function:

◆ getReconnect()

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

Definition at line 103 of file ConfigPhysicalSocketClient.cpp.

103 {
104 return reconnectOpt->as<bool>();
105 }

References reconnectOpt.

◆ getReconnectTime()

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

Definition at line 115 of file ConfigPhysicalSocketClient.cpp.

115 {
116 return reconnectTimeOpt->as<double>();
117 }

References reconnectTimeOpt.

◆ setConnectTimeout()

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

Definition at line 119 of file ConfigPhysicalSocketClient.cpp.

119 {
121 ->default_val(connectTimeout)
122 ->clear();
123
124 return *this;
125 }

References connectTimeoutOpt.

◆ setReconnect()

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

Definition at line 89 of file ConfigPhysicalSocketClient.cpp.

89 {
91 ->default_val(reconnect ? "true" : "false")
92 ->clear();
93
94 if (reconnect) {
95 reconnectTimeOpt->remove_needs(reconnectOpt);
96 } else {
98 }
99
100 return *this;
101 }

References reconnectOpt, and reconnectTimeOpt.

◆ setReconnectTime()

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

Definition at line 107 of file ConfigPhysicalSocketClient.cpp.

107 {
109 ->default_val(time)
110 ->clear();
111
112 return *this;
113 }

References reconnectTimeOpt.

Member Data Documentation

◆ connectTimeoutOpt

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

Definition at line 86 of file ConfigPhysicalSocketClient.h.

Referenced by getConnectTimeout(), and setConnectTimeout().

◆ reconnectOpt

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

◆ reconnectTimeOpt

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

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