tesseract  5.0.0-alpha-619-ge9db
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 /*----------------------------------------------------------------------
23  I n c l u d e s
24 ----------------------------------------------------------------------*/
25 #include "bitvec.h"
26 #include "params.h"
27 #include <tesseract/unichar.h>
28 #include "unicity_table.h"
29 
30 /*----------------------------------------------------------------------
31  T y p e s
32 ----------------------------------------------------------------------*/
33 using CONFIGS = BIT_VECTOR*;
34 
35 typedef struct {
36  float A;
37  float B;
38  float C;
39  float X;
40  float Y;
41  float Angle;
42  float Length;
44 using PROTO = PROTO_STRUCT*;
45 
46 struct CLASS_STRUCT {
47  CLASS_STRUCT()
48  : NumProtos(0),
49  MaxNumProtos(0),
50  Prototypes(nullptr),
51  NumConfigs(0),
52  MaxNumConfigs(0),
53  Configurations(nullptr) {}
54  int16_t NumProtos;
55  int16_t MaxNumProtos;
57  int16_t NumConfigs;
58  int16_t MaxNumConfigs;
61 };
63 using CLASSES = CLASS_STRUCT*;
64 
65 /*----------------------------------------------------------------------
66  M a c r o s
67 ----------------------------------------------------------------------*/
74 #define AddProtoToConfig(Pid, Config) (SET_BIT(Config, Pid))
75 
83 #define ProtoIn(Class, Pid) (&(Class)->Prototypes[Pid])
84 
85 /*----------------------------------------------------------------------
86  F u n c t i o n s
87 ----------------------------------------------------------------------*/
88 int AddConfigToClass(CLASS_TYPE Class);
89 
90 int AddProtoToClass(CLASS_TYPE Class);
91 
92 void FillABC(PROTO Proto);
93 
94 void FreeClass(CLASS_TYPE Class);
95 
96 void FreeClassFields(CLASS_TYPE Class);
97 
98 void InitPrototypes();
99 
100 CLASS_TYPE NewClass(int NumProtos, int NumConfigs);
101 
102 #endif
FillABC
void FillABC(PROTO Proto)
Definition: protos.cpp:105
unicity_table.h
CLASS_STRUCT::Configurations
CONFIGS Configurations
Definition: protos.h:58
PROTO_STRUCT
Definition: protos.h:34
UnicityTableEqEq< int >
params.h
CLASS_STRUCT::NumProtos
int16_t NumProtos
Definition: protos.h:53
CLASS_STRUCT::MaxNumProtos
int16_t MaxNumProtos
Definition: protos.h:54
CONFIGS
BIT_VECTOR * CONFIGS
Definition: protos.h:32
AddConfigToClass
int AddConfigToClass(CLASS_TYPE Class)
Definition: protos.cpp:45
CLASS_STRUCT::NumConfigs
int16_t NumConfigs
Definition: protos.h:56
CLASS_STRUCT::font_set
UnicityTableEqEq< int > font_set
Definition: protos.h:59
CLASS_STRUCT::CLASS_STRUCT
CLASS_STRUCT()
Definition: protos.h:46
CLASS_STRUCT
Definition: protos.h:45
BIT_VECTOR
uint32_t * BIT_VECTOR
Definition: bitvec.h:27
CLASS_STRUCT::MaxNumConfigs
int16_t MaxNumConfigs
Definition: protos.h:57
NewClass
CLASS_TYPE NewClass(int NumProtos, int NumConfigs)
Definition: protos.cpp:151
InitPrototypes
void InitPrototypes()
CLASS_STRUCT::Prototypes
PROTO Prototypes
Definition: protos.h:55
AddProtoToClass
int AddProtoToClass(CLASS_TYPE Class)
Definition: protos.cpp:82
unichar.h
bitvec.h
FreeClassFields
void FreeClassFields(CLASS_TYPE Class)
Definition: protos.cpp:133
FreeClass
void FreeClass(CLASS_TYPE Class)
Definition: protos.cpp:121