tesseract  4.1.1
protos.h
Go to the documentation of this file.
1 /* -*-C-*-
2  ******************************************************************************
3  *
4  * File: protos.h
5  * Author: Mark Seaman, SW Productivity
6  *
7  * (c) Copyright 1987, Hewlett-Packard Company.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  *
18  *****************************************************************************/
19 
20 #ifndef PROTOS_H
21 #define PROTOS_H
22 
23 /*----------------------------------------------------------------------
24  I n c l u d e s
25 ----------------------------------------------------------------------*/
26 #include "bitvec.h"
27 #include "params.h"
28 #include "unichar.h"
29 #include "unicity_table.h"
30 
31 /*----------------------------------------------------------------------
32  T y p e s
33 ----------------------------------------------------------------------*/
35 
36 typedef struct {
37  float A;
38  float B;
39  float C;
40  float X;
41  float Y;
42  float Angle;
43  float Length;
44 } PROTO_STRUCT;
46 
47 struct CLASS_STRUCT {
49  : NumProtos(0),
50  MaxNumProtos(0),
51  Prototypes(nullptr),
52  NumConfigs(0),
53  MaxNumConfigs(0),
54  Configurations(nullptr) {}
55  int16_t NumProtos;
56  int16_t MaxNumProtos;
58  int16_t NumConfigs;
59  int16_t MaxNumConfigs;
62 };
65 
66 /*----------------------------------------------------------------------
67  M a c r o s
68 ----------------------------------------------------------------------*/
75 #define AddProtoToConfig(Pid, Config) (SET_BIT(Config, Pid))
76 
84 #define ProtoIn(Class, Pid) (&(Class)->Prototypes[Pid])
85 
86 /*----------------------------------------------------------------------
87  F u n c t i o n s
88 ----------------------------------------------------------------------*/
89 int AddConfigToClass(CLASS_TYPE Class);
90 
91 int AddProtoToClass(CLASS_TYPE Class);
92 
93 void FillABC(PROTO Proto);
94 
95 void FreeClass(CLASS_TYPE Class);
96 
97 void FreeClassFields(CLASS_TYPE Class);
98 
99 void InitPrototypes();
100 
101 CLASS_TYPE NewClass(int NumProtos, int NumConfigs);
102 
103 #endif
void FreeClass(CLASS_TYPE Class)
Definition: protos.cpp:125
CLASS_STRUCT()
Definition: protos.h:48
float X
Definition: protos.h:40
UnicityTableEqEq< int > font_set
Definition: protos.h:61
float A
Definition: protos.h:37
int16_t NumConfigs
Definition: protos.h:58
int16_t MaxNumConfigs
Definition: protos.h:59
void FreeClassFields(CLASS_TYPE Class)
Definition: protos.cpp:138
BIT_VECTOR * CONFIGS
Definition: protos.h:34
int AddConfigToClass(CLASS_TYPE Class)
Definition: protos.cpp:47
float B
Definition: protos.h:38
int16_t NumProtos
Definition: protos.h:55
float Length
Definition: protos.h:43
CLASS_TYPE NewClass(int NumProtos, int NumConfigs)
Definition: protos.cpp:157
void InitPrototypes()
PROTO Prototypes
Definition: protos.h:57
int AddProtoToClass(CLASS_TYPE Class)
Definition: protos.cpp:84
float Y
Definition: protos.h:41
void FillABC(PROTO Proto)
Definition: protos.cpp:108
float C
Definition: protos.h:39
CONFIGS Configurations
Definition: protos.h:60
float Angle
Definition: protos.h:42
int16_t MaxNumProtos
Definition: protos.h:56
uint32_t * BIT_VECTOR
Definition: bitvec.h:28