Jpp  15.0.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Functions
monrouter.cpp File Reference
#include <iostream>
#include <string>
#include <cassert>
#include "version.hpp"
#include <JRuncontrol/JDAQClient.hh>
#include <JLogger/JControlHostLogger.hh>
#include <JLogger/JMessageLogger.hh>
#include <JDAQ/JDAQTags.hh>
#include <boost/asio.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/program_options.hpp>
#include "configure.hpp"

Go to the source code of this file.

Classes

class  KM3NETDAQ::MonitorRouter
 

Namespaces

 KM3NETDAQ
 KM3NeT DAQ data structures and auxiliaries.
 

Functions

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

Function Documentation

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

Definition at line 144 of file monrouter.cpp.

145 {
146  std::string server("localhost");
147  std::string logger("localhost");
148  std::string client_name("MonRouter");
149  int debug = 0;
150  int port = 0;
151 
152  po::options_description desc("Options");
153  desc.add_options()
154  ("help,h", "Print this help and exit.")
155  ("version,v", "Print the version and exit.")
156  (
157  ",H"
158  , po::value<std::string>(&server)->default_value(server)
159  , "Set the address of the SM server."
160  )
161  (
162  ",M"
163  , po::value<std::string>(&logger)->default_value(logger)
164  , "Set the address of the logger server."
165  )
166  (
167  ",u"
168  , po::value<std::string>(&client_name)->default_value(client_name)
169  , "Set the address of the client name."
170  )
171  (
172  ",P"
173  , po::value<int>(&port)->required()
174  , "Set the UDP port to read data from"
175  )
176  (
177  ",d"
178  , po::value<int>(&debug)->default_value(debug)
179  , "Set the debug level."
180  );
181 
182  try {
183  po::variables_map vm;
184  po::store(
185  po::command_line_parser(argc, argv).options(desc).run(),
186  vm
187  );
188 
189  if (vm.count("help")) {
190  std::cout << desc << std::endl;
191  return EXIT_SUCCESS;
192  }
193 
194  if (vm.count("version")) {
195  std::cout << monrouter::version::v() << std::endl;
196  return EXIT_SUCCESS;
197  }
198 
199  po::notify(vm);
200  } catch (const po::error& e) {
201  std::cerr << "MonRouter: Error: " << e.what() << '\n'
202  << desc << std::endl;
203  return EXIT_FAILURE;
204  } catch (const std::runtime_error& e) {
205  std::cerr << "MonRouter: Error: " << e.what() << '\n'
206  << desc << std::endl;
207  return EXIT_FAILURE;
208  }
209 
210  // Logger for the main thread (used in JDAQClient)
212 
213  KM3NETDAQ::MonitorRouter router(client_name, server, log, debug, port);
214 
215  router.enter();
216  router.run();
217 }
Message logging based on ControlHost.
then usage $script[port]< option > nPossible options
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
int debug
debug level
Definition: JSirene.cc:63
data_type v[N+1][M+1]
Definition: JPolint.hh:740