Changeset 1533
- Timestamp:
- Sep 25, 2008, 2:02:52 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r1513 r1533 33 33 commandline_test \ 34 34 consensus_inputranker_test data_lookup_1d_test \ 35 data_weight_test d istance_test \35 data_weight_test data_weight_proxy_test distance_test \ 36 36 ensemble_test feature_selection_test fileutil_test \ 37 37 index_test inputranker_test \ … … 65 65 data_lookup_1d_test_SOURCES = data_lookup_1d_test.cc 66 66 data_weight_test_SOURCES = data_weight_test.cc 67 data_weight_proxy_test_SOURCES = data_weight_proxy_test.cc 67 68 distance_test_SOURCES = distance_test.cc 68 69 ensemble_test_SOURCES = ensemble_test.cc -
trunk/yat/utility/DataWeight.h
r1487 r1533 29 29 /** 30 30 \brief Holds a pair of data and associated weight 31 32 \since New in yat 0.5 31 33 */ 32 34 class DataWeight -
trunk/yat/utility/DataWeightProxy.cc
r1532 r1533 20 20 */ 21 21 22 #include "DataWeight .h"22 #include "DataWeightProxy.h" 23 23 24 24 namespace theplu { … … 26 26 namespace utility { 27 27 28 DataWeight ::DataWeight(double data, doubleweight)28 DataWeightProxy::DataWeightProxy(double& data, double& weight) 29 29 : data_(data), weight_(weight) {} 30 30 31 32 double& DataWeight::data(void) 31 double& DataWeightProxy::data(void) 33 32 { 34 33 return data_; … … 36 35 37 36 38 const double& DataWeight ::data(void) const37 const double& DataWeightProxy::data(void) const 39 38 { 40 39 return data_; 41 40 } 42 41 43 double& DataWeight::weight(void) 42 43 double& DataWeightProxy::weight(void) 44 44 { 45 45 return weight_; … … 47 47 48 48 49 const double& DataWeight ::weight(void) const49 const double& DataWeightProxy::weight(void) const 50 50 { 51 51 return weight_; 52 52 } 53 53 54 55 bool operator==(const DataWeight& lhs, const DataWeight& rhs)56 {57 return lhs.data() == rhs.data();58 }59 60 61 bool operator!=(const DataWeight& lhs, const DataWeight& rhs)62 {63 return ! (lhs == rhs);64 }65 66 67 bool operator<(const DataWeight& lhs, const DataWeight& rhs)68 {69 return lhs.data() < rhs.data();70 }71 72 73 bool operator>(const DataWeight& lhs, const DataWeight& rhs)74 {75 return rhs < lhs;76 }77 78 79 bool operator<=(const DataWeight& lhs, const DataWeight& rhs)80 {81 return rhs > lhs;82 }83 84 85 bool operator>=(const DataWeight& lhs, const DataWeight& rhs)86 {87 return rhs < lhs;88 }89 90 91 54 }}} // of namespace utility, yat, and theplu -
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_ 3 3 4 4 // $Id$ … … 28 28 29 29 /** 30 \brief Holds a pair of data and associated weight 30 \internal 31 32 \brief Proxy class for DataWeight 31 33 */ 32 class DataWeight 34 class DataWeightProxy 33 35 { 34 36 public: … … 39 41 \param weight weight value to hold 40 42 */ 41 explicit DataWeight(double data=0.0, double weight=1.0);43 DataWeightProxy(double& data, double& weight); 42 44 43 45 /** … … 61 63 const double& weight(void) const; 62 64 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&); 68 71 }; 69 70 /**71 \brief equality operator72 73 \return true if data are equal74 */75 bool operator==(const DataWeight&, const DataWeight&);76 77 /**78 \brief inequality operator79 80 \return true if data are inequal81 */82 bool operator!=(const DataWeight&, const DataWeight&);83 84 /**85 \brief comparison operator86 87 \return true if lhs data is less than rhs data88 */89 bool operator<(const DataWeight&, const DataWeight&);90 91 /**92 \brief comparison operator93 94 \return true if lhs data is greater than rhs data95 */96 bool operator>(const DataWeight&, const DataWeight&);97 98 /**99 \brief comparison operator100 101 \return true if rhs > lhs102 */103 bool operator<=(const DataWeight&, const DataWeight&);104 105 /**106 \brief comparison operator107 108 \return true if rhs < lhs109 */110 bool operator>=(const DataWeight&, const DataWeight&);111 112 72 113 73 }}} // of namespace utility, yat, and theplu -
trunk/yat/utility/Makefile.am
r1527 r1533 23 23 noinst_LTLIBRARIES = libutility.la 24 24 libutility_la_SOURCES = \ 25 Alignment.cc ColumnStream.cc CommandLine.cc DataWeight.cc \25 Alignment.cc ColumnStream.cc CommandLine.cc DataWeight.cc DataWeightProxy.cc \ 26 26 FileUtil.cc Index.cc kNNI.cc \ 27 27 Matrix.cc MatrixWeighted.cc NNI.cc Option.cc \ … … 36 36 include_utility_HEADERS = \ 37 37 Alignment.h ColumnStream.h CommandLine.h \ 38 Container2DIterator.h DataIterator.h DataWeight.h \38 Container2DIterator.h DataIterator.h DataWeight.h DataWeightProxy.h \ 39 39 deprecate.h Exception.h FileUtil.h Index.h \ 40 40 IteratorPolicy.h iterator_traits.h \
Note: See TracChangeset
for help on using the changeset viewer.