Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
tesseract::DawgInfoVector Class Reference

`#include <dawg.h>`

Inheritance diagram for tesseract::DawgInfoVector:

List of all members.

## Public Member Functions

| ~DawgInfoVector ()
| Overload destructor, since clear() does not delete data_[] any more.
void | clear ()
bool | add_unique (const DawgInfo &new_info, bool debug, const char *debug_msg)
Public Member Functions inherited from GenericVector< DawgInfo >
| GenericVector ()
| GenericVector (int size)
| GenericVector (const GenericVector &other)
GenericVector< DawgInfo > & | operator+= (const GenericVector &other)
void | operator+= (DawgInfot)
GenericVector< DawgInfo > & | operator= (const GenericVector &other)
virtual | ~GenericVector ()
void | reserve (int size)
void | double_the_size ()
void | init_to_size (int size, DawgInfot)
int | size () const
int | length () const
bool | empty () const
DawgInfo & | get (int index) const
DawgInfo & | back () const
DawgInfo & | operator[] (int index) const
int | get_index (DawgInfoobject) const
bool | contains (DawgInfoobject) const
DawgInfo | contains_index (int index) const
int | push_back (DawgInfoobject)
int | push_back_new (DawgInfoobject)
int | push_front (DawgInfoobject)
void | set (DawgInfot, int index)
void | insert (DawgInfot, int index)
virtual void | remove (int index)
virtual void | truncate (int size)
void | set_clear_callback (TessCallback1< DawgInfo > *cb)
void | set_compare_callback (TessResultCallback2< bool, DawgInfoconst &, DawgInfoconst & > *cb)
void | delete_data_pointers ()
void | move (GenericVector< DawgInfo > *from)
bool | write (FILE *f, TessResultCallback2< bool, FILE *, DawgInfoconst & > *cb) const
bool | read (FILE *f, TessResultCallback3< bool, FILE *, DawgInfo *, bool > *cb, bool swap)
virtual bool | Serialize (FILE *fp) const
virtual bool | DeSerialize (bool swap, FILE *fp)
bool | SerializeClasses (FILE *fp) const
bool | DeSerializeClasses (bool swap, FILE *fp)
void | sort ()
void | sort (int(*comparator)(const void *, const void *))
bool | bool_binary_search (const DawgInfo &target) const
int | binary_search (const DawgInfo &target) const
void | compact_sorted ()
void | compact (TessResultCallback1< bool, int > *delete_cb)
DawgInfo | dot_product (const GenericVector< DawgInfo > &other) const

## Additional Inherited Members

Static Public Member Functions inherited from GenericVector< DawgInfo >
static DawgInfo * | double_the_size_memcpy (int current_size, DawgInfo *data)
Protected Member Functions inherited from GenericVector< DawgInfo >
void | init (int size)
Protected Attributes inherited from GenericVector< DawgInfo >
inT32 | size_used_
inT32 | size_reserved_
DawgInfo * | data_
TessCallback1< DawgInfo > * | clear_cb_
TessResultCallback2< bool, DawgInfoconst &, DawgInfoconst & > * | compare_cb_
Static Protected Attributes inherited from GenericVector< DawgInfo >
static const int | kDefaultVectorSize

## Detailed Description

Definition at line 314 of file dawg.h.

## Constructor & Destructor Documentation

tesseract::DawgInfoVector::~DawgInfoVector | ( |  | ) |

inline

Overload destructor, since clear() does not delete data_[] any more.

Definition at line 317 of file dawg.h.

{
if (size_reserved_ > 0) {
delete[] data_;
size_used_ = 0;
size_reserved_ = 0;
}
}

## Member Function Documentation

bool tesseract::DawgInfoVector::add_unique | ( | const DawgInfo & | new_info,
|  | bool | debug,
|  | const char * | debug_msg
| ) |  |

inline

Adds an entry for the given dawg_index with the given node to the vec. Returns false if the same entry already exists in the vector, true otherwise.

Definition at line 330 of file dawg.h.

{
for (int i = 0; i < size_used_; ++i) {
if (data_[i] == new_info) return false;
}
push_back(new_info);
if (debug) {
tprintf("%s[%d, " REFFORMAT "]\n", debug_msg,
new_info.dawg_index, new_info.ref);
}
return true;
}

void tesseract::DawgInfoVector::clear | ( |  | ) |

inlinevirtual

Overload clear() in order to avoid allocating/deallocating memory when clearing the vector and re-inserting entries into it later.

Reimplemented from GenericVector< DawgInfo >.

Definition at line 326 of file dawg.h.

{ size_used_ = 0; }

The documentation for this class was generated from the following file:

- /mnt/data/src/tesseract-ocr/dict/dawg.h