Tesseract
3.02
|
#include <dawg.h>
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) |
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; } }
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 | ( | ) | [inline, virtual] |
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; }