source: trunk/yat/utility/DataWeightProxy.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: 1.6 KB
Line 
1#ifndef _theplu_yat_utility_data_weight_proxy_
2#define _theplu_yat_utility_data_weight_proxy_
3
4// $Id: DataWeightProxy.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     \internal
31
32     \brief Proxy class for DataWeight
33  */
34  class DataWeightProxy
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    DataWeightProxy(double& data, double& weight);
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
68    // no copying
69    DataWeightProxy(const DataWeightProxy&);
70    DataWeightProxy& operator=(const DataWeightProxy&);
71  };
72
73}}} // of namespace utility, yat, and theplu
74
75#endif
Note: See TracBrowser for help on using the repository browser.