Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JNet
JControlHostObjectIterator.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "
JDAQ/JDAQTimesliceIO.hh
"
6
#include "
JDAQ/JDAQEventIO.hh
"
7
#include "
JDAQ/JDAQSummarysliceIO.hh
"
8
#include "
JDAQ/JDAQTags.hh
"
9
10
#include "
JNet/JControlHostObjectIterator.hh
"
11
12
#include "
Jeep/JParser.hh
"
13
#include "
Jeep/JMessage.hh
"
14
15
/**
16
* \file
17
*
18
* Example program to test JNET::JControlHostObjectIterator.
19
* \author mdejong
20
*/
21
int
main
(
int
argc,
char
* argv[])
22
{
23
using namespace
std;
24
using namespace
JPP;
25
using namespace
KM3NETDAQ;
26
27
string
hostname;
28
JTimeval
timeout_us;
29
int
numberOfTimeouts;
30
bool
any;
31
int
debug
;
32
33
try
{
34
35
JParser<>
zap(
"Example program to test receiving of objects from ControlHost server."
);
36
37
zap[
'H'
] =
make_field
(hostname) =
"localhost"
;
38
zap[
'T'
] =
make_field
(timeout_us) = 100000;
39
zap[
'n'
] =
make_field
(numberOfTimeouts) = 100;
40
zap[
'Y'
] =
make_field
(any);
41
zap[
'd'
] =
make_field
(
debug
) = 1;
42
43
zap(argc, argv);
44
}
45
catch
(
const
exception &error) {
46
FATAL
(error.what() << endl);
47
}
48
49
50
setDAQLongprint
(
debug
>=
JEEP::debug_t
);
51
52
try
{
53
54
typedef
JDAQEvent
data_type;
55
56
JControlHostObjectIterator<data_type>
in
(hostname, timeout_us, !any);
57
58
for
(
int
i = 0; i != numberOfTimeouts; ) {
59
60
if
(in.
hasNext
()) {
61
62
data_type* p = in.
next
();
63
64
if
(
debug
<
JEEP::debug_t
)
65
NOTICE
(p->getDAQHeader() << endl);
66
else
67
DEBUG
(*p << endl);
68
69
}
else
{
70
71
NOTICE
(
"timeout "
<< setw(3) << i <<
'\r'
);
72
73
++i;
74
}
75
}
76
}
77
catch
(
const
JSocketException
& error) {
78
ERROR
(error.
what
() << endl);
79
}
80
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JEEP::debug_t
debug
Definition:
JMessage.hh:29
JLANG::JAbstractObjectIterator::next
virtual const pointer_type & next()
Get next element.
Definition:
JAbstractObjectIterator.hh:71
in
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition:
JSirene.sh:45
JLANG::JTimeval
Auxiliary class for time values.
Definition:
JTimeval.hh:26
KM3NETDAQ::setDAQLongprint
void setDAQLongprint(const bool option)
Set DAQ print option.
Definition:
JDAQPrint.hh:28
JControlHostObjectIterator.hh
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition:
JDAQEvent.hh:30
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
NOTICE
#define NOTICE(A)
Definition:
JMessage.hh:64
ERROR
#define ERROR(A)
Definition:
JMessage.hh:66
JDAQSummarysliceIO.hh
debug
int debug
debug level
Definition:
JSirene.cc:61
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JNET::JControlHostObjectIterator
Object iteration through ControlHost.
Definition:
JControlHostObjectIterator.hh:31
JParser.hh
Utility class to parse command line options.
JLANG::JSocketException
Exception for socket.
Definition:
JException.hh:432
JLANG::JAbstractObjectIterator::hasNext
virtual bool hasNext()
Check availability of next element.
Definition:
JAbstractObjectIterator.hh:56
JDAQTags.hh
Fixed parameters andd ControlHost tags for KM3NeT DAQ.
JLANG::JException::what
virtual const char * what() const
Get error message.
Definition:
JException.hh:48
JDAQEventIO.hh
JDAQTimesliceIO.hh
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5