Cleanup examples

This commit is contained in:
Alexey Rybalchenko 2016-05-12 09:15:35 +02:00
parent 6c88e75ed7
commit 1d2d409bfd
18 changed files with 98 additions and 199 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -12,27 +12,23 @@
* @author D. Klein, A. Rybalchenko
*/
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample2Processor.h"
int main(int argc, char** argv)
{
FairMQExample2Processor processor;
processor.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample2Processor processor;
processor.CatchSignals();
processor.SetConfig(config);
processor.ChangeState("INIT_DEVICE");
@ -46,9 +42,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;
}

View File

@ -12,12 +12,10 @@
* @author D. Klein, A. Rybalchenko
*/
#include <iostream>
#include "boost/program_options.hpp"
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample2Sampler.h"
@ -25,11 +23,6 @@ using namespace boost::program_options;
int main(int argc, char** argv)
{
FairMQExample2Sampler sampler;
sampler.CatchSignals();
FairMQProgOptions config;
try
{
std::string text;
@ -38,13 +31,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;
}
FairMQExample2Sampler sampler;
sampler.CatchSignals();
sampler.SetConfig(config);
sampler.SetProperty(FairMQExample2Sampler::Text, text);
@ -59,9 +54,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;
}

View File

@ -12,27 +12,23 @@
* @author D. Klein, A. Rybalchenko
*/
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample2Sink.h"
int main(int argc, char** argv)
{
FairMQExample2Sink sink;
sink.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample2Sink sink;
sink.CatchSignals();
sink.SetConfig(config);
sink.ChangeState("INIT_DEVICE");
@ -46,9 +42,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;
}

View File

@ -2,6 +2,6 @@
# source setup.sh
@bash_end@
sampler, username@localhost, , /path/to/dds-work-dir/, 1
processor, username@localhost, , /path/to/dds-work-dir/, 10
sink, username@localhost, , /path/to/dds-work-dir/, 1
sampler, orybalch@localhost, , /home/orybalch/dds-work/, 1
processor, orybalch@localhost, , /home/orybalch/dds-work/, 10
sink, orybalch@localhost, , /home/orybalch/dds-work/, 1

View File

@ -17,23 +17,18 @@
#include "FairMQProgOptions.h"
#include "FairMQExample3Processor.h"
using namespace std;
using namespace boost::program_options;
int main(int argc, char** argv)
{
FairMQExample3Processor processor;
processor.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample3Processor processor;
processor.CatchSignals();
processor.SetConfig(config);
processor.ChangeState("INIT_DEVICE");
@ -45,11 +40,10 @@ int main(int argc, char** argv)
runDDSStateHandler(processor);
}
catch (exception& e)
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;
}

View File

@ -17,23 +17,18 @@
#include "FairMQProgOptions.h"
#include "FairMQExample3Sampler.h"
using namespace std;
using namespace boost::program_options;
int main(int argc, char** argv)
{
FairMQExample3Sampler sampler;
sampler.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample3Sampler sampler;
sampler.CatchSignals();
sampler.SetConfig(config);
sampler.ChangeState("INIT_DEVICE");
@ -45,11 +40,10 @@ int main(int argc, char** argv)
runDDSStateHandler(sampler);
}
catch (exception& e)
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;
}

View File

@ -17,23 +17,18 @@
#include "FairMQProgOptions.h"
#include "FairMQExample3Sink.h"
using namespace std;
using namespace boost::program_options;
int main(int argc, char** argv)
{
FairMQExample3Sink sink;
sink.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample3Sink sink;
sink.CatchSignals();
sink.SetConfig(config);
sink.ChangeState("INIT_DEVICE");
@ -45,11 +40,10 @@ int main(int argc, char** argv)
runDDSStateHandler(sink);
}
catch (exception& e)
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;
}

View File

@ -15,24 +15,21 @@
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample4Sampler.h"
int main(int argc, char** argv)
{
FairMQExample4Sampler sampler;
sampler.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample4Sampler sampler;
sampler.CatchSignals();
sampler.SetConfig(config);
sampler.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;
}

View File

@ -15,24 +15,21 @@
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample4Sink.h"
int main(int argc, char** argv)
{
FairMQExample4Sink sink;
sink.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample4Sink 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;
}

View File

@ -12,33 +12,25 @@
* @author D. Klein, A. Rybalchenko
*/
#include <iostream>
#include "boost/program_options.hpp"
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample5Client.h"
using namespace std;
using namespace boost::program_options;
int main(int argc, char** argv)
{
FairMQExample5Client client;
client.CatchSignals();
FairMQProgOptions config;
try
{
string text;
std::string text;
options_description clientOptions("Client options");
clientOptions.add_options()
("text", value<string>(&text)->default_value("Hello"), "Text to send out");
("text", value<std::string>(&text)->default_value("Hello"), "Text to send out");
FairMQProgOptions config;
config.AddToCmdLineOptions(clientOptions);
if (config.ParseAll(argc, argv))
@ -46,6 +38,8 @@ int main(int argc, char** argv)
return 0;
}
FairMQExample5Client client;
client.CatchSignals();
client.SetConfig(config);
client.SetProperty(FairMQExample5Client::Text, text);
@ -58,11 +52,10 @@ int main(int argc, char** argv)
client.ChangeState("RUN");
client.InteractiveStateLoop();
}
catch (exception& e)
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;
}

View File

@ -15,26 +15,21 @@
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample5Server.h"
using namespace std;
int main(int argc, char** argv)
{
FairMQExample5Server server;
server.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample5Server server;
server.CatchSignals();
server.SetConfig(config);
server.ChangeState("INIT_DEVICE");
@ -46,11 +41,10 @@ int main(int argc, char** argv)
server.ChangeState("RUN");
server.InteractiveStateLoop();
}
catch (exception& e)
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;
}

View File

@ -12,27 +12,22 @@
* @author A. Rybalchenko
*/
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample6Broadcaster.h"
int main(int argc, char** argv)
{
FairMQExample6Broadcaster broadcaster;
broadcaster.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample6Broadcaster broadcaster;
broadcaster.CatchSignals();
broadcaster.SetConfig(config);
broadcaster.ChangeState("INIT_DEVICE");
@ -46,9 +41,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;
}

View File

@ -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 "FairMQExample6Sampler.h"
@ -25,11 +22,6 @@ using namespace boost::program_options;
int main(int argc, char** argv)
{
FairMQExample6Sampler 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;
}
FairMQExample6Sampler sampler;
sampler.CatchSignals();
sampler.SetConfig(config);
sampler.SetProperty(FairMQExample6Sampler::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;
}

View File

@ -12,31 +12,22 @@
* @author D. Klein, A. Rybalchenko
*/
#include <iostream>
#include "boost/program_options.hpp"
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample6Sink.h"
using namespace boost::program_options;
int main(int argc, char** argv)
{
FairMQExample6Sink sink;
sink.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample6Sink sink;
sink.CatchSignals();
sink.SetConfig(config);
sink.ChangeState("INIT_DEVICE");
@ -50,9 +41,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;
}

View File

@ -12,27 +12,22 @@
* @author D. Klein, A. Rybalchenko
*/
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample8Sampler.h"
int main(int argc, char** argv)
{
FairMQExample8Sampler sampler;
sampler.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample8Sampler sampler;
sampler.CatchSignals();
sampler.SetConfig(config);
sampler.ChangeState("INIT_DEVICE");
@ -46,9 +41,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;
}

View File

@ -12,27 +12,22 @@
* @author D. Klein, A. Rybalchenko
*/
#include <iostream>
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQExample8Sink.h"
int main(int argc, char** argv)
{
FairMQExample8Sink sink;
sink.CatchSignals();
FairMQProgOptions config;
try
{
FairMQProgOptions config;
if (config.ParseAll(argc, argv))
{
return 0;
}
FairMQExample8Sink sink;
sink.CatchSignals();
sink.SetConfig(config);
sink.ChangeState("INIT_DEVICE");
@ -46,9 +41,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;
}