tesseract 4.1.1
Loading...
Searching...
No Matches
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#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
38namespace tesseract {
39
41 public:
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
56class 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_
#define BOOL_VAR_H(name, val, comment)
Definition: params.h:297
#define INT_VAR_H(name, val, comment)
Definition: params.h:295
STRING language_data_path_prefix
Definition: ccutil.h:72
ParamsVectors * params()
Definition: ccutil.h:67
STRING datadir
Definition: ccutil.h:69
STRING imagefile
Definition: ccutil.h:77
UNICHARSET unicharset
Definition: ccutil.h:73
STRING imagebasename
Definition: ccutil.h:70
STRING directory
Definition: ccutil.h:78
void main_setup(const char *argv0, const char *basename)
CCUtil::main_setup - set location of tessdata and name of image.
Definition: mainblk.cpp:44
STRING lang
Definition: ccutil.h:71
UnicharAmbigs unichar_ambigs
Definition: ccutil.h:75
int ambigs_debug_level
Definition: ccutil.h:87
bool use_ambigs_for_adaption
Definition: ccutil.h:89
Definition: strngs.h:45