Go to the documentation of this file.
   17 #include <boost/program_options.hpp> 
   22 namespace po = boost::program_options;
 
   23 #include <boost/foreach.hpp> 
   24 #include <boost/scoped_ptr.hpp> 
   26 #include "version.hpp" 
   47   boost::scoped_ptr<DataInputInterface> 
m_input;
 
   55   boost::scoped_ptr<DFInterface> 
m_adfi;
 
   56   boost::scoped_ptr<DFInterface> 
m_odfi;
 
   86   virtual void actionInit(
int length, 
const char* buffer) {}
 
   93         std::string(buffer, length));
 
   96     unsigned int const delta_ts = conf.get<
unsigned int>(
 
   97         "timeslice_duration");
 
   99     uint64_t 
const run_start_time = conf.get<uint64_t>(
"run_start_time");
 
  101     std::size_t 
const max_dump_size = conf.get<std::size_t>(
"max_dump_size");
 
  102     std::string 
const prefix = conf.get<std::string>(
"dump_file_prefix");
 
  103     std::string 
const postfix = conf.get<std::string>(
"dump_file_postfix");
 
  109       acou_ports = detail::vectorize<int>(conf.get<std::string>(
"acou_ports"));
 
  113       opto_ports = detail::vectorize<int>(conf.get<std::string>(
"opto_ports"));
 
  116     int const n_channels = acou_ports.size() + opto_ports.size();
 
  144       std::string 
const acou_recipient = conf.get<std::string>(
"acou_recipient");
 
  153           conf.get<std::string>(
"opto_recipients"));
 
  156       BOOST_FOREACH(std::string s, opto_recipients)
 
  165       BOOST_FOREACH(
int port, acou_ports)
 
  172       BOOST_FOREACH(
int port, opto_ports)
 
  303     assert(!
"No DQ mode set.");
 
  309 int main(
int argc, 
char* argv[])
 
  311   __debug_abort_on_wrong_size_<CLBCommonHeader>(40);
 
  312   __debug_abort_on_wrong_size_<DAQCommonHeader>(56);
 
  313   __debug_abort_on_wrong_size_<UTCTime>(8);
 
  315   std::string server(
"localhost");
 
  316   std::string logger(
"localhost");
 
  317   std::string client_name(
"DataQueue");
 
  320   po::options_description desc(
"Options");
 
  322       (
"help,h", 
"Print this help and exit.")
 
  323       (
"version,v", 
"Print the version and exit.")
 
  324       (
"optical,o", 
"Set the optical mode.")
 
  325       (
"acoustic,a", 
"Set the acoustic mode.")
 
  327           po::value<std::string>(&server)->default_value(server),
 
  328           "Set the address of the SM server.")
 
  330           po::value<std::string>(&logger)->default_value(logger),
 
  331           "Set the address of the logger server.")
 
  333           po::value<std::string>(&client_name)->default_value(client_name),
 
  334           "Set the address of the client name.")
 
  337           "Set the debug level.");
 
  339   bool acou = 
false, opto = 
false;
 
  343     po::variables_map vm;
 
  345         po::command_line_parser(argc, argv).options(desc).run(),
 
  348     if (vm.count(
"help"))
 
  350       std::cout << desc << std::endl;
 
  354     if (vm.count(
"version"))
 
  362     opto = vm.count(
"optical");
 
  364     acou = vm.count(
"acoustic");
 
  366     if (! (acou || opto))
 
  368       throw std::runtime_error(
"FATAL: no mode specified. Use -o, -a or both. See the help.");
 
  371   catch (
const po::error& e)
 
  373     std::cerr << 
"DataQueue: Error: " << e.what() << 
'\n' 
  374               << desc << std::endl;
 
  377   catch (
const std::runtime_error& e)
 
  379     std::cerr << 
"DataQueue: Error: " << e.what() << 
'\n' 
  380               << desc << std::endl;
 
  
virtual void actionQuit(int length, const char *buffer)
 
Interface for logging messages.
 
boost::scoped_ptr< boost::thread > m_aff_th
 
virtual void actionInit(int length, const char *buffer)
 
static boost::atomic< unsigned int > n_obj
 
virtual void actionConfigure(int length, const char *buffer)
 
int main(int argc, char *argv[])
 
int getRunNumber() const
Get run number.
 
static const JNET::JTag RC_DQUEUE
 
boost::scoped_ptr< FrameFarm > m_ofarm
 
void setLogLevel(int level)
 
boost::scoped_ptr< RecipientsHandler > m_arecipients
 
void run()
Run as run control client following command messages via JNET::JControlHost.
 
boost::scoped_ptr< DFInterface > m_odfi
 
JLevel_t getLevel()
Get debug level.
 
static boost::atomic< unsigned int > n_obj
 
JSharedPointer< JControlHost > server
message server
 
virtual void actionReset(int length, const char *buffer)
 
DataQueue(const std::string &name, const std::string &server, JLogger *logger, const int level, bool acou, bool opto)
 
void replaceEvent(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace tag of given event in event table.
 
boost::property_tree::ptree parse(std::string str)
 
virtual void actionSelect(const JFileDescriptorMask &)
Action method following last select call.
 
boost::scoped_ptr< DataInputInterface > m_input
 
boost::scoped_ptr< boost::thread > m_off_th
 
boost::scoped_ptr< boost::thread > m_adfi_th
 
static const JNET::JTag RC_DQUEUE_ACS
 
Thread-safe message logger.
 
Auxiliary class for method select.
 
virtual void actionInput(int length, const char *buffer)
This method is called at ev_input.
 
const JNET::JTag & clientTag() const
 
static const JNET::JTag RC_DQUEUE_OPT
 
Control unit client base class.
 
Message logging based on ControlHost.
 
virtual void actionInput(int length, const char *buffer)
This method is called at ev_input.
 
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
 
int getDetectorID() const
Get detector identifier.
 
virtual void actionRunning()
This method is repeatedly called when this client machine is in state Running and the clock interval ...
 
JMessageLogger logger
message logger
 
boost::scoped_ptr< DFInterface > m_adfi
 
JDAQStateMachine::ev_configure_event ev_configure
 
virtual void actionContinue(int length, const char *buffer)
 
virtual void actionExit()
 
static InBufferCollector & getCollector()
 
KM3NeT DAQ data structures and auxiliaries.
 
static const JNET::JTag RC_CMD
 
virtual void actionEnter()
Interface methods for actions corresponding to state transitions.
 
void setClockInterval(const long long int interval_us)
Set interval time.
 
virtual void actionStop(int length, const char *buffer)
 
virtual void actionStart(int length, const char *buffer)
 
boost::scoped_ptr< FrameFarm > m_afarm
 
boost::scoped_ptr< boost::thread > m_odfi_th
 
void initLogger(JLOGGER::JMessageLoggerThreadSafe const &second)
 
boost::scoped_ptr< RecipientsHandler > m_orecipients
 
virtual bool enter(const JArgs &args)
Enter the state machine.
 
virtual void actionPause(int length, const char *buffer)