#include <iostream>
#include <boost/program_options.hpp>
#include <boost/asio.hpp>
#include <fstream>
#include <string>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
| Program name: CLBReplay. More...
|
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Program name: CLBReplay.
Description: This program provide a way to send back to one of the DAQ tools the data contained in DQ or CLBSK dump data, via UDP. The program must run on the same computer where the DAQ tool is running.
Use $ CLBReplay -h for a detailed help.
E-mail: carme.nosp@m.lo.p.nosp@m.elleg.nosp@m.rino.nosp@m.@bo.i.nosp@m.nfn..nosp@m.it Date: 9 April 2015
- Author
- Carmelo Pellegrino
Definition at line 29 of file clb_replay.cpp.
32 unsigned int port = 0;
34 po::options_description desc(
"Options");
36 (
"help,h",
"Print this help and exit.")
38 po::value<std::string>(&filename)->required(),
39 "Set the name of the data file to send back to DQ or CLBSwissKnife.")
41 po::value<unsigned int>(&port)->required(),
42 "Set the UDP port to send the data through");
48 po::command_line_parser(argc, argv).
options(desc).run(),
53 std::cout << desc << std::endl;
59 catch (
const po::error& e)
61 std::cerr <<
"CLBReplay: Error: " << e.what() <<
'\n'
65 catch (
const std::runtime_error& e)
67 std::cerr <<
"CLBReplay: Error: " << e.what() <<
'\n'
72 std::ifstream input_file(filename.c_str());
73 boost::asio::ip::udp::udp::endpoint endpoint(
74 boost::asio::ip::address::from_string(
"127.0.0.1"),
77 boost::asio::io_service service;
78 boost::asio::ip::udp::socket sock(service, boost::asio::ip::udp::udp::v4());
82 while (input_file && input_file.peek() != EOF)
84 unsigned int datagram_size = 0;
85 input_file.read((
char*) &datagram_size,
sizeof(datagram_size));
87 input_file.read(buffer, datagram_size);
89 sock.send_to(boost::asio::buffer(buffer, datagram_size), endpoint);
94 std::cout <<
"File finished\n";
then print u2 $script< option > print u2 Possible options
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.