Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #ifndef TESSERACT_CCUTIL_CCUTIL_H__
00020 #define TESSERACT_CCUTIL_CCUTIL_H__
00021
00022 #include "ambigs.h"
00023 #include "errcode.h"
00024 #include "strngs.h"
00025 #include "tessdatamanager.h"
00026 #include "params.h"
00027 #include "unicharset.h"
00028
00029 #ifdef _WIN32
00030 #include <windows.h>
00031 #else
00032 #include <pthread.h>
00033 #include <semaphore.h>
00034 #endif
00035
00036 namespace tesseract {
00037
00038 class CCUtilMutex {
00039 public:
00040 CCUtilMutex();
00041
00042 void Lock();
00043
00044 void Unlock();
00045 private:
00046 #ifdef _WIN32
00047 HANDLE mutex_;
00048 #else
00049 pthread_mutex_t mutex_;
00050 #endif
00051 };
00052
00053
00054 class CCUtil {
00055 public:
00056 CCUtil();
00057 virtual ~CCUtil();
00058
00059 public:
00060
00061 void main_setup(
00062 const char *argv0,
00063 const char *basename
00064 );
00065 ParamsVectors *params() { return ¶ms_; }
00066
00067 STRING datadir;
00068 STRING imagebasename;
00069 STRING lang;
00070 STRING language_data_path_prefix;
00071 TessdataManager tessdata_manager;
00072 UNICHARSET unicharset;
00073 UnicharAmbigs unichar_ambigs;
00074 STRING imagefile;
00075 STRING directory;
00076
00077 private:
00078 ParamsVectors params_;
00079
00080 public:
00081
00082
00083
00084 STRING_VAR_H(m_data_sub_dir, "tessdata/", "Directory for data files");
00085 #ifdef _WIN32
00086 STRING_VAR_H(tessedit_module_name, WINDLLNAME,
00087 "Module colocated with tessdata dir");
00088 #endif
00089 INT_VAR_H(ambigs_debug_level, 0, "Debug level for unichar ambiguities");
00090 BOOL_VAR_H(use_definite_ambigs_for_classifier, 0,
00091 "Use definite ambiguities when running character classifier");
00092 BOOL_VAR_H(use_ambigs_for_adaption, 0,
00093 "Use ambigs for deciding whether to adapt to a character");
00094 };
00095
00096 extern CCUtilMutex tprintfMutex;
00097 }
00098
00099 #endif // TESSERACT_CCUTIL_CCUTIL_H__