11#include " broker_config.h"
22
3- broker_config::broker_config ()
4- {
5- }
63
74broker_config::broker_config (const YAML::Node &config)
85{
@@ -17,7 +14,7 @@ broker_config::broker_config(const YAML::Node &config)
1714 client_address_ = config[" clients" ][" address" ].as <std::string>();
1815 } // no throw... can be omitted
1916 if (config[" clients" ][" port" ] && config[" clients" ][" port" ].IsScalar ()) {
20- client_port_ = config[" clients" ][" port" ].as <uint16_t >();
17+ client_port_ = config[" clients" ][" port" ].as <std:: uint16_t >();
2118 } // no throw... can be omitted
2219 }
2320
@@ -27,16 +24,16 @@ broker_config::broker_config(const YAML::Node &config)
2724 worker_address_ = config[" workers" ][" address" ].as <std::string>();
2825 } // no throw... can be omitted
2926 if (config[" workers" ][" port" ] && config[" workers" ][" port" ].IsScalar ()) {
30- worker_port_ = config[" workers" ][" port" ].as <uint16_t >();
27+ worker_port_ = config[" workers" ][" port" ].as <std:: uint16_t >();
3128 } // no throw... can be omitted
3229 if (config[" workers" ][" max_liveness" ] && config[" workers" ][" max_liveness" ].IsScalar ()) {
33- max_worker_liveness_ = config[" workers" ][" max_liveness" ].as <size_t >();
30+ max_worker_liveness_ = config[" workers" ][" max_liveness" ].as <std:: size_t >();
3431 } // no throw... can be omitted
3532 if (config[" workers" ][" max_request_failures" ] && config[" workers" ][" max_request_failures" ].IsScalar ()) {
36- max_request_failures_ = config[" workers" ][" max_request_failures" ].as <size_t >();
33+ max_request_failures_ = config[" workers" ][" max_request_failures" ].as <std:: size_t >();
3734 } // no throw... can be omitted
3835 if (config[" workers" ][" ping_interval" ] && config[" workers" ][" ping_interval" ].IsScalar ()) {
39- worker_ping_interval_ = std::chrono::milliseconds (config[" workers" ][" ping_interval" ].as <size_t >());
36+ worker_ping_interval_ = std::chrono::milliseconds (config[" workers" ][" ping_interval" ].as <std:: size_t >());
4037 } // no throw... can be omitted
4138 }
4239
@@ -46,7 +43,7 @@ broker_config::broker_config(const YAML::Node &config)
4643 monitor_address_ = config[" monitor" ][" address" ].as <std::string>();
4744 } // no throw... can be omitted
4845 if (config[" monitor" ][" port" ] && config[" monitor" ][" port" ].IsScalar ()) {
49- monitor_port_ = config[" monitor" ][" port" ].as <uint16_t >();
46+ monitor_port_ = config[" monitor" ][" port" ].as <std:: uint16_t >();
5047 } // no throw... can be omitted
5148 }
5249
@@ -56,7 +53,7 @@ broker_config::broker_config(const YAML::Node &config)
5653 notifier_config_.address = config[" notifier" ][" address" ].as <std::string>();
5754 } // no throw... can be omitted
5855 if (config[" notifier" ][" port" ] && config[" notifier" ][" port" ].IsScalar ()) {
59- notifier_config_.port = config[" notifier" ][" port" ].as <uint16_t >();
56+ notifier_config_.port = config[" notifier" ][" port" ].as <std:: uint16_t >();
6057 } // no throw... can be omitted
6158 if (config[" notifier" ][" username" ] && config[" notifier" ][" username" ].IsScalar ()) {
6259 notifier_config_.username = config[" notifier" ][" username" ].as <std::string>();
@@ -77,10 +74,10 @@ broker_config::broker_config(const YAML::Node &config)
7774 log_config_.log_level = config[" logger" ][" level" ].as <std::string>();
7875 } // no throw... can be omitted
7976 if (config[" logger" ][" max-size" ] && config[" logger" ][" max-size" ].IsScalar ()) {
80- log_config_.log_file_size = config[" logger" ][" max-size" ].as <size_t >();
77+ log_config_.log_file_size = config[" logger" ][" max-size" ].as <std:: size_t >();
8178 } // no throw... can be omitted
8279 if (config[" logger" ][" rotations" ] && config[" logger" ][" rotations" ].IsScalar ()) {
83- log_config_.log_files_count = config[" logger" ][" rotations" ].as <size_t >();
80+ log_config_.log_files_count = config[" logger" ][" rotations" ].as <std:: size_t >();
8481 } // no throw... can be omitted
8582 } // no throw... can be omitted
8683 } catch (YAML::Exception &ex) {
@@ -93,7 +90,7 @@ const std::string &broker_config::get_client_address() const
9390 return client_address_;
9491}
9592
96- uint16_t broker_config::get_client_port () const
93+ std:: uint16_t broker_config::get_client_port () const
9794{
9895 return client_port_;
9996}
@@ -103,7 +100,7 @@ const std::string &broker_config::get_worker_address() const
103100 return worker_address_;
104101}
105102
106- uint16_t broker_config::get_worker_port () const
103+ std:: uint16_t broker_config::get_worker_port () const
107104{
108105 return worker_port_;
109106}
@@ -113,12 +110,12 @@ const std::string &broker_config::get_monitor_address() const
113110 return monitor_address_;
114111}
115112
116- uint16_t broker_config::get_monitor_port () const
113+ std:: uint16_t broker_config::get_monitor_port () const
117114{
118115 return monitor_port_;
119116}
120117
121- size_t broker_config::get_max_worker_liveness () const
118+ std:: size_t broker_config::get_max_worker_liveness () const
122119{
123120 return max_worker_liveness_;
124121}
@@ -138,7 +135,11 @@ const notifier_config &broker_config::get_notifier_config() const
138135 return notifier_config_;
139136}
140137
141- size_t broker_config::get_max_request_failures () const
138+ std:: size_t broker_config::get_max_request_failures () const
142139{
143140 return max_request_failures_;
144141}
142+
143+ config_error::config_error (const std::string &msg) : std::runtime_error(msg)
144+ {
145+ }
0 commit comments