Go to the documentation of this file.00001
00002
00003
00004 #include "ccutil.h"
00005
00006 namespace tesseract {
00007 CCUtil::CCUtil() :
00008 params_(),
00009 STRING_INIT_MEMBER(m_data_sub_dir,
00010 "tessdata/", "Directory for data files", ¶ms_),
00011 #ifdef _WIN32
00012 STRING_INIT_MEMBER(tessedit_module_name, WINDLLNAME,
00013 "Module colocated with tessdata dir", ¶ms_),
00014 #endif
00015 INT_INIT_MEMBER(ambigs_debug_level, 0, "Debug level for unichar ambiguities",
00016 ¶ms_),
00017 BOOL_MEMBER(use_definite_ambigs_for_classifier, 0, "Use definite"
00018 " ambiguities when running character classifier", ¶ms_),
00019 BOOL_MEMBER(use_ambigs_for_adaption, 0, "Use ambigs for deciding"
00020 " whether to adapt to a character", ¶ms_) {
00021 }
00022
00023 CCUtil::~CCUtil() {
00024 }
00025
00026
00027 CCUtilMutex::CCUtilMutex() {
00028 #ifdef _WIN32
00029 mutex_ = CreateMutex(0, FALSE, 0);
00030 #else
00031 pthread_mutex_init(&mutex_, NULL);
00032 #endif
00033 }
00034
00035 void CCUtilMutex::Lock() {
00036 #ifdef _WIN32
00037 WaitForSingleObject(mutex_, INFINITE);
00038 #else
00039 pthread_mutex_lock(&mutex_);
00040 #endif
00041 }
00042
00043 void CCUtilMutex::Unlock() {
00044 #ifdef _WIN32
00045 ReleaseMutex(mutex_);
00046 #else
00047 pthread_mutex_unlock(&mutex_);
00048 #endif
00049 }
00050
00051 CCUtilMutex tprintfMutex;
00052 }