Ignore:
Timestamp:
Sep 25, 2008, 2:02:52 PM (13 years ago)
Author:
Peter
Message:

refs #368 - introducing proxy class

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/DataWeightProxy.h

    r1532 r1533  
    1 #ifndef _theplu_yat_utility_data_weight_
    2 #define _theplu_yat_utility_data_weight_
     1#ifndef _theplu_yat_utility_data_weight_proxy_
     2#define _theplu_yat_utility_data_weight_proxy_
    33
    44// $Id$
     
    2828
    2929  /**
    30      \brief Holds a pair of data and associated weight
     30     \internal
     31
     32     \brief Proxy class for DataWeight
    3133  */
    32   class DataWeight
     34  class DataWeightProxy
    3335  {
    3436  public:
     
    3941       \param weight weight value to hold
    4042     */
    41     explicit DataWeight(double data=0.0, double weight=1.0);
     43    DataWeightProxy(double& data, double& weight);
    4244
    4345    /**
     
    6163    const double& weight(void) const;
    6264  private:
    63     double data_;
    64     double weight_;
    65     // using compiler generated copy
    66     // DataWeight(const DataWeight&)
    67     // DataWeight& operator=(const DataWeight&);
     65    double& data_;
     66    double& weight_;
     67
     68    // no copying
     69    DataWeightProxy(const DataWeightProxy&);
     70    DataWeightProxy& operator=(const DataWeightProxy&);
    6871  };
    69 
    70   /**
    71      \brief equality operator
    72 
    73      \return true if data are equal
    74    */
    75   bool operator==(const DataWeight&, const DataWeight&);
    76 
    77   /**
    78      \brief inequality operator
    79 
    80      \return true if data are inequal
    81    */
    82   bool operator!=(const DataWeight&, const DataWeight&);
    83 
    84   /**
    85      \brief comparison operator
    86 
    87      \return true if lhs data is less than rhs data
    88    */
    89   bool operator<(const DataWeight&, const DataWeight&);
    90 
    91   /**
    92      \brief comparison operator
    93 
    94      \return true if lhs data is greater than rhs data
    95    */
    96   bool operator>(const DataWeight&, const DataWeight&);
    97 
    98   /**
    99      \brief comparison operator
    100 
    101      \return true if  rhs > lhs
    102    */
    103   bool operator<=(const DataWeight&, const DataWeight&);
    104 
    105   /**
    106      \brief comparison operator
    107 
    108      \return true if  rhs < lhs
    109    */
    110   bool operator>=(const DataWeight&, const DataWeight&);
    111 
    11272
    11373}}} // of namespace utility, yat, and theplu
Note: See TracChangeset for help on using the changeset viewer.