mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Cleanup examples
This commit is contained in:
committed by
Mohammad Al-Turany
parent
edcc7a4ee3
commit
622a11a32d
@@ -12,12 +12,9 @@
|
||||
* @author D. Klein, A. Rybalchenko
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "boost/program_options.hpp"
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQParser.h"
|
||||
#include "FairMQProgOptions.h"
|
||||
#include "FairMQExample1Sampler.h"
|
||||
|
||||
@@ -25,11 +22,6 @@ using namespace boost::program_options;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
FairMQExample1Sampler sampler;
|
||||
sampler.CatchSignals();
|
||||
|
||||
FairMQProgOptions config;
|
||||
|
||||
try
|
||||
{
|
||||
std::string text;
|
||||
@@ -38,13 +30,15 @@ int main(int argc, char** argv)
|
||||
samplerOptions.add_options()
|
||||
("text", value<std::string>(&text)->default_value("Hello"), "Text to send out");
|
||||
|
||||
FairMQProgOptions config;
|
||||
config.AddToCmdLineOptions(samplerOptions);
|
||||
|
||||
if (config.ParseAll(argc, argv))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FairMQExample1Sampler sampler;
|
||||
sampler.CatchSignals();
|
||||
sampler.SetConfig(config);
|
||||
sampler.SetProperty(FairMQExample1Sampler::Text, text);
|
||||
|
||||
@@ -59,9 +53,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(ERROR) << e.what();
|
||||
LOG(INFO) << "Command line options are the following: ";
|
||||
config.PrintHelp();
|
||||
LOG(ERROR) << "Unhandled Exception reached the top of main: "
|
||||
<< e.what() << ", application will now exit";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -15,24 +15,21 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQParser.h"
|
||||
#include "FairMQProgOptions.h"
|
||||
#include "FairMQExample1Sink.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
FairMQExample1Sink sink;
|
||||
sink.CatchSignals();
|
||||
|
||||
FairMQProgOptions config;
|
||||
|
||||
try
|
||||
{
|
||||
FairMQProgOptions config;
|
||||
if (config.ParseAll(argc, argv))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FairMQExample1Sink sink;
|
||||
sink.CatchSignals();
|
||||
sink.SetConfig(config);
|
||||
|
||||
sink.ChangeState("INIT_DEVICE");
|
||||
@@ -46,9 +43,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(ERROR) << e.what();
|
||||
LOG(INFO) << "Command line options are the following: ";
|
||||
config.PrintHelp();
|
||||
LOG(ERROR) << "Unhandled Exception reached the top of main: "
|
||||
<< e.what() << ", application will now exit";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user