#include <cstdint>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <boost/current_function.hpp>
#include <boost/program_options.hpp>
using boost::program_options::bool_switch;
using boost::program_options::value;
namespace Examples {
logger.info("Test of Message");
logger2.info("Test2 of Message");
logger3.info("Test3 of Message");
}
public:
bool flag = false;
config_options.add_options()("int-option", value<int>()->default_value(int{111}), "An example int option")(
"int-option-with-default-and-default-in-conf", value<int>()->default_value(int{222}), "An example int option")(
"int-option-with-default-no-default-in-conf", value<int>()->default_value(int{444}),
"An example int option")("int-option-no-default-not-defined-in-conf", value<int>(), "An example int option")(
"int-option-with-no-defaults-anywhere", value<int>(),
"An example int option")("string-option", value<string>()->default_value(string{}), "An example string option")(
"boolean-option", value<bool>()->default_value(false), "An example boolean option")(
"flag,f", bool_switch(&flag), "An option to set to true")("string-option-no-default", value<string>(),
"A string option without default value")(
"long-long-option", value<int64_t>()->default_value(int64_t{}), "An example long long option")(
"double-option", value<double>()->default_value(double{}), "An example double option")(
"int-vector-option", value<vector<int>>()->multitoken()->default_value(vector<int>{}, "Empty"),
"An example vector option")("threshold,t", value<double>()->default_value(double{0.5}),
"An example double option");
return config_options;
}
log.info(
"Entering mainMethod()");
if (args["string-option-no-default"].empty()) {
log.info() <<
"No value are available for string-option-no-default";
}
string string_example{args["string-option"].as<string>()};
log.info() <<
"String option value: " << string_example;
log.info() <<
"The int-option value is " << args[
"int-option"].as<
int>();
log.info() <<
"The threshold value is " << args[
"threshold"].as<
double>();
double input_variable = 3.4756;
int64_t source_id = 12345;
double ra = 45.637;
double method_result = example_class_object.fundamentalTypeMethod(input_variable);
log.info() <<
"Some result: " << method_result;
double first = 1.0;
double division_result{};
try {
log.info(
"# Calling a method throwing an exception ");
division_result = example_class_object.divideNumbers(first,
second);
}
catch (
const Exception&
e) {
log.info(
"# In this silly example we continue with a fake fix ");
division_result = example_class_object.divideNumbers(first, 0.000001);
}
log.info() <<
"Second result is: " << division_result;
example_class_object.passingUniquePointer(
std::move(vector_unique_ptr));
vector<double> object_example{vector<double>{1.0, 2.3, 4.5}};
example_class_object.passingObjectInGeneral(object_example);
log.info(
"Exiting mainMethod()");
}
};
}
}