Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JModuleAddress.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JMODULEADDRESS__
2 #define __JDETECTOR__JMODULEADDRESS__
3 
4 #include <istream>
5 #include <ostream>
6 
7 #include "JLang/JEquals.hh"
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace JDETECTOR {}
15 namespace JPP { using namespace JDETECTOR; }
16 
17 namespace JDETECTOR {
18 
19  using JLANG::JEquals;
20 
21 
22  /**
23  * Address of module in detector data structure.
24  *
25  * The address of a module consists of a single integer value JModuleAddress::first
26  * which refers to the index of the module in the detector data structure.
27  *
28  * This class implements the JLANG::JEquals interface.
29  */
31  public JEquals<JModuleAddress>
32  {
33  public:
34  /**
35  * Default constructor.
36  */
38  first(-1)
39  {}
40 
41 
42  /**
43  * Constructor.
44  *
45  * \param index index
46  */
47  explicit JModuleAddress(const int index) :
48  first(index)
49  {}
50 
51 
52  /**
53  * Equal method.
54  *
55  * \param address module address
56  * \result true if this module address equal to given module address; else false
57  */
58  inline bool equals(const JModuleAddress& address) const
59  {
60  return this->first == address.first;
61  }
62 
63 
64  /**
65  * Read module address from input.
66  *
67  * \param in input stream
68  * \param object module address
69  * \return input stream
70  */
71  friend inline std::istream& operator>>(std::istream& in, JModuleAddress& object)
72  {
73  return in >> object.first;
74  }
75 
76 
77  /**
78  * Write module address to output.
79  *
80  * \param out output stream
81  * \param object module address
82  * \return output stream
83  */
84  friend inline std::ostream& operator<<(std::ostream& out, const JModuleAddress& object)
85  {
86  return out << object.first;
87  }
88 
89 
90  int first; //!< index of module in detector data structure
91  };
92 }
93 
94 #endif
Address of module in detector data structure.
friend std::ostream & operator<<(std::ostream &out, const JModuleAddress &object)
Write module address to output.
int first
index of module in detector data structure
JModuleAddress(const int index)
Constructor.
JModuleAddress()
Default constructor.
bool equals(const JModuleAddress &address) const
Equal method.
friend std::istream & operator>>(std::istream &in, JModuleAddress &object)
Read module address from input.
file Auxiliary data structures and methods for detector calibration.
Definition: JAnchor.hh:12
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template definition of auxiliary base class for comparison of data structures.
Definition: JEquals.hh:84