Jpp  17.3.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPMTPhysicalAddress.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JPMTPHYSICALADDRESS__
2 #define __JDETECTOR__JPMTPHYSICALADDRESS__
3 
4 #include <istream>
5 #include <ostream>
6 
7 #include "JLang/JComparable.hh"
8 #include "JIO/JSerialisable.hh"
9 
10 
11 /**
12  * \author mdejong
13  */
14 
15 namespace JDETECTOR {}
16 namespace JPP { using namespace JDETECTOR; }
17 
18 namespace JDETECTOR {
19 
20  using JLANG::JComparable;
21 
22 
23  /**
24  * Data structure for PMT physical address.
25  */
27  public JComparable<JPMTPhysicalAddress>
28  {
29  public:
30  /**
31  * Default constructor.
32  */
34  {
35  this->ring = '\0';
36  this->position = -1;
37  }
38 
39 
40  /**
41  * Constructor.
42  *
43  * \param ring ring
44  * \param position position
45  */
47  const int position)
48  {
49  this->ring = ring;
50  this->position = position;
51  }
52 
53 
54  /**
55  * Less than method.
56  *
57  * \param address PMT physical address
58  * \result true if this address before given address; else false
59  */
60  inline bool less(const JPMTPhysicalAddress& address) const
61  {
62  if (this->ring == address.ring)
63  return this->position < address.position;
64  else
65  return this->ring < address.ring;
66  }
67 
68 
69  /**
70  * Read PMT physical address from input.
71  *
72  * \param in input stream
73  * \param object PMT physical address
74  * \return input stream
75  */
76  friend inline std::istream& operator>>(std::istream& in, JPMTPhysicalAddress& object)
77  {
78  in >> object.ring;
79  in >> object.position;
80 
81  return in;
82  }
83 
84 
85  /**
86  * Write PMT physical address to output.
87  *
88  * \param out output stream
89  * \param object PMT physical address
90  * \return output stream
91  */
92  friend inline std::ostream& operator<<(std::ostream& out, const JPMTPhysicalAddress& object)
93  {
94  out << object.ring;
95  out << object.position;
96 
97  return out;
98  }
99 
100 
101  /**
102  * Read PMT physical address from input.
103  *
104  * \param in reader
105  * \param object PMT physical address
106  * \return reader
107  */
108  friend inline JReader& operator>>(JReader& in, JPMTPhysicalAddress& object)
109  {
110  in >> object.ring;
111  in >> object.position;
112 
113  return in;
114  }
115 
116 
117  /**
118  * Write PMT physical address to output.
119  *
120  * \param out writer
121  * \param object PMT physical address
122  * \return writer
123  */
124  friend inline JWriter& operator<<(JWriter& out, const JPMTPhysicalAddress& object)
125  {
126  out << object.ring;
127  out << object.position;
128 
129  return out;
130  }
131 
132 
133  /**
134  * Convert PMT physical address to string.
135  *
136  * \return string
137  */
139  {
140  std::ostringstream os;
141 
142  os << *this;
143 
144  return os.str();
145  }
146 
147 
148  char ring; //!< ring number ['A','F']
149  int position; //!< position within ring [1,6]
150  };
151 }
152 
153 #endif
Interface for binary output.
JPMTPhysicalAddress(const char ring, const int position)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JPMTPhysicalAddress &object)
Write PMT physical address to output.
friend JReader & operator>>(JReader &in, JPMTPhysicalAddress &object)
Read PMT physical address from input.
friend std::istream & operator>>(std::istream &in, JPMTPhysicalAddress &object)
Read PMT physical address from input.
then awk string
char ring
ring number [&#39;A&#39;,&#39;F&#39;]
Interface for binary input.
Template definition of auxiliary base class for comparison of data structures.
Definition: JComparable.hh:24
friend JWriter & operator<<(JWriter &out, const JPMTPhysicalAddress &object)
Write PMT physical address to output.
std::string toString() const
Convert PMT physical address to string.
int position
position within ring [1,6]
JPMTPhysicalAddress()
Default constructor.
Data structure for PMT physical address.
bool less(const JPMTPhysicalAddress &address) const
Less than method.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46