Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Main.cpp
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include <iostream>
3 
4 
5 #include <boost/program_options.hpp>
6 #include <boost/lexical_cast.hpp>
7 
8 #include "AcousticDataFilter.h"
9 #include <Tools/KM3NeT_Debug.h>
10 
11 /**
12  * \author fsimeone
13  */
14 
15 int main(int argc, char *argv[])
16 {
17  boost::program_options::options_description description("Acoustic data filter options");
18  description.add_options()
19  ("help,h", "Show the help")
20  ("statemachine,s", boost::program_options::value<std::string>()->default_value("localhost"), "State machine server address (default localhost)")
21  ("logger,l", boost::program_options::value<std::string>()->default_value("localhost"), "Logger server address (default localhost)")
22  ("debug,d", boost::program_options::value<int>()->default_value(0), "Debug level (default 0)")
23  ("name,n", boost::program_options::value<std::string>()->default_value("AcousticDataFilter"), "Client name (default AcousticDataFilter)")
24  ("address,a", boost::program_options::value<std::string>()->default_value("127.0.0.1"), "Local address for the TCP audio server used to receive the data stream from the DQ (default 127.0.0.1)")
25  ("port,p", boost::program_options::value<int>()->default_value(5800), "Local port number TCP audio server used to receive the data stream from the DQ (default 5800)")
26  ("wisdom,w", boost::program_options::value<std::string>()->default_value("./Wisdom.txt"), "Local path and name of the wisdom file (default ./Wisdom.txt)")
27  ("output,o", boost::program_options::value<std::string>()->default_value("./"), "Path of the output files (default ./)")
28  ("raw,r", boost::program_options::value<std::string>()->default_value("./"), "Path of the raw files (default ./)");
29 
30  boost::program_options::variables_map vm;
31  boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(description).run(), vm);
32  boost::program_options::notify(vm);
33 
34  if(vm.count("help")) { std::cout << description; return 0; }
35 
36  std::string Local_addr = vm["address"].as<std::string>();
37  std::string Local_port = boost::lexical_cast<std::string>(vm["port"].as<int>());
38  std::string StateMachine_address = vm["statemachine"].as<std::string>();
39  std::string Logger_address = vm["logger"].as<std::string>();
40  int Client_dbg_level = vm["debug"].as<int>();
41  std::string Client_name = vm["name"].as<std::string>();
42  std::string Wisdom_file = vm["wisdom"].as<std::string>();
43  std::string Output_file = vm["output"].as<std::string>();
44  std::string Raw_file = vm["raw"].as<std::string>();
45 
46  try
47  {
49  AcousticDataFilter ADF(Local_addr,Local_port,Client_name, StateMachine_address, Wisdom_file, Output_file, Raw_file, Log, Client_dbg_level);
50  ADF.enter();
51  ADF.run();
52  return 0;
53  }
54  catch (std::exception& e)
55  {
56  std::cerr<<"Error: "<<e.what()<<'\n';
57  return -1;
58  }
59 }
Message logging based on ControlHost.
void run()
Run as run control client following command messages via JNET::JControlHost.
Definition: JDAQClient.hh:493
virtual bool enter(const JArgs &args)
Enter the state machine.
Definition: JDAQClient.hh:143
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
int main(int argc, char *argv[])
Definition: Main.cpp:15