source: trunk/yat/utility/DataWeightProxy.h @ 1535

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

fixing DataWeightProxy?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1#ifndef _theplu_yat_utility_data_weight_proxy_
2#define _theplu_yat_utility_data_weight_proxy_
3
4// $Id: DataWeightProxy.h 1535 2008-09-25 19:01:48Z 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
25#include "DataWeight.h"
26
27namespace theplu {
28namespace yat {
29namespace utility {
30
31  /**
32     \internal
33
34     \brief Proxy class for DataWeight
35  */
36  class DataWeightProxy
37  {
38  public:
39    /**
40       \brief Default constructor
41
42       \param data data value to hold
43       \param weight weight value to hold
44     */
45    DataWeightProxy(double& data, double& weight);
46
47    /**
48       \return reference to data
49     */
50    double& data(void);
51
52    /**
53       \return const reference to data
54     */
55    const double& data(void) const;
56
57    /**
58       \return reference to weight
59     */
60    double& weight(void);
61
62    /**
63       \return const reference to weight
64     */
65    const double& weight(void) const;
66
67    /**
68       \brief assignment operator
69     */
70    DataWeightProxy& operator=(const DataWeight& rhs);
71
72    /**
73       \brief Conversion to DataWeight
74     */
75    operator DataWeight() const;
76
77  private:
78    double& data_;
79    double& weight_;
80
81    // no copying
82    DataWeightProxy(const DataWeightProxy&);
83    DataWeightProxy& operator=(const DataWeightProxy&);
84  };
85
86}}} // of namespace utility, yat, and theplu
87
88#endif
Note: See TracBrowser for help on using the repository browser.