Changeset 718 for trunk/yat/utility
- Timestamp:
- Dec 26, 2006, 10:56:26 AM (16 years ago)
- Location:
- trunk/yat/utility
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/CommandLine.cc
r687 r718 2 2 3 3 /* 4 Copyright (C) 2006 Peter Johansson 4 Copyright (C) 2006 Peter Johansson, Jari Hakkinen 5 5 6 6 This file is part of the yat library, http://lev.thep.lu.se/trac/yat … … 98 98 add('\0', name, arg, description); 99 99 } 100 100 101 101 102 102 void CommandLine::add_parameter(char name, … … 107 107 } 108 108 109 110 void CommandLine::add_parameter(char short_name, const std::string& long_name, 111 Option::argument_type arg, 112 const std::string& description) 113 { 114 add(short_name, long_name, arg, description); 115 } 116 117 118 bool CommandLine::is_long_option(const std::string& str) 119 { 120 return (str.size()>3 && str[0]=='-' && str[1]=='-'); 121 } 122 123 124 bool CommandLine::is_short_option(const std::string& str) 125 { 126 return (str.size()==2 && str[0]=='-' && isalpha(str[1])); 127 } 128 129 130 u_int& CommandLine::max_argument(void) 131 { 132 return max_argument_; 133 } 134 135 136 u_int& CommandLine::min_argument(void) 137 { 138 return min_argument_; 139 } 140 109 141 110 142 void CommandLine::parse(int argc,const char* argv[]) … … 147 179 } 148 180 } 149 181 182 183 void CommandLine::set_general_description(const std::string& description) 184 { 185 general_description_=description; 186 } 187 150 188 151 189 bool CommandLine::update(const std::string& key, -
trunk/yat/utility/CommandLine.h
r703 r718 5 5 6 6 /* 7 Copyright (C) 2006 Peter Johansson 7 Copyright (C) 2006 Peter Johansson, Jari Hakkinen 8 8 9 9 This file is part of the yat library, http://lev.thep.lu.se/trac/yat … … 136 136 /// @param description string used in help display 137 137 /// 138 inline void add_parameter(const char short_name, 139 const std::string& long_name, 140 Option::argument_type arg = Option::no_arg, 141 const std::string& description = std::string()) 142 { add(short_name, long_name, arg, description); } 138 void add_parameter(char short_name, const std::string& long_name, 139 Option::argument_type arg = Option::no_arg, 140 const std::string& description = std::string()); 143 141 144 142 /// … … 153 151 /// @return maximal number of arguments allowed. 154 152 /// 155 inline u_int& max_argument(void) { return max_argument_; }153 u_int& max_argument(void); 156 154 157 155 /// … … 161 159 /// @return minimal number of arguments allowed. 162 160 /// 163 inline u_int& min_argument(void) { return min_argument_; }161 u_int& min_argument(void); 164 162 165 163 /// … … 184 182 /// giving a general explanation what program is doing. 185 183 /// 186 inline void set_general_description(const std::string& description) 187 { general_description_=description; } 184 void set_general_description(const std::string& description); 188 185 189 186 /// … … 222 219 void usage(void) const; 223 220 224 221 private: 225 222 Option* add(char short_name, 226 223 const std::string& long_name, 227 224 Option::argument_type arg, 228 225 const std::string& describtion); 229 230 inline bool is_long_option(const std::string& str) 231 { return (str.size()>3 && str[0]=='-' && str[1]=='-'); } 232 233 inline bool is_short_option(const std::string& str) 234 { return (str.size()==2 && str[0]=='-' && isalpha(str[1])); } 235 226 bool is_long_option(const std::string& str); 227 bool is_short_option(const std::string& str); 236 228 void print_try_help(void) const; 237 229 std::string split(std::string&, char) const; 238 230 bool update(const std::string& key, const std::string& value); 239 240 231 241 232 typedef std::map<std::string, Option*> key2option; -
trunk/yat/utility/Exception.h
r687 r718 42 42 /// Default constructor 43 43 /// 44 IO_error(void) throw() : std::runtime_error("IO_error:") {}44 inline IO_error(void) throw() : std::runtime_error("IO_error:") {} 45 45 46 46 /// 47 47 /// Constructor for exception with message 48 48 /// 49 IO_error(std::string message) throw()49 inline IO_error(std::string message) throw() 50 50 : std::runtime_error("IO_error: " + message) {} 51 51 }; -
trunk/yat/utility/NNI.cc
r687 r718 75 75 76 76 77 const utility::matrix& NNI::imputed_data(void) const 78 { 79 return imputed_data_; 80 } 81 82 83 const std::vector<size_t>& NNI::not_imputed(void) const 84 { 85 return not_imputed_; 86 } 87 77 88 78 89 // Contributing nearest neighbours are added up to the user set … … 92 103 } 93 104 94 95 105 }}} // of namespace utility, yat, and theplu -
trunk/yat/utility/NNI.h
r687 r718 103 103 /// @return A const reference to the modified data. 104 104 /// 105 const utility::matrix& imputed_data(void) const { return imputed_data_; }105 const utility::matrix& imputed_data(void) const; 106 106 107 107 /// 108 108 /// @return indices of rows in data matrix not imputed 109 109 /// 110 inline std::vector<size_t> not_imputed(void) const { return not_imputed_; }110 const std::vector<size_t>& not_imputed(void) const; 111 111 112 112 protected:
Note: See TracChangeset
for help on using the changeset viewer.