Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ccutil.cpp
Go to the documentation of this file.
1 // Copyright 2008 Google Inc. All Rights Reserved.
2 // Author: scharron@google.com (Samuel Charron)
3
4 #include "ccutil.h"
5
6 namespace tesseract {
7 CCUtil::CCUtil() :
8 params_(),
9 STRING_INIT_MEMBER(m_data_sub_dir,
10 "tessdata/", "Directory for data files", &params_),
11 #ifdef _WIN32
12 STRING_INIT_MEMBER(tessedit_module_name, WINDLLNAME,
13 "Module colocated with tessdata dir", &params_),
14 #endif
15 INT_INIT_MEMBER(ambigs_debug_level, 0, "Debug level for unichar ambiguities",
16 &params_),
17 BOOL_MEMBER(use_definite_ambigs_for_classifier, 0, "Use definite"
18 " ambiguities when running character classifier", &params_),
19 BOOL_MEMBER(use_ambigs_for_adaption, 0, "Use ambigs for deciding"
20 " whether to adapt to a character", &params_) {
21 }
22
23 CCUtil::~CCUtil() {
24 }
25
26
27 CCUtilMutex::CCUtilMutex() {
28 #ifdef _WIN32
29 mutex_ = CreateMutex(0, FALSE, 0);
30 #else
31 pthread_mutex_init(&mutex_, NULL);
32 #endif
33 }
34
35 void CCUtilMutex::Lock() {
36 #ifdef _WIN32
37 WaitForSingleObject(mutex_, INFINITE);
38 #else
39 pthread_mutex_lock(&mutex_);
40 #endif
41 }
42
43 void CCUtilMutex::Unlock() {
44 #ifdef _WIN32
45 ReleaseMutex(mutex_);
46 #else
47 pthread_mutex_unlock(&mutex_);
48 #endif
49 }
50
51 CCUtilMutex tprintfMutex; // should remain global
52 } // namespace tesseract