5 #ifndef _DDS_BOOSTHELPER_H_ 6 #define _DDS_BOOSTHELPER_H_ 11 #include <boost/format.hpp> 12 #include <boost/program_options/variables_map.hpp> 18 std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
19 std::time_t nowTimeT = std::chrono::system_clock::to_time_t(now);
20 struct std::tm* ptm = std::localtime(&nowTimeT);
22 std::strftime(buffer, 128,
"%Y-%m-%d-%H-%M-%S-", ptm);
23 std::chrono::milliseconds ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
24 std::stringstream timeSS;
25 timeSS << _prefix <<
"_" << buffer << boost::format(
"%03i") % (ms.count() % 1000);
44 if (_vm.count(_opt1) && !_vm[_opt1].defaulted() && _vm.count(_opt2) && !_vm[_opt2].defaulted())
46 std::string str(
"Command line parameter \"%1\" conflicts with \"%2\"");
47 replace<std::string>(&str,
"%1", _opt1);
48 replace<std::string>(&str,
"%2", _opt2);
49 throw std::runtime_error(str);
64 const char* _for_what,
65 const char* _required_option)
67 if (_vm.count(_for_what) && !_vm[_for_what].defaulted() &&
68 (!_vm.count(_required_option) || _vm[_required_option].defaulted()))
70 std::string str(
"Command line parameter \"%1\" must be used with \"%2\"");
71 replace<std::string>(&str,
"%1", _for_what);
72 replace<std::string>(&str,
"%2", _required_option);
73 throw std::runtime_error(str);
void conflicting_options(const boost::program_options::variables_map &_vm, const char *_opt1, const char *_opt2)
The conflicting_options function used to check that 'opt1' and 'opt2' are not specified at the same t...
Definition: BoostHelper.h:40
std::string get_temp_dir(const std::string &_prefix)
Definition: BoostHelper.h:16
void option_dependency(const boost::program_options::variables_map &_vm, const char *_for_what, const char *_required_option)
The option_dependency function used to check that if 'for_what' is specified, then 'required_option' ...
Definition: BoostHelper.h:63
Definition: BoostHelper.h:14