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.h
Go to the documentation of this file.
1
2 // File: ccutil.h
3 // Description: ccutil class.
4 // Author: Samuel Charron
5 //
6 // (C) Copyright 2006, Google Inc.
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
18
19 #ifndef TESSERACT_CCUTIL_CCUTIL_H__
20 #define TESSERACT_CCUTIL_CCUTIL_H__
21
22 #include "ambigs.h"
23 #include "errcode.h"
24 #include "strngs.h"
25 #include "tessdatamanager.h"
26 #include "params.h"
27 #include "unicharset.h"
28
29 #ifdef _WIN32
30 #include <windows.h>
31 #else
32 #include <pthread.h>
33 #include <semaphore.h>
34 #endif
35
36 namespace tesseract {
37
38 class CCUtilMutex {
39 public:
40 CCUtilMutex();
41
42 void Lock();
43
44 void Unlock();
45 private:
46 #ifdef _WIN32
47 HANDLE mutex_;
48 #else
49 pthread_mutex_t mutex_;
50 #endif
51 };
52
53
54 class CCUtil {
55 public:
56 CCUtil();
57 virtual ~CCUtil();
58
59 public:
60 // Read the arguments and set up the data path.
61 void main_setup(
62 const char *argv0, // program name
63 const char *basename // name of image
64 );
65 ParamsVectors *params() { return &params_; }
66
67 STRING datadir; // dir for data files
68 STRING imagebasename; // name of image
69 STRING lang;
70 STRING language_data_path_prefix;
71 TessdataManager tessdata_manager;
72 UNICHARSET unicharset;
73 UnicharAmbigs unichar_ambigs;
74 STRING imagefile; // image file name
75 STRING directory; // main directory
76
77 private:
78 ParamsVectors params_;
79
80 public:
81 // Member parameters.
82 // These have to be declared and initialized after params_ member, since
83 // params_ should be initialized before parameters are added to it.
84 STRING_VAR_H(m_data_sub_dir, "tessdata/", "Directory for data files");
85 #ifdef _WIN32
86 STRING_VAR_H(tessedit_module_name, WINDLLNAME,
87 "Module colocated with tessdata dir");
88 #endif
89 INT_VAR_H(ambigs_debug_level, 0, "Debug level for unichar ambiguities");
90 BOOL_VAR_H(use_definite_ambigs_for_classifier, 0,
91 "Use definite ambiguities when running character classifier");
92 BOOL_VAR_H(use_ambigs_for_adaption, 0,
93 "Use ambigs for deciding whether to adapt to a character");
94 };
95
96 extern CCUtilMutex tprintfMutex; // should remain global
97 } // namespace tesseract
98
99 #endif // TESSERACT_CCUTIL_CCUTIL_H__