#include <imagedata.h>
Definition at line 203 of file imagedata.h.
◆ DocumentData()
tesseract::DocumentData::DocumentData |
( |
const STRING & |
name | ) |
|
|
explicit |
◆ ~DocumentData()
tesseract::DocumentData::~DocumentData |
( |
| ) |
|
◆ AddPageToDocument()
void tesseract::DocumentData::AddPageToDocument |
( |
ImageData * |
page | ) |
|
Definition at line 427 of file imagedata.cpp.
429 pages_.push_back(page);
430 set_memory_used(
memory_used() + page->MemoryUsed());
inT64 memory_used() const
◆ document_name()
const STRING& tesseract::DocumentData::document_name |
( |
| ) |
const |
|
inline |
Definition at line 223 of file imagedata.h.
225 return document_name_;
◆ GetPage()
const ImageData * tesseract::DocumentData::GetPage |
( |
int |
index | ) |
|
Definition at line 447 of file imagedata.cpp.
448 ImageData* page = NULL;
452 bool needs_loading = pages_offset_ != index;
457 #if defined(__MINGW32__) 460 std::this_thread::sleep_for(std::chrono::seconds(1));
void Unlock()
Unlocks on a mutex.
bool IsPageAvailable(int index, ImageData **page)
void LoadPageInBackground(int index)
void Lock()
Locks on a mutex.
◆ IsCached()
bool tesseract::DocumentData::IsCached |
( |
| ) |
const |
|
inline |
◆ IsPageAvailable()
bool tesseract::DocumentData::IsPageAvailable |
( |
int |
index, |
|
|
ImageData ** |
page |
|
) |
| |
Definition at line 469 of file imagedata.cpp.
472 if (num_pages == 0 || index < 0) {
477 index =
Modulo(index, num_pages);
478 if (pages_offset_ <= index && index < pages_offset_ + pages_.size()) {
479 *page = pages_[index - pages_offset_];
◆ LoadDocument()
bool tesseract::DocumentData::LoadDocument |
( |
const char * |
filename, |
|
|
int |
start_page, |
|
|
inT64 |
max_memory, |
|
|
FileReader |
reader |
|
) |
| |
Definition at line 390 of file imagedata.cpp.
393 pages_offset_ = start_page;
394 return ReCachePages();
void SetDocument(const char *filename, inT64 max_memory, FileReader reader)
◆ LoadPageInBackground()
void tesseract::DocumentData::LoadPageInBackground |
( |
int |
index | ) |
|
Definition at line 435 of file imagedata.cpp.
436 ImageData* page = NULL;
439 if (pages_offset_ == index)
return;
440 pages_offset_ = index;
static void StartThread(void *(*func)(void *), void *arg)
Create new thread.
bool IsPageAvailable(int index, ImageData **page)
friend void * ReCachePagesFunc(void *data)
◆ memory_used()
inT64 tesseract::DocumentData::memory_used |
( |
| ) |
const |
|
inline |
◆ NumPages()
int tesseract::DocumentData::NumPages |
( |
| ) |
const |
|
inline |
◆ SaveDocument()
bool tesseract::DocumentData::SaveDocument |
( |
const char * |
filename, |
|
|
FileWriter |
writer |
|
) |
| |
◆ SaveToBuffer()
bool tesseract::DocumentData::SaveToBuffer |
( |
GenericVector< char > * |
buffer | ) |
|
Definition at line 419 of file imagedata.cpp.
422 fp.OpenWrite(buffer);
423 return pages_.Serialize(&fp);
◆ SetDocument()
void tesseract::DocumentData::SetDocument |
( |
const char * |
filename, |
|
|
inT64 |
max_memory, |
|
|
FileReader |
reader |
|
) |
| |
◆ Shuffle()
void tesseract::DocumentData::Shuffle |
( |
| ) |
|
Definition at line 501 of file imagedata.cpp.
505 random.set_seed(document_name_.
string());
506 int num_pages = pages_.size();
508 for (
int i = 0; i < num_pages; ++i) {
509 int src = random.IntRand() % num_pages;
510 int dest = random.IntRand() % num_pages;
511 std::swap(pages_[src], pages_[dest]);
const char * string() const
◆ TakePage()
Definition at line 255 of file imagedata.h.
257 ImageData* page = pages_[index];
258 pages_[index] = NULL;
◆ UnCache()
inT64 tesseract::DocumentData::UnCache |
( |
| ) |
|
Definition at line 488 of file imagedata.cpp.
495 tprintf(
"Unloaded document %s, saving %" PRId64
" memory\n",
496 document_name_.
string(), memory_saved);
const char * string() const
inT64 memory_used() const
◆ ReCachePagesFunc
void* ReCachePagesFunc |
( |
void * |
data | ) |
|
|
friend |
Definition at line 369 of file imagedata.cpp.
371 document_data->ReCachePages();
DocumentData(const STRING &name)
The documentation for this class was generated from the following files:
- /home/stefan/src/github/tesseract-ocr/tesseract/ccstruct/imagedata.h
- /home/stefan/src/github/tesseract-ocr/tesseract/ccstruct/imagedata.cpp