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_; }
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)
static void ResetToDefaults(ParamsVectors *member_params)
static bool ReadParamsFromFp(FILE *fp, inT64 end_offset, SetParamConstraint constraint, ParamsVectors *member_params)
bool constraint_ok(SetParamConstraint constraint) const
static void PrintParams(FILE *fp, const ParamsVectors *member_params)
static bool GetParamAsString(const char *name, const ParamsVectors *member_params, STRING *value)
tesseract::ParamsVectors * GlobalParams()
void operator=(const STRING &value)
void set_value(BOOL8 value)
void operator=(double value)
const char * name_str() const
void set_value(double value)
StringParam(const char *value, const char *name, const char *comment, bool init, ParamsVectors *vec)
bool operator==(const STRING &other)
const char * c_str() const
IntParam(inT32 value, const char *name, const char *comment, bool init, ParamsVectors *vec)
GenericVector< IntParam * > int_params
DoubleParam(double value, const char *name, const char *comment, bool init, ParamsVectors *vec)
void operator=(inT32 value)
static bool SetParam(const char *name, const char *value, SetParamConstraint constraint, ParamsVectors *member_params)
const char * info_str() const
GenericVector< BoolParam * > bool_params
static T * FindParam(const char *name, const GenericVector< T * > &global_vec, const GenericVector< T * > &member_vec)
Param(const char *name, const char *comment, bool init)
GenericVector< DoubleParam * > double_params
void set_value(inT32 value)
BoolParam(bool value, const char *name, const char *comment, bool init, ParamsVectors *vec)
static bool ReadParamsFile(const char *file, SetParamConstraint constraint, ParamsVectors *member_params)
const char * string() const
GenericVector< StringParam * > string_params
const char * string() const
void set_value(const STRING &value)
void operator=(BOOL8 value)
static void RemoveParam(T *param_ptr, GenericVector< T * > *vec)