source: trunk/yat/utility/DataWeight.h @ 1533

Last change on this file since 1533 was 1533, checked in by Peter, 13 years ago

refs #368 - introducing proxy class

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1#ifndef _theplu_yat_utility_data_weight_
2#define _theplu_yat_utility_data_weight_
3
4// $Id: DataWeight.h 1533 2008-09-25 12:02:52Z peter $
5
6/*
7  Copyright (C) 2008 Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25namespace theplu {
26namespace yat {
27namespace utility {
28
29  /**
30     \brief Holds a pair of data and associated weight
31
32     \since New in yat 0.5
33  */
34  class DataWeight
35  {
36  public:
37    /**
38       \brief Default constructor
39
40       \param data data value to hold
41       \param weight weight value to hold
42     */
43    explicit DataWeight(double data=0.0, double weight=1.0);
44
45    /**
46       \return reference to data
47     */
48    double& data(void);
49
50    /**
51       \return const reference to data
52     */
53    const double& data(void) const;
54
55    /**
56       \return reference to weight
57     */
58    double& weight(void);
59
60    /**
61       \return const reference to weight
62     */
63    const double& weight(void) const;
64  private:
65    double data_;
66    double weight_;
67    // using compiler generated copy
68    // DataWeight(const DataWeight&)
69    // DataWeight& operator=(const DataWeight&);
70  };
71
72  /**
73     \brief equality operator
74
75     \return true if data are equal
76   */
77  bool operator==(const DataWeight&, const DataWeight&);
78
79  /**
80     \brief inequality operator
81
82     \return true if data are inequal
83   */
84  bool operator!=(const DataWeight&, const DataWeight&);
85
86  /**
87     \brief comparison operator
88
89     \return true if lhs data is less than rhs data
90   */
91  bool operator<(const DataWeight&, const DataWeight&);
92
93  /**
94     \brief comparison operator
95
96     \return true if lhs data is greater than rhs data
97   */
98  bool operator>(const DataWeight&, const DataWeight&);
99
100  /**
101     \brief comparison operator
102
103     \return true if  rhs > lhs
104   */
105  bool operator<=(const DataWeight&, const DataWeight&);
106
107  /**
108     \brief comparison operator
109
110     \return true if  rhs < lhs
111   */
112  bool operator>=(const DataWeight&, const DataWeight&);
113
114
115}}} // of namespace utility, yat, and theplu
116
117#endif
Note: See TracBrowser for help on using the repository browser.