#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 428 of file imagedata.cpp.
430 pages_.push_back(page);
431 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 448 of file imagedata.cpp.
449 ImageData* page = NULL;
453 bool needs_loading = pages_offset_ != index;
458 #if defined(__MINGW32__) 461 std::this_thread::sleep_for(std::chrono::seconds(1));
bool IsPageAvailable(int index, ImageData **page)
void Lock()
Locks on a mutex.
void Unlock()
Unlocks on a mutex.
void LoadPageInBackground(int index)
◆ IsCached()
bool tesseract::DocumentData::IsCached |
( |
| ) |
const |
|
inline |
◆ IsPageAvailable()
bool tesseract::DocumentData::IsPageAvailable |
( |
int |
index, |
|
|
ImageData ** |
page |
|
) |
| |
Definition at line 470 of file imagedata.cpp.
473 if (num_pages == 0 || index < 0) {
478 index =
Modulo(index, num_pages);
479 if (pages_offset_ <= index && index < pages_offset_ + pages_.size()) {
480 *page = pages_[index - pages_offset_];
◆ LoadDocument()
bool tesseract::DocumentData::LoadDocument |
( |
const char * |
filename, |
|
|
int |
start_page, |
|
|
inT64 |
max_memory, |
|
|
FileReader |
reader |
|
) |
| |
Definition at line 391 of file imagedata.cpp.
394 pages_offset_ = start_page;
395 return ReCachePages();
void SetDocument(const char *filename, inT64 max_memory, FileReader reader)
◆ LoadPageInBackground()
void tesseract::DocumentData::LoadPageInBackground |
( |
int |
index | ) |
|
Definition at line 436 of file imagedata.cpp.
437 ImageData* page = NULL;
440 if (pages_offset_ == index)
return;
441 pages_offset_ = index;
bool IsPageAvailable(int index, ImageData **page)
friend void * ReCachePagesFunc(void *data)
static void StartThread(void *(*func)(void *), void *arg)
Create new thread.
◆ 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 420 of file imagedata.cpp.
423 fp.OpenWrite(buffer);
424 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 502 of file imagedata.cpp.
506 random.set_seed(document_name_.
string());
507 int num_pages = pages_.size();
509 for (
int i = 0; i < num_pages; ++i) {
510 int src = random.IntRand() % num_pages;
511 int dest = random.IntRand() % num_pages;
512 std::swap(pages_[src], pages_[dest]);
const char * string() const
◆ TakePage()
ImageData* tesseract::DocumentData::TakePage |
( |
int |
index | ) |
|
|
inline |
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 489 of file imagedata.cpp.
496 tprintf(
"Unloaded document %s, saving %" PRId64
" memory\n",
497 document_name_.
string(), memory_saved);
inT64 memory_used() const
const char * string() const
◆ ReCachePagesFunc
void* ReCachePagesFunc |
( |
void * |
data | ) |
|
|
friend |
Definition at line 370 of file imagedata.cpp.
372 document_data->ReCachePages();
DocumentData(const STRING &name)
The documentation for this class was generated from the following files:
- /home/stweil/src/github/tesseract-ocr/tesseract/ccstruct/imagedata.h
- /home/stweil/src/github/tesseract-ocr/tesseract/ccstruct/imagedata.cpp