Use FairMQProgOptions for Sink and BenchmarkSampler

This commit is contained in:
Alexey Rybalchenko
2015-06-15 16:50:03 +02:00
parent 7fda980710
commit a3d919b763
14 changed files with 432 additions and 736 deletions

View File

@@ -17,21 +17,20 @@ namespace pt = boost::property_tree;
class FairMQProgOptions : public FairProgOptions
{
protected:
typedef std::map<std::string, std::vector<FairMQChannel> > FairMQMap;
typedef std::map< std::string,std::vector<FairMQChannel> > FairMQMap;
public:
FairMQProgOptions();
virtual ~FairMQProgOptions();
virtual int ParseAll(const int argc, char** argv, bool AllowUnregistered=false);
virtual int ParseAll(const int argc, char** argv, bool AllowUnregistered = false);
// external parser, store function
template < typename T, typename ...Args>
template <typename T, typename ...Args>
int UserParser(Args &&... args)
{
try
{
Store( T().UserParser(std::forward<Args>(args)...) );
Store(T().UserParser(std::forward<Args>(args)...));
}
catch (std::exception& e)
{
@@ -40,38 +39,36 @@ public:
}
return 0;
}
int Store(const po::variables_map& vm)
{
fvarmap = vm;
return 0;
}
int Store(const pt::ptree& tree)
{
fMQtree = tree;
return 0;
}
int Store(const FairMQMap& channels)
{
fFairMQmap = channels;
return 0;
}
FairMQMap GetFairMQMap()
{
return fFairMQmap;
}
protected:
po::options_description fMQParserOptions;
pt::ptree fMQtree;
FairMQMap fFairMQmap;
virtual int NotifySwitchOption();// for custom help & version printing
virtual int NotifySwitchOption(); // for custom help & version printing
void InitOptionDescription();
};