68 static bool SetParam(
const char *name,
const char* value,
80 for (i = 0; i < global_vec.
size(); ++i) {
81 if (strcmp(global_vec[i]->name_str(), name) == 0)
return global_vec[i];
83 for (i = 0; i < member_vec.
size(); ++i) {
84 if (strcmp(member_vec[i]->name_str(), name) == 0)
return member_vec[i];
91 for (
int i = 0; i < vec->
size(); ++i) {
92 if ((*vec)[i] == param_ptr) {
131 Param(
const char *name,
const char *comment,
bool init) :
133 debug_ = (strstr(name,
"debug") !=
nullptr) || (strstr(name,
"display"));
144 IntParam(int32_t value,
const char *name,
const char *comment,
bool init,
151 ~IntParam() { ParamUtils::RemoveParam<IntParam>(
this, params_vec_); }
152 operator int32_t()
const {
return value_; }
168 BoolParam(
bool value,
const char *name,
const char *comment,
bool init,
175 ~BoolParam() { ParamUtils::RemoveParam<BoolParam>(
this, params_vec_); }
176 operator BOOL8()
const {
return value_; }
193 const char *comment,
bool init,
200 ~StringParam() { ParamUtils::RemoveParam<StringParam>(
this, params_vec_); }
228 ~DoubleParam() { ParamUtils::RemoveParam<DoubleParam>(
this, params_vec_); }
229 operator double()
const {
return value_; }
264 #define INT_VAR_H(name,val,comment)\ 265 tesseract::IntParam name 267 #define BOOL_VAR_H(name,val,comment)\ 268 tesseract::BoolParam name 270 #define STRING_VAR_H(name,val,comment)\ 271 tesseract::StringParam name 273 #define double_VAR_H(name,val,comment)\ 274 tesseract::DoubleParam name 276 #define INT_VAR(name,val,comment)\ 277 tesseract::IntParam name(val,#name,comment,false,GlobalParams()) 279 #define BOOL_VAR(name,val,comment)\ 280 tesseract::BoolParam name(val,#name,comment,false,GlobalParams()) 282 #define STRING_VAR(name,val,comment)\ 283 tesseract::StringParam name(val,#name,comment,false,GlobalParams()) 285 #define double_VAR(name,val,comment)\ 286 tesseract::DoubleParam name(val,#name,comment,false,GlobalParams()) 288 #define INT_MEMBER(name, val, comment, vec)\ 289 name(val, #name, comment, false, vec) 291 #define BOOL_MEMBER(name, val, comment, vec)\ 292 name(val, #name, comment, false, vec) 294 #define STRING_MEMBER(name, val, comment, vec)\ 295 name(val, #name, comment, false, vec) 297 #define double_MEMBER(name, val, comment, vec)\ 298 name(val, #name, comment, false, vec) 300 #define INT_INIT_MEMBER(name, val, comment, vec)\ 301 name(val, #name, comment, true, vec) 303 #define BOOL_INIT_MEMBER(name, val, comment, vec)\ 304 name(val, #name, comment, true, vec) 306 #define STRING_INIT_MEMBER(name, val, comment, vec)\ 307 name(val, #name, comment, true, vec) 309 #define double_INIT_MEMBER(name, val, comment, vec)\ 310 name(val, #name, comment, true, vec)
const char * info_str() const
DoubleParam(double value, const char *name, const char *comment, bool init, ParamsVectors *vec)
void operator=(int32_t value)
Param(const char *name, const char *comment, bool init)
IntParam(int32_t value, const char *name, const char *comment, bool init, ParamsVectors *vec)
void operator=(BOOL8 value)
GenericVector< IntParam * > int_params
GenericVector< BoolParam * > bool_params
static void PrintParams(FILE *fp, const ParamsVectors *member_params)
const char * c_str() const
bool constraint_ok(SetParamConstraint constraint) const
const char * string() const
static bool SetParam(const char *name, const char *value, SetParamConstraint constraint, ParamsVectors *member_params)
void set_value(const STRING &value)
static void ResetToDefaults(ParamsVectors *member_params)
BoolParam(bool value, const char *name, const char *comment, bool init, ParamsVectors *vec)
GenericVector< StringParam * > string_params
bool operator==(const STRING &other)
tesseract::ParamsVectors * GlobalParams()
const char * string() const
void operator=(const STRING &value)
static bool GetParamAsString(const char *name, const ParamsVectors *member_params, STRING *value)
const char * name_str() const
static bool ReadParamsFile(const char *file, SetParamConstraint constraint, ParamsVectors *member_params)
static bool ReadParamsFromFp(SetParamConstraint constraint, TFile *fp, ParamsVectors *member_params)
GenericVector< DoubleParam * > double_params
void set_value(int32_t value)
static T * FindParam(const char *name, const GenericVector< T *> &global_vec, const GenericVector< T *> &member_vec)
StringParam(const char *value, const char *name, const char *comment, bool init, ParamsVectors *vec)
void operator=(double value)
void set_value(BOOL8 value)
static void RemoveParam(T *param_ptr, GenericVector< T *> *vec)
void set_value(double value)