param_checks.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_UTIL_PARAM_CHECKS_HPP
15 #define MLPACK_CORE_UTIL_PARAM_CHECKS_HPP
16 
17 #include <mlpack/prereqs.hpp>
18 
19 namespace mlpack {
20 namespace util {
21 
51  util::Params& params,
52  const std::vector<std::string>& constraints,
53  const bool fatal = true,
54  const std::string& customErrorMessage = "",
55  const bool allowNone = false);
56 
87  util::Params& params,
88  const std::vector<std::string>& constraints,
89  const bool fatal = true,
90  const std::string& customErrorMessage = "");
91 
119  util::Params& params,
120  const std::vector<std::string>& constraints,
121  const bool fatal = true,
122  const std::string& customErrorMessage = "");
123 
148 template<typename T>
149 void RequireParamInSet(util::Params& params,
150  const std::string& paramName,
151  const std::vector<T>& set,
152  const bool fatal,
153  const std::string& errorMessage);
154 
179 template<typename T>
180 void RequireParamValue(util::Params& params,
181  const std::string& paramName,
182  const std::function<bool(T)>& conditional,
183  const bool fatal,
184  const std::string& errorMessage);
185 
197 void ReportIgnoredParam(
198  util::Params& params,
199  const std::vector<std::pair<std::string, bool>>& constraints,
200  const std::string& paramName);
201 
218 void ReportIgnoredParam(const std::string& paramName,
219  const std::string& reason);
220 
221 } // namespace util
222 } // namespace mlpack
223 
224 // Include implementation.
225 #include "param_checks_impl.hpp"
226 
227 #endif
void RequireNoneOrAllPassed(util::Params &params, const std::vector< std::string > &constraints, const bool fatal=true, const std::string &customErrorMessage="")
Require that either none or all of the given parameters in the constraints set were passed to the IO ...
Linear algebra utility functions, generally performed on matrices or vectors.
void RequireParamInSet(util::Params &params, const std::string &paramName, const std::vector< T > &set, const bool fatal, const std::string &errorMessage)
Require that a given parameter is in a set of allowable parameters.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void RequireParamValue(util::Params &params, const std::string &paramName, const std::function< bool(T)> &conditional, const bool fatal, const std::string &errorMessage)
Require that a given parameter satisfies the given conditional function.
void RequireAtLeastOnePassed(util::Params &params, const std::vector< std::string > &constraints, const bool fatal=true, const std::string &customErrorMessage="")
Require that at least one of the given parameters in the constraints set was passed to the IO object;...
void RequireOnlyOnePassed(util::Params &params, const std::vector< std::string > &constraints, const bool fatal=true, const std::string &customErrorMessage="", const bool allowNone=false)
Require that only one of the given parameters in the constraints set was passed to the IO object; oth...
void ReportIgnoredParam(util::Params &params, const std::vector< std::pair< std::string, bool >> &constraints, const std::string &paramName)
Report that a parameter is ignored, if each of the constraints given are satisfied.