tesseract v5.3.3.20231005
tesseract::DawgPositionVector Class Reference

#include <dawg.h>

Inheritance diagram for tesseract::DawgPositionVector:

Public Member Functions

bool add_unique (const DawgPosition &new_pos, bool debug, const char *debug_msg)
 

Detailed Description

Definition at line 378 of file dawg.h.

Member Function Documentation

◆ add_unique()

bool tesseract::DawgPositionVector::add_unique ( const DawgPosition new_pos,
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 383 of file dawg.h.

384 {
385 for (auto &&position : *this) {
386 if (position == new_pos) {
387 return false;
388 }
389 }
390 push_back(new_pos);
391 if (debug) {
392 tprintf("%s[%d, " REFFORMAT "] [punc: " REFFORMAT "%s]\n", debug_msg,
393 new_pos.dawg_index, new_pos.dawg_ref, new_pos.punc_ref,
394 new_pos.back_to_punc ? " returned" : "");
395 }
396 return true;
397 }
#define REFFORMAT
Definition: dawg.h:85
void tprintf(const char *format,...)
Definition: tprintf.cpp:41

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