20 #ifndef TESSERACT_CCUTIL_UNICITY_TABLE_H_ 21 #define TESSERACT_CCUTIL_UNICITY_TABLE_H_ 23 #include "tesscallback.h" 25 #include "genericvector.h" 47 const T &
get(
int id)
const;
55 int get_id(T
object)
const;
103 NewPermanentTessCallback(tesseract::cmp_eq<T>));
107 template <
typename T>
113 template <
typename T>
118 template <
typename T>
125 template <
typename T>
131 template <
typename T>
136 template <
typename T>
141 template <
typename T>
143 return table_.contains_index(
id);
147 template <
typename T>
149 return table_.get_index(
object);
153 template <
typename T>
155 return get_id(
object) != -1;
159 template <
typename T>
163 idx =
table_.push_back(
object);
170 template <
typename T>
172 table_.set_clear_callback(cb);
177 template <
typename T>
179 table_.set_compare_callback(cb);
184 template <
typename T>
189 template <
typename T>
192 return table_.write(f, cb);
195 template <
typename T>
198 return table_.read(f, cb);
203 template <
typename T>
208 #endif // TESSERACT_CCUTIL_UNICITY_TABLE_H_ GenericVector< T > table_
Definition: unicity_table.h:93
UnicityTableEqEq()
Definition: unicity_table.h:101
UnicityTable()
Definition: unicity_table.h:108
int push_back(T object)
Add an element in the table.
Definition: unicity_table.h:160
bool read(tesseract::TFile *f, TessResultCallback2< bool, tesseract::TFile *, T *> *cb)
Definition: unicity_table.h:196
T contains_id(int id) const
Return true if the id is valid.
Definition: unicity_table.h:142
void clear()
Definition: unicity_table.h:185
Definition: serialis.h:77
void reserve(int size)
Definition: unicity_table.h:126
Definition: fontinfo.h:30
bool contains(T object) const
Return true if T is in the table.
Definition: unicity_table.h:154
const T & get(int id) const
Return the object from an id.
Definition: unicity_table.h:132
T * get_mutable(int id)
Definition: unicity_table.h:137
~UnicityTable()
Clear the structures and deallocate internal structures.
Definition: unicity_table.h:114
Definition: unicity_table.h:99
void set_compare_callback(TessResultCallback2< bool, T const &, T const &> *cb)
Definition: unicity_table.h:178
TessResultCallback2< bool, T const &, T const & > * compare_cb_
Definition: unicity_table.h:95
bool write(FILE *f, TessResultCallback2< bool, FILE *, T const &> *cb) const
Definition: unicity_table.h:190
void move(UnicityTable< T > *from)
Definition: unicity_table.h:204
void set_clear_callback(TessCallback1< T > *cb)
Definition: unicity_table.h:171
int size() const
Return the size used.
Definition: unicity_table.h:119
int get_id(T object) const
Definition: unicity_table.h:148