kwave  18.07.70
Triple.h
Go to the documentation of this file.
1 /***************************************************************************
2  Triple.h - Template class for holding three elements
3  -------------------
4  begin : Feb 04 2001
5  copyright : (C) 2001 by Thomas Eschenbacher
6  email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef TRIPLE_H
19 #define TRIPLE_H
20 
21 #include "config.h"
22 
23 namespace Kwave
24 {
25 
26  template <class T1, class T2, class T3> class Triple
27  {
28  public:
31  :m_first(),
32  m_second(),
33  m_third()
34  {}
35 
37  Triple(const T1 &first, const T2 &second, const T3 &third)
38  :m_first(first),
39  m_second(second),
40  m_third(third)
41  {}
42 
44  Triple(const Triple &copy)
45  :m_first(copy.first()),
46  m_second(copy.second()),
47  m_third(copy.third())
48  {}
49 
51  virtual ~Triple() {}
52 
55  m_first = t2.first();
56  m_second = t2.second();
57  m_third = t2.third();
58  return *this;
59  }
60 
62  inline bool operator==(const Triple<T1,T2,T3> &t2) const {
63  return (
64  ( m_first == t2.first() ) &&
65  ( m_second == t2.second() ) &&
66  ( m_third == t2.third() )
67  );
68  }
69 
71  inline const T1 &first() const { return m_first; }
72 
74  inline const T2 &second() const { return m_second; }
75 
77  inline const T3 &third() const { return m_third; }
78 
79  private:
81  T1 m_first;
82 
85 
87  T3 m_third;
88  };
89 }
90 
91 #endif /* TRIPLE_H */
92 
93 //***************************************************************************
94 //***************************************************************************
Triple(const Triple &copy)
Definition: Triple.h:44
T3 m_third
Definition: Triple.h:87
Definition: App.h:33
const T2 & second() const
Definition: Triple.h:74
T1 m_first
Definition: Triple.h:81
Triple< T1, T2, T3 > & operator=(const Triple< T1, T2, T3 > &t2)
Definition: Triple.h:54
bool operator==(const Triple< T1, T2, T3 > &t2) const
Definition: Triple.h:62
const T3 & third() const
Definition: Triple.h:77
Triple(const T1 &first, const T2 &second, const T3 &third)
Definition: Triple.h:37
const T1 & first() const
Definition: Triple.h:71
virtual ~Triple()
Definition: Triple.h:51
T2 m_second
Definition: Triple.h:84