mlpack
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 
50  const std::vector<std::string>& constraints,
51  const bool fatal = true,
52  const std::string& customErrorMessage = "",
53  const bool allowNone = false);
54 
84  const std::vector<std::string>& constraints,
85  const bool fatal = true,
86  const std::string& customErrorMessage = "");
87 
114  const std::vector<std::string>& constraints,
115  const bool fatal = true,
116  const std::string& customErrorMessage = "");
117 
141 template<typename T>
142 void RequireParamInSet(const std::string& paramName,
143  const std::vector<T>& set,
144  const bool fatal,
145  const std::string& errorMessage);
146 
170 template<typename T>
171 void RequireParamValue(const std::string& paramName,
172  const std::function<bool(T)>& conditional,
173  const bool fatal,
174  const std::string& errorMessage);
175 
186 void ReportIgnoredParam(
187  const std::vector<std::pair<std::string, bool>>& constraints,
188  const std::string& paramName);
189 
206 void ReportIgnoredParam(const std::string& paramName,
207  const std::string& reason);
208 
209 } // namespace util
210 } // namespace mlpack
211 
212 // Include implementation.
213 #include "param_checks_impl.hpp"
214 
215 #endif
void RequireParamInSet(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.
Definition: param_checks_impl.hpp:181
void RequireAtLeastOnePassed(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;...
Definition: param_checks_impl.hpp:92
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
void RequireOnlyOnePassed(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...
Definition: param_checks_impl.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
void RequireNoneOrAllPassed(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 ...
Definition: param_checks_impl.hpp:138
void RequireParamValue(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.
Definition: param_checks_impl.hpp:206
void ReportIgnoredParam(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.
Definition: param_checks_impl.hpp:226