27 int main(
int argc,
const char *argv[])
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);
int main(int argc, const char *argv[])
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Exception for ControlHost.
int WaitHead(JPrefix &prefix)
Wait for header.
int GetFullData(void *buffer, long long int length)
Receive data.
int SendMeAlways()
Tell server to send messages forever.
int PutFullData(const JTag &tag, const void *buffer, const long long int length)
Send data.
int Subscribe(const JSubscription &subscription)
Subscribe to single tag.
int getSize() const
Get size.
JSubscriptionList & add(const JSubscription &subscription)
Add subscription.
const JTag & getTag() const
Get tag.
Utility class to parse command line options.
Auxiliary class for trigger mask.
bool hasTriggerMask(const JDAQTriggerMask &mask) const
Has trigger bit pattern.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static JDateAndTime getDateAndTime
Function object to get current date and time.
KM3NeT DAQ data structures and auxiliaries.
static const JDAQTriggerMask TRIGGER_MASK_ON
Trigger mask on;.
static const JNET::JTag IO_EVENT
Auxiliary class for all subscription.
Auxiliary class for any subscription.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...