69 static bool SetParam(
const char *name,
const char* value,
81 for (i = 0; i < global_vec.
size(); ++i) {
82 if (strcmp(global_vec[i]->name_str(), name) == 0)
return global_vec[i];
84 for (i = 0; i < member_vec.
size(); ++i) {
85 if (strcmp(member_vec[i]->name_str(), name) == 0)
return member_vec[i];
92 for (
int i = 0; i < vec->
size(); ++i) {
93 if ((*vec)[i] == param_ptr) {
132 Param(
const char *name,
const char *comment,
bool init) :
134 debug_ = (strstr(name,
"debug") != NULL) || (strstr(name,
"display"));
152 ~IntParam() { ParamUtils::RemoveParam<IntParam>(
this, params_vec_); }
153 operator inT32()
const {
return value_; }
169 BoolParam(
bool value,
const char *name,
const char *comment,
bool init,
176 ~BoolParam() { ParamUtils::RemoveParam<BoolParam>(
this, params_vec_); }
177 operator BOOL8()
const {
return value_; }
194 const char *comment,
bool init,
201 ~StringParam() { ParamUtils::RemoveParam<StringParam>(
this, params_vec_); }
229 ~DoubleParam() { ParamUtils::RemoveParam<DoubleParam>(
this, params_vec_); }
230 operator double()
const {
return value_; }
265 #define INT_VAR_H(name,val,comment)\ 266 tesseract::IntParam name 268 #define BOOL_VAR_H(name,val,comment)\ 269 tesseract::BoolParam name 271 #define STRING_VAR_H(name,val,comment)\ 272 tesseract::StringParam name 274 #define double_VAR_H(name,val,comment)\ 275 tesseract::DoubleParam name 277 #define INT_VAR(name,val,comment)\ 278 tesseract::IntParam name(val,#name,comment,false,GlobalParams()) 280 #define BOOL_VAR(name,val,comment)\ 281 tesseract::BoolParam name(val,#name,comment,false,GlobalParams()) 283 #define STRING_VAR(name,val,comment)\ 284 tesseract::StringParam name(val,#name,comment,false,GlobalParams()) 286 #define double_VAR(name,val,comment)\ 287 tesseract::DoubleParam name(val,#name,comment,false,GlobalParams()) 289 #define INT_INIT_VAR(name,val,comment)\ 290 tesseract::IntParam name(val,#name,comment,true,GlobalParams()) 292 #define BOOL_INIT_VAR(name,val,comment)\ 293 tesseract::BoolParam name(val,#name,comment,true,GlobalParams()) 295 #define STRING_INIT_VAR(name,val,comment)\ 296 tesseract::StringParam name(val,#name,comment,true,GlobalParams()) 298 #define double_INIT_VAR(name,val,comment)\ 299 tesseract::DoubleParam name(val,#name,comment,true,GlobalParams()) 301 #define INT_MEMBER(name, val, comment, vec)\ 302 name(val, #name, comment, false, vec) 304 #define BOOL_MEMBER(name, val, comment, vec)\ 305 name(val, #name, comment, false, vec) 307 #define STRING_MEMBER(name, val, comment, vec)\ 308 name(val, #name, comment, false, vec) 310 #define double_MEMBER(name, val, comment, vec)\ 311 name(val, #name, comment, false, vec) 313 #define INT_INIT_MEMBER(name, val, comment, vec)\ 314 name(val, #name, comment, true, vec) 316 #define BOOL_INIT_MEMBER(name, val, comment, vec)\ 317 name(val, #name, comment, true, vec) 319 #define STRING_INIT_MEMBER(name, val, comment, vec)\ 320 name(val, #name, comment, true, vec) 322 #define double_INIT_MEMBER(name, val, comment, vec)\ 323 name(val, #name, comment, true, vec)
GenericVector< BoolParam * > bool_params
bool constraint_ok(SetParamConstraint constraint) const
void operator=(double value)
static bool GetParamAsString(const char *name, const ParamsVectors *member_params, STRING *value)
tesseract::ParamsVectors TESS_API * GlobalParams()
void set_value(double value)
GenericVector< DoubleParam * > double_params
const char * c_str() const
const char * string() const
GenericVector< StringParam * > string_params
GenericVector< IntParam * > int_params
static void ResetToDefaults(ParamsVectors *member_params)
const char * string() const
const char * name_str() const
Param(const char *name, const char *comment, bool init)
void set_value(BOOL8 value)
static void RemoveParam(T *param_ptr, GenericVector< T *> *vec)
bool operator==(const STRING &other)
void operator=(BOOL8 value)
static bool SetParam(const char *name, const char *value, SetParamConstraint constraint, ParamsVectors *member_params)
BoolParam(bool value, const char *name, const char *comment, bool init, ParamsVectors *vec)
static bool ReadParamsFromFp(FILE *fp, inT64 end_offset, SetParamConstraint constraint, ParamsVectors *member_params)
DoubleParam(double value, const char *name, const char *comment, bool init, ParamsVectors *vec)
static bool TESS_API ReadParamsFile(const char *file, SetParamConstraint constraint, ParamsVectors *member_params)
const char * info_str() const
StringParam(const char *value, const char *name, const char *comment, bool init, ParamsVectors *vec)
void operator=(inT32 value)
void set_value(const STRING &value)
void set_value(inT32 value)
static T * FindParam(const char *name, const GenericVector< T *> &global_vec, const GenericVector< T *> &member_vec)
static void PrintParams(FILE *fp, const ParamsVectors *member_params)
IntParam(inT32 value, const char *name, const char *comment, bool init, ParamsVectors *vec)
void operator=(const STRING &value)