315{
319
320 std::string server("localhost");
321 std::string logger("localhost");
322 std::string client_name("DataQueue");
324
325 po::options_description desc("Options");
326 desc.add_options()
327 ("help,h", "Print this help and exit.")
328 ("version,v", "Print the version and exit.")
329 ("optical,o", "Set the optical mode.")
330 ("acoustic,a", "Set the acoustic mode.")
331 (",H",
332 po::value<std::string>(&server)->default_value(server),
333 "Set the address of the SM server.")
334 (",M",
335 po::value<std::string>(&logger)->default_value(logger),
336 "Set the address of the logger server.")
337 (",u",
338 po::value<std::string>(&client_name)->default_value(client_name),
339 "Set the address of the client name.")
340 (",d",
342 "Set the debug level.");
343
344 bool acou = false, opto = false;
345
346 try
347 {
348 po::variables_map vm;
349 po::store(
350 po::command_line_parser(argc, argv).options(desc).run(),
351 vm);
352
353 if (vm.count("help"))
354 {
355 std::cout << desc << std::endl;
356 return EXIT_SUCCESS;
357 }
358
359 if (vm.count("version"))
360 {
361 std::cout << dataqueue::version::v() << std::endl;
362 return EXIT_SUCCESS;
363 }
364
365 po::notify(vm);
366
367 opto = vm.count("optical");
368
369 acou = vm.count("acoustic");
370
371 if (! (acou || opto))
372 {
373 throw std::runtime_error("FATAL: no mode specified. Use -o, -a or both. See the help.");
374 }
375 }
376 catch (const po::error& e)
377 {
378 std::cerr << "DataQueue: Error: " << e.what() << '\n'
379 << desc << std::endl;
380 return EXIT_FAILURE;
381 }
382 catch (const std::runtime_error& e)
383 {
384 std::cerr << "DataQueue: Error: " << e.what() << '\n'
385 << desc << std::endl;
386 return EXIT_FAILURE;
387 }
388
389
390
392
393
397 client_name,
399
400
402
404
405 dqueue.setClockInterval(30*1000*1000);
406
407 dqueue.enter();
408 dqueue.run();
409}
void initLogger(JLOGGER::JMessageLoggerThreadSafe const &second)
static InBufferCollector & getCollector()
Message logging based on ControlHost.
Thread-safe message logger.
void __debug_abort_on_wrong_size_(size_t size)