tesseract  5.0.0
protos.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * File: protos.h
4  * Author: Mark Seaman, SW Productivity
5  *
6  * (c) Copyright 1987, Hewlett-Packard Company.
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  *
17  *****************************************************************************/
18 
19 #ifndef PROTOS_H
20 #define PROTOS_H
21 
22 #include "bitvec.h"
23 #include "params.h"
24 #include "unicity_table.h"
25 
26 #include <tesseract/unichar.h>
27 
28 namespace tesseract {
29 
30 struct PROTO_STRUCT {
31  float A;
32  float B;
33  float C;
34  float X;
35  float Y;
36  float Angle;
37  float Length;
38 };
39 
40 struct CLASS_STRUCT {
41  int16_t NumProtos = 0;
42  int16_t MaxNumProtos = 0;
43  int16_t NumConfigs = 0;
44  int16_t MaxNumConfigs = 0;
45  std::vector<PROTO_STRUCT> Prototypes;
46  std::vector<BIT_VECTOR> Configurations;
48 };
51 
52 /*----------------------------------------------------------------------
53  M a c r o s
54 ----------------------------------------------------------------------*/
61 #define AddProtoToConfig(Pid, Config) (SET_BIT(Config, Pid))
62 
70 #define ProtoIn(Class, Pid) (&(Class)->Prototypes[Pid])
71 
72 /*----------------------------------------------------------------------
73  F u n c t i o n s
74 ----------------------------------------------------------------------*/
76 int AddConfigToClass(CLASS_TYPE Class);
77 
79 int AddProtoToClass(CLASS_TYPE Class);
80 
82 void FillABC(PROTO_STRUCT *Proto);
83 
85 void FreeClass(CLASS_TYPE Class);
86 
88 void FreeClassFields(CLASS_TYPE Class);
89 
91 
93 CLASS_TYPE NewClass(int NumProtos, int NumConfigs);
94 
95 } // namespace tesseract
96 
97 #endif
CLASS_STRUCT * CLASS_TYPE
Definition: protos.h:49
int AddConfigToClass(CLASS_TYPE Class)
Definition: protos.cpp:49
void InitPrototypes()
int AddProtoToClass(CLASS_TYPE Class)
Definition: protos.cpp:82
void FreeClassFields(CLASS_TYPE Class)
Definition: protos.cpp:131
CLASS_TYPE NewClass(int NumProtos, int NumConfigs)
Definition: protos.cpp:145
void FreeClass(CLASS_TYPE Class)
Definition: protos.cpp:119
void FillABC(PROTO_STRUCT *Proto)
Definition: protos.cpp:103
std::vector< BIT_VECTOR > Configurations
Definition: protos.h:46
UnicityTable< int > font_set
Definition: protos.h:47
int16_t MaxNumConfigs
Definition: protos.h:44
int16_t MaxNumProtos
Definition: protos.h:42
std::vector< PROTO_STRUCT > Prototypes
Definition: protos.h:45
#define TESS_API
Definition: export.h:34