BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
triple.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: triple.h,v 1.9 2003/08/26 08:04:12 oliver Exp $
5 //
6 
7 #ifndef BALL_DATATYPE_TRIPLE_H
8 #define BALL_DATATYPE_TRIPLE_H
9 
10 #ifndef BALL_COMMON_H
11 # include <BALL/common.h>
12 #endif
13 
14 namespace BALL
15 {
23  template <typename T1, typename T2, typename T3>
24  class Triple
25  {
26  public:
27 
31 
33 
34 
37  Triple();
38 
44  Triple(const Triple& triple, bool deep = true);
45 
53  Triple(const T1& new_first, const T2& new_second, const T3& new_third);
54 
58  virtual ~Triple();
60 
63  virtual void clear();
64 
68 
73  const Triple& operator = (const Triple& triple);
74 
77  void set(const T1& t1, const T2& t2, const T3& t3);
78 
81  void get(T1& first, T2& second, T3& third) const;
82 
84 
87 
91  bool operator == (const Triple& triple) const;
92 
95  bool operator != (const Triple& triple) const;
96 
102  bool operator < (const Triple& triple) const;
103 
106  bool operator <= (const Triple& triple) const;
107 
110  bool operator >= (const Triple& triple) const;
111 
114  bool operator > (const Triple& triple) const;
115 
117 
121 
124  T1 first;
125 
128  T2 second;
129 
132  T3 third;
134  };
135 
136  template <typename T1, typename T2, typename T3>
138  {
139  }
140 
141  template <typename T1, typename T2, typename T3>
143  (const Triple<T1, T2, T3>& triple, bool /* deep */)
144  : first(triple.first),
145  second(triple.second),
146  third(triple.third) {
147  }
148 
149  template <typename T1, typename T2, typename T3>
151  (const T1& new_first, const T2& new_second, const T3& new_third)
152  : first(new_first),
153  second(new_second),
154  third(new_third)
155  {
156  }
157 
158  template <typename T1, typename T2, typename T3>
160  {
161  }
162 
163  template <typename T1, typename T2, typename T3>
164  BALL_INLINE
165  void Triple<T1, T2, T3>::set(const T1& new_first, const T2& new_second, const T3& new_third)
166  {
167  first = new_first;
168  second = new_second;
169  third = new_third;
170  }
171 
172  template <typename T1, typename T2, typename T3>
173  BALL_INLINE
175  (const Triple<T1, T2, T3>& triple)
176  {
177  first = triple.first;
178  second = triple.second;
179  third = triple.third;
180 
181  return *this;
182  }
183 
184  template <typename T1, typename T2, typename T3>
185  BALL_INLINE
186  void Triple<T1, T2, T3>::get(T1& t1, T2& t2, T3& t3)
187  const
188  {
189  t1 = first;
190  t2 = second;
191  t3 = third;
192  }
193 
194  template <typename T1, typename T2, typename T3>
195  BALL_INLINE
197  const
198  {
199  return (first == triple.first
200  && second == triple.second
201  && third == triple.third);
202  }
203 
204  template <typename T1, typename T2, typename T3>
205  BALL_INLINE
207  const
208  {
209  return (first != triple.first
210  || second != triple.second
211  || third != triple.third);
212  }
213 
214  template <typename T1, typename T2, typename T3>
215  BALL_INLINE
217  {
218  first = T1();
219  second = T2();
220  third = T3();
221  }
222 
223  template <typename T1, typename T2, typename T3>
224  BALL_INLINE
226  (const Triple<T1, T2, T3>& triple) const
227  {
228  return ((first < triple.first)
229  || ((first == triple.first) && (second < triple.second))
230  || ((first == triple.first) && (second == triple.second) && (third < triple.third)));
231  }
232 
233  template <typename T1, typename T2, typename T3>
234  BALL_INLINE
236  (const Triple<T1, T2, T3>& triple) const
237  {
238  return ((first < triple.first)
239  || ((first == triple.first) && (second < triple.second))
240  || ((first == triple.first) && (second == triple.second) && (third < triple.third))
241  || ((first == triple.first) && (second == triple.second) && (third == triple.third)));
242  }
243 
244  template <typename T1, typename T2, typename T3>
245  BALL_INLINE
247  (const Triple<T1, T2, T3>& triple) const
248  {
249  return ((first > triple.first)
250  || ((first == triple.first) && (second > triple.second))
251  || ((first == triple.first) && (second == triple.second) && (third > triple.third))
252  || ((first == triple.first) && (second == triple.second) && (third == triple.third)));
253  }
254 
255  template <typename T1, typename T2, typename T3>
256  BALL_INLINE
258  (const Triple<T1, T2, T3>& triple) const
259  {
260  return ((first > triple.first)
261  || ((first == triple.first) && (second > triple.second))
262  || ((first == triple.first) && (second == triple.second) && (third > triple.third)));
263  }
264 } // namespace BALL
265 
266 #endif // BALL_DATATYPE_TRIPLE_H