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 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 () const
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
template<typename ConcretConfigPhysicalSocket>
 ConfigPhysicalSocket (ConfigInstance *instance, ConcretConfigPhysicalSocket *section)
Public Member Functions inherited from net::config::ConfigSection
template<typename T>
 ConfigSection (ConfigInstance *instance, T *sectionPtr, const std::string &group="Sections")
 ~ConfigSection () override
 ConfigSection (const ConfigSection &)=delete
 ConfigSection (ConfigSection &&)=delete
ConfigSectionoperator= (const ConfigSection &)=delete
Public Member Functions inherited from utils::SubCommand
 SubCommand (const SubCommand &)=delete
 SubCommand (SubCommand &&)=delete
SubCommandoperator= (const SubCommand &)=delete
SubCommandoperator= (SubCommand &&)=delete
virtual ~SubCommand ()
std::string getName () const
std::string version () const
void parse (int argc, char *argv[])
CLI::Option * setConfig (const std::string &defaultConfigFile) const
CLI::Option * setLogFile (const std::string &defaultLogFile) const
CLI::Option * setVersionFlag (const std::string &version) const
bool hasParent () const
SubCommandgetParent ()
SubCommandallowExtras (bool allow=true)
SubCommandrequired (bool required=true, bool force=true)
SubCommandrequired (SubCommand *subCommand, bool required=true)
SubCommandrequired (CLI::Option *option, bool required=true)
SubCommandneeds (SubCommand *subCommand, bool needs=true)
SubCommanddisabled (SubCommand *subCommand, bool disabled=true)
SubCommandsetRequireCallback (const std::function< void(void)> &callback)
SubCommandfinalCallback (const std::function< void()> &finalCallback)
std::string configToStr () const
std::string help (const CLI::App *helpApp, const CLI::AppFormatMode &mode) const
template<typename NewSubCommand, typename... Args>
NewSubCommand * newSubCommand (Args &&... args)
template<typename RequestedSubCommand>
RequestedSubCommand * getSubCommand ()
template<typename RequestedSubCommand>
RequestedSubCommand * getSubCommand () const
CLI::Option * getOption (const std::string &name) const
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addOptionVariable (const std::string &name, ValueTypeT &variable, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator) const
template<typename ValueTypeT>
CLI::Option * addOptionVariable (const std::string &name, ValueTypeT &variable, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator) const
CLI::Option * addOptionFunction (const std::string &name, std::function< void(const std::string &)> &callback, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addOptionFunction (const std::string &name, std::function< void(const std::string &)> &callback, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const CLI::Validator &validator)
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)

Protected Member Functions

 ConfigPhysicalSocketClient (ConfigInstance *instance)
 ~ConfigPhysicalSocketClient () override
Protected Member Functions inherited from net::config::ConfigPhysicalSocket
template<typename ConcretConfigPhysicalSocketT>
 ConfigPhysicalSocket (ConfigInstance *instance, ConcretConfigPhysicalSocketT *section)
 ~ConfigPhysicalSocket () override
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 utils::SubCommand
 SubCommand (SubCommand *parent, std::shared_ptr< utils::AppWithPtr > appWithPtr, const std::string &group, bool final)
template<typename ConcretSubCommand>
 SubCommand (SubCommand *parent, ConcretSubCommand *concretSubCommand, const std::string &group, bool final=true)
SubCommanddescription (const std::string &description)
SubCommandfooter (const std::string &footer)
template<typename ValueTypeT>
CLI::Option * setDefaultValue (CLI::Option *option, const ValueTypeT &value, bool clear=true) const
CLI::Option * setConfigurable (CLI::Option *option, bool configurable) const

Private Types

using Super = ConfigPhysicalSocket

Private Attributes

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

Additional Inherited Members

Static Public Member Functions inherited from utils::SubCommand
static CLI::App * getHelpTriggerApp ()
static CLI::App * getShowConfigTriggerApp ()
static CLI::App * getCommandlineTriggerApp ()
Static Public Attributes inherited from net::config::ConfigPhysicalSocket
static constexpr std::string_view NAME {"socket"}
static constexpr std::string_view DESCRIPTION {"Configuration of socket behavior"}
Static Public Attributes inherited from utils::SubCommand
static std::shared_ptr< CLI::Formatter > sectionFormatter = makeSectionFormatter()
Static Protected Attributes inherited from utils::SubCommand
static std::map< std::string, std::string > aliases
static CLI::App * helpTriggerApp = nullptr
static CLI::App * showConfigTriggerApp = nullptr
static CLI::App * commandlineTriggerApp = nullptr

Detailed Description

Definition at line 60 of file ConfigPhysicalSocketClient.h.

Member Typedef Documentation

◆ Super

Constructor & Destructor Documentation

◆ ConfigPhysicalSocketClient()

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

Definition at line 59 of file ConfigPhysicalSocketClient.cpp.

60 : ConfigPhysicalSocket(instance, this) {
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)
ConfigPhysicalSocket(ConfigInstance *instance, ConcretConfigPhysicalSocketT *section)
CLI::Option * addFlagFunction(const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const CLI::Validator &validator)
CLI::Option * addOption(const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const

References utils::SubCommand::addFlagFunction(), net::config::ConfigPhysicalSocket::ConfigPhysicalSocket(), connectTimeoutOpt, reconnectOpt, and reconnectTimeOpt.

Here is the call graph for this function:

◆ ~ConfigPhysicalSocketClient()

net::config::ConfigPhysicalSocketClient::~ConfigPhysicalSocketClient ( )
overrideprotected

Definition at line 89 of file ConfigPhysicalSocketClient.cpp.

89 {
90 }

Member Function Documentation

◆ getConnectTimeout()

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

Definition at line 124 of file ConfigPhysicalSocketClient.cpp.

124 {
125 return utils::Timeval(connectTimeoutOpt->as<double>());
126 }

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

Here is the call graph for this function:

◆ getReconnect()

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

Definition at line 104 of file ConfigPhysicalSocketClient.cpp.

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

References reconnectOpt.

◆ getReconnectTime()

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

Definition at line 114 of file ConfigPhysicalSocketClient.cpp.

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

References reconnectTimeOpt.

◆ setConnectTimeout()

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

Definition at line 118 of file ConfigPhysicalSocketClient.cpp.

118 {
119 setDefaultValue(connectTimeoutOpt, connectTimeout);
120
121 return *this;
122 }
CLI::Option * setDefaultValue(CLI::Option *option, const ValueTypeT &value, bool clear=true) const
Definition SubCommand.h:337

References connectTimeoutOpt, and utils::SubCommand::setDefaultValue().

Here is the call graph for this function:

◆ setReconnect()

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

Definition at line 92 of file ConfigPhysicalSocketClient.cpp.

92 {
93 setDefaultValue(reconnectOpt, reconnect ? "true" : "false");
94
95 if (reconnect) {
96 reconnectTimeOpt->remove_needs(reconnectOpt);
97 } else {
99 }
100
101 return *this;
102 }

References reconnectOpt, reconnectTimeOpt, and utils::SubCommand::setDefaultValue().

Here is the call graph for this function:

◆ setReconnectTime()

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

Definition at line 108 of file ConfigPhysicalSocketClient.cpp.

108 {
110
111 return *this;
112 }

References reconnectTimeOpt, and utils::SubCommand::setDefaultValue().

Here is the call graph for this function:

Member Data Documentation

◆ connectTimeoutOpt

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

◆ 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: