Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
Main.cpp File Reference
#include <stdlib.h>
#include <iostream>
#include <boost/program_options.hpp>
#include <boost/lexical_cast.hpp>
#include "AcousticDataFilter.h"
#include <Tools/KM3NeT_Debug.h>

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 15 of file Main.cpp.

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  ("command_server,H", boost::program_options::value<std::string>()->default_value("localhost"), "State machine server address (default localhost)")
22  ("logger,l", boost::program_options::value<std::string>()->default_value("localhost"), "Logger server address (default localhost)")
23  ("message_server,M", boost::program_options::value<std::string>()->default_value("localhost"), "Logger server address (default localhost)")
24  ("debug,d", boost::program_options::value<int>()->default_value(0), "Debug level (default 0)")
25  ("name,n", boost::program_options::value<std::string>()->default_value("AcousticDataFilter"), "Client name (default AcousticDataFilter)")
26  ("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)")
27  ("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)")
28  ("wisdom,w", boost::program_options::value<std::string>()->default_value("./Wisdom.txt"), "Local path and name of the wisdom file (default ./Wisdom.txt)")
29  ("output,o", boost::program_options::value<std::string>()->default_value("./"), "Path of the output files (default ./)")
30  ("raw,r", boost::program_options::value<std::string>()->default_value("./"), "Path of the raw files (default ./)");
31 
32  boost::program_options::variables_map vm;
33  boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(description).run(), vm);
34  boost::program_options::notify(vm);
35 
36  if(vm.count("help")) { std::cout << description; return 0; }
37 
38  std::string Local_addr = vm["address"].as<std::string>();
39  std::string Local_port = boost::lexical_cast<std::string>(vm["port"].as<int>());
40  std::string StateMachine_address = vm["statemachine"].as<std::string>();
41  std::string Logger_address = vm["logger"].as<std::string>();
42  int Client_dbg_level = vm["debug"].as<int>();
43  std::string Client_name = vm["name"].as<std::string>();
44  std::string Wisdom_file = vm["wisdom"].as<std::string>();
45  std::string Output_file = vm["output"].as<std::string>();
46  std::string Raw_file = vm["raw"].as<std::string>();
47 
48  if (StateMachine_address == "") {
49  StateMachine_address = vm["command_server"].as<std::string>();
50  }
51  if (Logger_address == "") {
52  Logger_address = vm["message_server"].as<std::string>();
53  }
54 
55  try
56  {
58  AcousticDataFilter ADF(Local_addr,Local_port,Client_name, StateMachine_address, Wisdom_file, Output_file, Raw_file, Log, Client_dbg_level);
59  ADF.enter();
60  ADF.run();
61  return 0;
62  }
63  catch (std::exception& e)
64  {
65  std::cerr<<"Error: "<<e.what()<<'\n';
66  return -1;
67  }
68 }
Message logging based on ControlHost.
then print u2 $script< option > print u2 Possible options
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.