tesseract 5.2.0
Loading...
Searching...
No Matches
tesseract::BoolParam Class Reference

#include <params.h>

Inheritance diagram for tesseract::BoolParam:
tesseract::Param

Public Member Functions

 BoolParam (bool value, const char *name, const char *comment, bool init, ParamsVectors *vec)
 
 ~BoolParam ()
 
 operator bool () const
 
void operator= (bool value)
 
void set_value (bool value)
 
void ResetToDefault ()
 
void ResetFrom (const ParamsVectors *vec)
 
- Public Member Functions inherited from tesseract::Param
 ~Param ()=default
 
const char * name_str () const
 
const char * info_str () const
 
bool is_init () const
 
bool is_debug () const
 
bool constraint_ok (SetParamConstraint constraint) const
 

Additional Inherited Members

- Protected Member Functions inherited from tesseract::Param
 Param (const char *name, const char *comment, bool init)
 
- Protected Attributes inherited from tesseract::Param
const char * name_
 
const char * info_
 
bool init_
 
bool debug_
 

Detailed Description

Definition at line 189 of file params.h.

Constructor & Destructor Documentation

◆ BoolParam()

tesseract::BoolParam::BoolParam ( bool  value,
const char *  name,
const char *  comment,
bool  init,
ParamsVectors vec 
)
inline

Definition at line 191 of file params.h.

192 : Param(name, comment, init) {
193 value_ = value;
194 default_ = value;
195 params_vec_ = &(vec->bool_params);
196 vec->bool_params.push_back(this);
197 }
Param(const char *name, const char *comment, bool init)
Definition: params.h:136

◆ ~BoolParam()

tesseract::BoolParam::~BoolParam ( )
inline

Definition at line 198 of file params.h.

198 {
199 ParamUtils::RemoveParam<BoolParam>(this, params_vec_);
200 }

Member Function Documentation

◆ operator bool()

tesseract::BoolParam::operator bool ( ) const
inline

Definition at line 201 of file params.h.

201 {
202 return value_;
203 }

◆ operator=()

void tesseract::BoolParam::operator= ( bool  value)
inline

Definition at line 204 of file params.h.

204 {
205 value_ = value;
206 }

◆ ResetFrom()

void tesseract::BoolParam::ResetFrom ( const ParamsVectors vec)
inline

Definition at line 213 of file params.h.

213 {
214 for (auto *param : vec->bool_params) {
215 if (strcmp(param->name_str(), name_) == 0) {
216 // printf("overriding param %s=%s by =%s\n", name_, value_ ? "true" :
217 // "false", *param ? "true" : "false");
218 value_ = *param;
219 break;
220 }
221 }
222 }
const char * name_
Definition: params.h:141

◆ ResetToDefault()

void tesseract::BoolParam::ResetToDefault ( )
inline

Definition at line 210 of file params.h.

210 {
211 value_ = default_;
212 }

◆ set_value()

void tesseract::BoolParam::set_value ( bool  value)
inline

Definition at line 207 of file params.h.

207 {
208 value_ = value;
209 }

The documentation for this class was generated from the following file: