diff --git a/examples/MQ/1-sampler-sink/runExample1Sampler.cxx b/examples/MQ/1-sampler-sink/runExample1Sampler.cxx index 726ed93d..840dcbbf 100644 --- a/examples/MQ/1-sampler-sink/runExample1Sampler.cxx +++ b/examples/MQ/1-sampler-sink/runExample1Sampler.cxx @@ -12,12 +12,9 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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(&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; } diff --git a/examples/MQ/1-sampler-sink/runExample1Sink.cxx b/examples/MQ/1-sampler-sink/runExample1Sink.cxx index 32b22d6f..da216287 100644 --- a/examples/MQ/1-sampler-sink/runExample1Sink.cxx +++ b/examples/MQ/1-sampler-sink/runExample1Sink.cxx @@ -15,24 +15,21 @@ #include #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; } diff --git a/examples/MQ/2-sampler-processor-sink/runExample2Processor.cxx b/examples/MQ/2-sampler-processor-sink/runExample2Processor.cxx index 470d5184..8afeb243 100644 --- a/examples/MQ/2-sampler-processor-sink/runExample2Processor.cxx +++ b/examples/MQ/2-sampler-processor-sink/runExample2Processor.cxx @@ -12,27 +12,23 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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; } diff --git a/examples/MQ/2-sampler-processor-sink/runExample2Sampler.cxx b/examples/MQ/2-sampler-processor-sink/runExample2Sampler.cxx index 6ae3773a..441fe5ab 100644 --- a/examples/MQ/2-sampler-processor-sink/runExample2Sampler.cxx +++ b/examples/MQ/2-sampler-processor-sink/runExample2Sampler.cxx @@ -12,12 +12,10 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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(&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; } diff --git a/examples/MQ/2-sampler-processor-sink/runExample2Sink.cxx b/examples/MQ/2-sampler-processor-sink/runExample2Sink.cxx index 594b5500..63a3994c 100644 --- a/examples/MQ/2-sampler-processor-sink/runExample2Sink.cxx +++ b/examples/MQ/2-sampler-processor-sink/runExample2Sink.cxx @@ -12,27 +12,23 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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; } diff --git a/examples/MQ/3-dds/ex3-dds-hosts.cfg b/examples/MQ/3-dds/ex3-dds-hosts.cfg index b9739086..113d094e 100644 --- a/examples/MQ/3-dds/ex3-dds-hosts.cfg +++ b/examples/MQ/3-dds/ex3-dds-hosts.cfg @@ -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 diff --git a/examples/MQ/3-dds/runExample3Processor.cxx b/examples/MQ/3-dds/runExample3Processor.cxx index 46b5c364..68089fb4 100644 --- a/examples/MQ/3-dds/runExample3Processor.cxx +++ b/examples/MQ/3-dds/runExample3Processor.cxx @@ -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; } diff --git a/examples/MQ/3-dds/runExample3Sampler.cxx b/examples/MQ/3-dds/runExample3Sampler.cxx index 62527515..5cc38d12 100644 --- a/examples/MQ/3-dds/runExample3Sampler.cxx +++ b/examples/MQ/3-dds/runExample3Sampler.cxx @@ -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; } diff --git a/examples/MQ/3-dds/runExample3Sink.cxx b/examples/MQ/3-dds/runExample3Sink.cxx index aa374d87..823721a4 100644 --- a/examples/MQ/3-dds/runExample3Sink.cxx +++ b/examples/MQ/3-dds/runExample3Sink.cxx @@ -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; } diff --git a/examples/MQ/4-copypush/runExample4Sampler.cxx b/examples/MQ/4-copypush/runExample4Sampler.cxx index 0dcd55fb..cd1230ba 100644 --- a/examples/MQ/4-copypush/runExample4Sampler.cxx +++ b/examples/MQ/4-copypush/runExample4Sampler.cxx @@ -15,24 +15,21 @@ #include #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; } diff --git a/examples/MQ/4-copypush/runExample4Sink.cxx b/examples/MQ/4-copypush/runExample4Sink.cxx index c8a76b53..0959afd2 100644 --- a/examples/MQ/4-copypush/runExample4Sink.cxx +++ b/examples/MQ/4-copypush/runExample4Sink.cxx @@ -15,24 +15,21 @@ #include #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; } diff --git a/examples/MQ/5-req-rep/runExample5Client.cxx b/examples/MQ/5-req-rep/runExample5Client.cxx index 345c90d5..e5e48a6d 100644 --- a/examples/MQ/5-req-rep/runExample5Client.cxx +++ b/examples/MQ/5-req-rep/runExample5Client.cxx @@ -12,33 +12,25 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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(&text)->default_value("Hello"), "Text to send out"); + ("text", value(&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; } diff --git a/examples/MQ/5-req-rep/runExample5Server.cxx b/examples/MQ/5-req-rep/runExample5Server.cxx index 4079fb3e..599710fe 100644 --- a/examples/MQ/5-req-rep/runExample5Server.cxx +++ b/examples/MQ/5-req-rep/runExample5Server.cxx @@ -15,26 +15,21 @@ #include #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; } diff --git a/examples/MQ/6-multiple-channels/runExample6Broadcaster.cxx b/examples/MQ/6-multiple-channels/runExample6Broadcaster.cxx index 5976bb57..beffd641 100644 --- a/examples/MQ/6-multiple-channels/runExample6Broadcaster.cxx +++ b/examples/MQ/6-multiple-channels/runExample6Broadcaster.cxx @@ -12,27 +12,22 @@ * @author A. Rybalchenko */ -#include - #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; } diff --git a/examples/MQ/6-multiple-channels/runExample6Sampler.cxx b/examples/MQ/6-multiple-channels/runExample6Sampler.cxx index e23051b1..85d93c62 100644 --- a/examples/MQ/6-multiple-channels/runExample6Sampler.cxx +++ b/examples/MQ/6-multiple-channels/runExample6Sampler.cxx @@ -12,12 +12,9 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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(&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; } diff --git a/examples/MQ/6-multiple-channels/runExample6Sink.cxx b/examples/MQ/6-multiple-channels/runExample6Sink.cxx index 3e6b2d2e..06fa2c44 100644 --- a/examples/MQ/6-multiple-channels/runExample6Sink.cxx +++ b/examples/MQ/6-multiple-channels/runExample6Sink.cxx @@ -12,31 +12,22 @@ * @author D. Klein, A. Rybalchenko */ -#include - -#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; } diff --git a/examples/MQ/8-multipart/runExample8Sampler.cxx b/examples/MQ/8-multipart/runExample8Sampler.cxx index ababbccb..6002d4b1 100644 --- a/examples/MQ/8-multipart/runExample8Sampler.cxx +++ b/examples/MQ/8-multipart/runExample8Sampler.cxx @@ -12,27 +12,22 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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; } diff --git a/examples/MQ/8-multipart/runExample8Sink.cxx b/examples/MQ/8-multipart/runExample8Sink.cxx index 1ed32988..4f452faf 100644 --- a/examples/MQ/8-multipart/runExample8Sink.cxx +++ b/examples/MQ/8-multipart/runExample8Sink.cxx @@ -12,27 +12,22 @@ * @author D. Klein, A. Rybalchenko */ -#include - #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; }