23 int main(
int argc,
const char *argv[])
36 JParser<> zap(
"Program to forward messages from one ControlHost server to another.");
50 catch(
const exception &error) {
51 FATAL(error.what() << endl);
55 if (tagList.empty() && TagList.empty()) {
56 FATAL(
"No tags specified.");
61 cout <<
"Forwarding messages from " << endl <<
" " << source <<
" -> " << target << endl;
64 JControlHost::Throw(
true);
68 JControlHost
in(source);
69 JControlHost out(target);
71 cout <<
"with the following tags: ";
74 JSubscriptionList buffer;
77 buffer.add(JSubscriptionAny(*i));
78 cout << *i <<
"(any) ";
82 buffer.add(JSubscriptionAll(*i));
83 cout << *i <<
"(all) ";
95 unsigned int message_count = 0;
96 float milliseconds_passed;
97 std::chrono::high_resolution_clock::time_point start_time = std::chrono::high_resolution_clock::now();
99 for (
const string stop(
"stop"); buffer.size() !=
stop.size() || string(buffer.data(),
stop.size()) !=
stop; ) {
103 buffer.resize(prefix.getSize());
105 in.GetFullData(buffer.data(), buffer.size());
107 DEBUG(
getDateAndTime() <<
' ' << left << setw(8) << prefix.getTag() <<
' ' << right << setw(8) << prefix.getSize() << endl);
109 out.PutFullData(prefix.getTag(), buffer.data(), buffer.size());
112 milliseconds_passed = (std::chrono::high_resolution_clock::now() - start_time) / std::chrono::milliseconds(1);
114 if(milliseconds_passed > report_interval * 1e3) {
115 cout <<
getDateAndTime() <<
" : " <<
"Message rate: " << message_count / milliseconds_passed * 1e3 <<
" Hz" << endl;
116 start_time = std::chrono::high_resolution_clock::now();
121 catch(
const JControlHostException& error) {
122 ERROR(error << endl);
Utility class to parse command line options.
int main(int argc, char *argv[])
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
then usage $script[port]< option > nPossible stop
static JDateAndTime getDateAndTime
Function object to get ASCII formatted date and time.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in