1 | // $Id: DataWeight.cc 1486 2008-09-09 21:17:19Z jari $ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2008 Peter Johansson |
---|
5 | |
---|
6 | This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
7 | |
---|
8 | The yat library is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU General Public License as |
---|
10 | published by the Free Software Foundation; either version 3 of the |
---|
11 | License, or (at your option) any later version. |
---|
12 | |
---|
13 | The yat library is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with this program; if not, write to the Free Software |
---|
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
21 | 02111-1307, USA. |
---|
22 | */ |
---|
23 | |
---|
24 | #include "DataWeight.h" |
---|
25 | |
---|
26 | namespace theplu { |
---|
27 | namespace yat { |
---|
28 | namespace utility { |
---|
29 | |
---|
30 | DataWeight::DataWeight(double data, double weight) |
---|
31 | : data_(data), weight_(weight) {} |
---|
32 | |
---|
33 | |
---|
34 | double& DataWeight::data(void) |
---|
35 | { |
---|
36 | return data_; |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | const double& DataWeight::data(void) const |
---|
41 | { |
---|
42 | return data_; |
---|
43 | } |
---|
44 | |
---|
45 | double& DataWeight::weight(void) |
---|
46 | { |
---|
47 | return weight_; |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | const double& DataWeight::weight(void) const |
---|
52 | { |
---|
53 | return weight_; |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | bool operator==(const DataWeight& lhs, const DataWeight& rhs) |
---|
58 | { |
---|
59 | return lhs.data() == rhs.data(); |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | bool operator!=(const DataWeight& lhs, const DataWeight& rhs) |
---|
64 | { |
---|
65 | return ! (lhs == rhs); |
---|
66 | } |
---|
67 | |
---|
68 | |
---|
69 | bool operator<(const DataWeight& lhs, const DataWeight& rhs) |
---|
70 | { |
---|
71 | return lhs.data() < rhs.data(); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | bool operator>(const DataWeight& lhs, const DataWeight& rhs) |
---|
76 | { |
---|
77 | return rhs < lhs; |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | bool operator<=(const DataWeight& lhs, const DataWeight& rhs) |
---|
82 | { |
---|
83 | return rhs > lhs; |
---|
84 | } |
---|
85 | |
---|
86 | |
---|
87 | bool operator>=(const DataWeight& lhs, const DataWeight& rhs) |
---|
88 | { |
---|
89 | return rhs < lhs; |
---|
90 | } |
---|
91 | |
---|
92 | |
---|
93 | }}} // of namespace utility, yat, and theplu |
---|