mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Cleanup examples
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user