Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JAcoustics/JCounter.hh
Go to the documentation of this file.
1#ifndef __JACOUSTICS__JCOUNTER__
2#define __JACOUSTICS__JCOUNTER__
3
4#include <TObject.h>
5
7
8
9/**
10 * \file
11 *
12 * Acoustic counter.
13 * \author mdejong
14 */
15namespace JACOUSTICS {}
16namespace JPP { using namespace JACOUSTICS; }
17
18namespace JACOUSTICS {
19
20 using JIO::JReader;
21 using JIO::JWriter;
22
23 /**
24 * Acoustic counter.
25 */
26 struct JCounter {
27 /**
28 * Default constructor.
29 */
31 counter(0)
32 {}
33
34
35 /**
36 * Constructor.
37 *
38 * \param counter counter
39 */
40 JCounter(const int counter) :
42 {}
43
44
45 /**
46 * Get counter.
47 *
48 * \return counter
49 */
50 int getCounter() const
51 {
52 return counter;
53 }
54
55
56 /**
57 * Read counter from input.
58 *
59 * \param in reader
60 * \param object counter
61 * \return reader
62 */
63 friend inline JReader& operator>>(JReader& in, JCounter& object)
64 {
65 in >> object.counter;
66
67 return in;
68 }
69
70
71 /**
72 * Write counter to output.
73 *
74 * \param out writer
75 * \param object counter
76 * \return writer
77 */
78 friend inline JWriter& operator<<(JWriter& out, const JCounter& object)
79 {
80 out << object.counter;
81
82 return out;
83 }
84
86
87 protected:
89 };
90
91
92 /**
93 * Less-than operator for two counters.
94 *
95 * \param first first counter
96 * \param second second counter
97 * \return true if first counter less than second; else false
98 */
99 static inline bool operator<(const JCounter& first, const JCounter& second)
100 {
101 return first.getCounter() < second.getCounter();
102 }
103
104
105 /**
106 * Equals operator for two counters.
107 *
108 * \param first first counter
109 * \param second second counter
110 * \return true if first counter equal to second; else false
111 */
112 static inline bool operator==(const JCounter& first, const JCounter& second)
113 {
114 return first.getCounter() == second.getCounter();
115 }
116}
117
118#endif
Interface for binary input.
Interface for binary output.
Auxiliary classes and methods for acoustic position calibration.
static bool operator<(const JCounter &first, const JCounter &second)
Less-than operator for two counters.
static bool operator==(const JCounter &first, const JCounter &second)
Equals operator for two counters.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
friend JReader & operator>>(JReader &in, JCounter &object)
Read counter from input.
JCounter(const int counter)
Constructor.
JCounter()
Default constructor.
friend JWriter & operator<<(JWriter &out, const JCounter &object)
Write counter to output.
int getCounter() const
Get counter.
ClassDefNV(JCounter, 1)