Jpp  18.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDAQDriver.cc File Reference

Run control driver program. More...

#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JLogger/JStreamLogger.hh"
#include "JLogger/JControlHostLogger.hh"
#include "JRuncontrol/JDAQClient.hh"
#include "JRuncontrol/JDAQDriver.hh"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Run control driver program.

Author
mdejong

Definition in file JDAQDriver.cc.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 20 of file JDAQDriver.cc.

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 }
Utility class to parse command line options.
Definition: JParser.hh:1514
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable SERVER localhost define_variable LOGGER if do_usage *then usage $script< server >[logger] fi case set_variable LOGGER
Definition: JStopDAQ.sh:23
Simple driver for run control clients.
Definition: JDAQDriver.hh:35
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
std::string getHostname()
Get host name.
Definition: JNetwork.hh:77
#define FATAL(A)
Definition: JMessage.hh:67
&set_variable SERVER
Definition: JStopDAQ.sh:29
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
int debug
debug level