#include #include #include #include "JDAQ/JDAQTimesliceIO.hh" #include "JDAQ/JDAQEventIO.hh" #include "JDAQ/JDAQSummarysliceIO.hh" #include "JDAQ/JDAQTags.hh" #include "JNet/JControlHostObjectIterator.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to test JNET::JControlHostObjectIterator. * \author mdejong */ int main(int argc, char* argv[]) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; string hostname; JTimeval timeout_us; int numberOfTimeouts; bool any; int debug; try { JParser<> zap("Example program to test receiving of objects from ControlHost server."); zap['H'] = make_field(hostname) = "localhost"; zap['T'] = make_field(timeout_us) = 100000; zap['n'] = make_field(numberOfTimeouts) = 100; zap['Y'] = make_field(any); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } setDAQLongprint(debug >= JEEP::debug_t); try { typedef JDAQEvent data_type; JControlHostObjectIterator in(hostname, timeout_us, !any); for (int i = 0; i != numberOfTimeouts; ) { if (in.hasNext()) { data_type* p = in.next(); if (debug< JEEP::debug_t) NOTICE(p->getDAQHeader() << endl); else DEBUG(*p << endl); } else { NOTICE("timeout " << setw(3) << i << '\r'); ++i; } } } catch(const JSocketException& error) { ERROR(error.what() << endl); } }