Jpp  15.0.5
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTransmission_t.hh
Go to the documentation of this file.
1 #ifndef __JACOUSTICS__JTRANSMISSION_T__
2 #define __JACOUSTICS__JTRANSMISSION_T__
3 
4 #include <istream>
5 #include <ostream>
6 
7 #include "JLang/JComparable.hh"
8 
9 /**
10  * \file
11  *
12  * Acoustic transmission identifier.
13  * \author mdejong
14  */
15 namespace JACOUSTICS {}
16 namespace JPP { using namespace JACOUSTICS; }
17 
18 namespace JACOUSTICS {
19 
20  using JLANG::JComparable;
21 
22 
23  /**
24  * Acoustic transmission identifier.
25  */
26  struct JTransmission_t :
27  public JComparable<JTransmission_t>
28  {
29  /**
30  * Default constructor.
31  */
33  tx(-1),
34  rx(-1)
35  {}
36 
37 
38  /**
39  * Constructor.
40  *
41  * \param tx transmitter identifier
42  * \param rx receiver identifier
43  */
44  JTransmission_t(const int tx,
45  const int rx) :
46  tx(tx),
47  rx(rx)
48  {}
49 
50 
51  /**
52  * Less than method.
53  *
54  * \param id transmission identifier
55  * \return true is this transmission identifier is less than given transmision identifier; else false
56  *
57  */
58  inline bool less(const JTransmission_t& id) const
59  {
60  if (this->tx == id.tx)
61  return this->rx < id.rx;
62  else
63  return this->tx < id.tx;
64  }
65 
66 
67  /**
68  * Read transmission identifier from input stream.
69  *
70  * \param in input stream
71  * \param object transmission identifier
72  * \return input stream
73  */
74  friend inline std::istream& operator>>(std::istream& in, JTransmission_t& object)
75  {
76  return in >> object.tx >> object.rx;
77  }
78 
79 
80  /**
81  * Write transmission identifier to output stream.
82  *
83  * \param out output stream
84  * \param object transmission identifier
85  * \return output stream
86  */
87  friend inline std::ostream& operator<<(std::ostream& out, const JTransmission_t& object)
88  {
89  return out << object.tx << ' ' << object.rx;
90  }
91 
92 
93  int tx; //!< transmitter identifier
94  int rx; //!< receiver identifier
95  };
96 }
97 
98 #endif
int tx
transmitter identifier
JTransmission_t(const int tx, const int rx)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JTransmission_t &object)
Write transmission identifier to output stream.
int rx
receiver identifier
bool less(const JTransmission_t &id) const
Less than method.
Template definition of auxiliary base class for comparison of data structures.
Definition: JComparable.hh:24
friend std::istream & operator>>(std::istream &in, JTransmission_t &object)
Read transmission identifier from input stream.
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
Acoustic transmission identifier.
JTransmission_t()
Default constructor.