Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JDAQDriver.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <fstream>
4#include <iomanip>
5
6#include "Jeep/JParser.hh"
7#include "Jeep/JMessage.hh"
10
13
14
15/**
16 * \file
17 * Run control driver program.
18 * \author mdejong
19 */
20int main(int argc, char* argv[])
21{
22 using namespace std;
23
24 string file_name;
25 string server;
26 string logger;
27 bool use_cout;
28 int timeout_s;
29 int debug;
30
31 try {
32
33 JParser<> zap("Run control driver program.");
34
35 zap['f'] = make_field(file_name);
36 zap['H'] = make_field(server) = "localhost";
37 zap['M'] = make_field(logger) = "localhost";
38 zap['c'] = make_field(use_cout);
39 zap['t'] = make_field(timeout_s) = 10; // [s]
40 zap['d'] = make_field(debug) = 0;
41
42 zap(argc, argv);
43 }
44 catch(const exception &error) {
45 FATAL(error.what() << endl);
46 }
47
48
49 using namespace KM3NETDAQ;
50
51 if (server == "localhost") server = JSYSTEM::getHostname();
52 if (logger == "localhost") logger = JSYSTEM::getHostname();
53
54 JClient::SERVER = server;
55 JClient::LOGGER = logger;
56
57 JLogger* out = NULL;
58
59 if (use_cout)
60 out = new JStreamLogger(cout);
61 else
62 out = new JControlHostLogger(logger);
63
64 JDAQDriver driver(argv[0], server, out, debug, timeout_s);
65
66 ifstream in(file_name.c_str());
67
68 driver.run(in);
69
70 in.close();
71}
int main(int argc, char *argv[])
Definition JDAQDriver.cc:20
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Message logging based on ControlHost.
Interface for logging messages.
Definition JLogger.hh:22
Message logging based on std::ostream.
Utility class to parse command line options.
Definition JParser.hh:1698
Simple driver for run control clients.
Definition JDAQDriver.hh:38
void run()
Run driver with user input.
std::string getHostname()
Get host name.
Definition JNetwork.hh:77
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39