Jpp master_rocky-44-g75b7c4f75
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 <TROOT.h>
5#include <TObject.h>
6
8
9
10/**
11 * \file
12 *
13 * Acoustic counter.
14 * \author mdejong
15 */
16namespace JACOUSTICS {}
17namespace JPP { using namespace JACOUSTICS; }
18
19namespace JACOUSTICS {
20
21 using JIO::JReader;
22 using JIO::JWriter;
23
24 /**
25 * Acoustic counter.
26 */
27 struct JCounter {
28 /**
29 * Default constructor.
30 */
32 counter(0)
33 {}
34
35
36 /**
37 * Constructor.
38 *
39 * \param counter counter
40 */
41 JCounter(const int counter) :
43 {}
44
45
46 /**
47 * Get counter.
48 *
49 * \return counter
50 */
51 int getCounter() const
52 {
53 return counter;
54 }
55
56
57 /**
58 * Read counter from input.
59 *
60 * \param in reader
61 * \param object counter
62 * \return reader
63 */
64 friend inline JReader& operator>>(JReader& in, JCounter& object)
65 {
66 in >> object.counter;
67
68 return in;
69 }
70
71
72 /**
73 * Write counter to output.
74 *
75 * \param out writer
76 * \param object counter
77 * \return writer
78 */
79 friend inline JWriter& operator<<(JWriter& out, const JCounter& object)
80 {
81 out << object.counter;
82
83 return out;
84 }
85
87
88 protected:
90 };
91
92
93 /**
94 * Less-than operator for two counters.
95 *
96 * \param first first counter
97 * \param second second counter
98 * \return true if first counter less than second; else false
99 */
100 static inline bool operator<(const JCounter& first, const JCounter& second)
101 {
102 return first.getCounter() < second.getCounter();
103 }
104
105
106 /**
107 * Equals operator for two counters.
108 *
109 * \param first first counter
110 * \param second second counter
111 * \return true if first counter equal to second; else false
112 */
113 static inline bool operator==(const JCounter& first, const JCounter& second)
114 {
115 return first.getCounter() == second.getCounter();
116 }
117}
118
119#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)