27 int main(
int argc,
const char *argv[])
31 using namespace KM3NETDAQ;
43 JParser<> zap(
"Program to forward messages from one ControlHost server to another.");
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
60 if (tagList.empty() && TagList.empty()) {
61 FATAL(
"No tags specified.");
64 NOTICE(
"Forwarding messages from " << endl <<
" " << source <<
" -> " <<
target << endl);
67 JControlHost::Throw(
true);
75 NOTICE(
"with the following tags: ");
98 unsigned int message_count[] = { 0, 0 };
99 float milliseconds_passed;
100 std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now();
102 for (
const string stop(
"stop"); buffer.size() !=
stop.size() || string(buffer.data(),
stop.size()) !=
stop; ) {
106 buffer.resize(prefix.
getSize());
110 message_count[0] += 1;
137 message_count[1] += 1;
142 milliseconds_passed = chrono::duration_cast<chrono::milliseconds>(std::chrono::steady_clock::now() - start_time).
count();
144 if (milliseconds_passed > report_interval * 1e3) {
147 << message_count[0] / milliseconds_passed * 1e3 <<
" "
148 << message_count[1] / milliseconds_passed * 1e3 <<
" Hz" << endl);
150 start_time = std::chrono::steady_clock::now();
152 message_count[0] = 0;
153 message_count[1] = 0;
158 ERROR(error << endl);
Utility class to parse command line options.
int main(int argc, char *argv[])
Auxiliary class for trigger mask.
int Subscribe(const JSubscription &subscription)
Subscribe to single tag.
int SendMeAlways()
Tell server to send messages forever.
then usage $script< input file >[option] nPossible options count
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
int getSize() const
Get size.
then usage $script[port]< option > nPossible stop
static const JDAQTriggerMask TRIGGER_MASK_ON
Trigger mask on;.
static JDateAndTime getDateAndTime
Function object to get current date and time.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for any subscription.
bool hasTriggerMask(const JDAQTriggerMask &mask) const
Has trigger bit pattern.
JSubscriptionList & add(const JSubscription &subscription)
Add subscription.
Exception for ControlHost.
Auxiliary class for all subscription.
const JTag & getTag() const
Get tag.
General purpose messaging.
int WaitHead(JPrefix &prefix)
Wait for header.
int GetFullData(void *buffer, long long int length)
Receive data.
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Utility class to parse command line options.
static const JNET::JTag IO_EVENT
int PutFullData(const JTag &tag, const void *buffer, const long long int length)
Send data.
#define DEBUG(A)
Message macros.