tesseract  4.1.1
ccutil.h
Go to the documentation of this file.
1 // 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 #ifndef _WIN32
23 #include <pthread.h>
24 #include <semaphore.h>
25 #endif
26 
27 #ifndef DISABLED_LEGACY_ENGINE
28 #include "ambigs.h"
29 #endif
30 #include "errcode.h"
31 #ifdef _WIN32
32 #include "host.h" // windows.h for HANDLE, ...
33 #endif
34 #include "strngs.h"
35 #include "params.h"
36 #include "unicharset.h"
37 
38 namespace tesseract {
39 
40 class CCUtilMutex {
41  public:
42  CCUtilMutex();
43 
44  void Lock();
45 
46  void Unlock();
47  private:
48 #ifdef _WIN32
49  HANDLE mutex_;
50 #else
51  pthread_mutex_t mutex_;
52 #endif
53 };
54 
55 
56 class CCUtil {
57  public:
58  CCUtil();
59  virtual ~CCUtil();
60 
61  public:
62  // Read the arguments and set up the data path.
63  void main_setup(
64  const char *argv0, // program name
65  const char *basename // name of image
66  );
67  ParamsVectors *params() { return &params_; }
68 
69  STRING datadir; // dir for data files
70  STRING imagebasename; // name of image
74 #ifndef DISABLED_LEGACY_ENGINE
76 #endif
77  STRING imagefile; // image file name
78  STRING directory; // main directory
79 
80  private:
81  ParamsVectors params_;
82 
83  public:
84  // Member parameters.
85  // These have to be declared and initialized after params_ member, since
86  // params_ should be initialized before parameters are added to it.
87  INT_VAR_H(ambigs_debug_level, 0, "Debug level for unichar ambiguities");
89  "Use ambigs for deciding whether to adapt to a character");
90 };
91 
92 } // namespace tesseract
93 
94 #endif // TESSERACT_CCUTIL_CCUTIL_H_
tesseract::CCUtil::directory
STRING directory
Definition: ccutil.h:78
ambigs.h
tesseract::CCUtil::CCUtil
CCUtil()
Definition: ccutil.cpp:16
tesseract::CCUtil::language_data_path_prefix
STRING language_data_path_prefix
Definition: ccutil.h:72
INT_VAR_H
#define INT_VAR_H(name, val, comment)
Definition: params.h:295
tesseract
Definition: altorenderer.cpp:25
tesseract::CCUtil::~CCUtil
virtual ~CCUtil()
tesseract::CCUtil::lang
STRING lang
Definition: ccutil.h:71
strngs.h
tesseract::CCUtil
Definition: ccutil.h:56
BOOL_VAR_H
#define BOOL_VAR_H(name, val, comment)
Definition: params.h:297
tesseract::CCUtil::unichar_ambigs
UnicharAmbigs unichar_ambigs
Definition: ccutil.h:75
tesseract::CCUtilMutex::CCUtilMutex
CCUtilMutex()
Definition: ccutil.cpp:29
tesseract::CCUtil::use_ambigs_for_adaption
bool use_ambigs_for_adaption
Definition: ccutil.h:89
tesseract::CCUtilMutex
Definition: ccutil.h:40
tesseract::CCUtil::unicharset
UNICHARSET unicharset
Definition: ccutil.h:73
tesseract::UnicharAmbigs
Definition: ambigs.h:136
tesseract::CCUtilMutex::Lock
void Lock()
Definition: ccutil.cpp:37
tesseract::CCUtil::datadir
STRING datadir
Definition: ccutil.h:69
unicharset.h
tesseract::CCUtil::imagebasename
STRING imagebasename
Definition: ccutil.h:70
tesseract::CCUtil::imagefile
STRING imagefile
Definition: ccutil.h:77
tesseract::CCUtilMutex::Unlock
void Unlock()
Definition: ccutil.cpp:45
tesseract::CCUtil::ambigs_debug_level
int ambigs_debug_level
Definition: ccutil.h:87
tesseract::CCUtil::params
ParamsVectors * params()
Definition: ccutil.h:67
errcode.h
STRING
Definition: strngs.h:45
params.h
tesseract::ParamsVectors
Definition: params.h:58
UNICHARSET
Definition: unicharset.h:145
tesseract::CCUtil::main_setup
void main_setup(const char *argv0, const char *basename)
CCUtil::main_setup - set location of tessdata and name of image.
Definition: mainblk.cpp:60
host.h