add function helpers for FairProgOptions which simplify FairProgOptions.cxx

This commit is contained in:
NicolasWinckler
2015-11-09 12:18:34 +01:00
committed by Mohammad Al-Turany
parent 13d3729fec
commit 819a8df952
3 changed files with 237 additions and 167 deletions

View File

@@ -18,7 +18,7 @@
#include "FairMQLogger.h"
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include "FairProgOptionsHelper.h"
#include <string>
#include <vector>
#include <iostream>
@@ -55,12 +55,6 @@
* }
*/
template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v)
{
std::copy(v.begin(), v.end(), std::ostream_iterator<T>(os, " "));
return os;
}
namespace po = boost::program_options;
namespace fs = boost::filesystem;
@@ -165,19 +159,6 @@ class FairProgOptions
VarValInfo_t GetVariableValueInfo(const po::variable_value& varValue);
template<typename T>
std::string VariableValueToString(const po::variable_value& varValue)
{
auto& value = varValue.value();
std::ostringstream ostr;
if (auto q = boost::any_cast<T>(&value))
{
ostr << *q;
}
std::string valStr = ostr.str();
return valStr;
}
static void Max(int &val, const int &comp)
{
if (comp > val)