#include <imagedata.h>
Definition at line 288 of file imagedata.h.
◆ DocumentCache()
tesseract::DocumentCache::DocumentCache |
( |
int64_t |
max_memory | ) |
|
|
explicit |
◆ ~DocumentCache()
tesseract::DocumentCache::~DocumentCache |
( |
| ) |
|
Definition at line 606 of file imagedata.cpp.
606 {
607 for (auto *document : documents_) {
608 delete document;
609 }
610}
◆ AddToCache()
bool tesseract::DocumentCache::AddToCache |
( |
DocumentData * |
data | ) |
|
Definition at line 641 of file imagedata.cpp.
641 {
642 documents_.push_back(data);
643 return true;
644}
◆ Clear()
void tesseract::DocumentCache::Clear |
( |
| ) |
|
|
inline |
Definition at line 296 of file imagedata.h.
296 {
297 for (auto *document : documents_) {
298 delete document;
299 }
300 documents_.clear();
301 num_pages_per_doc_ = 0;
302 }
◆ documents()
const std::vector< DocumentData * > & tesseract::DocumentCache::documents |
( |
| ) |
const |
|
inline |
Definition at line 325 of file imagedata.h.
325 {
326 return documents_;
327 }
◆ FindDocument()
DocumentData * tesseract::DocumentCache::FindDocument |
( |
const std::string & |
document_name | ) |
const |
Definition at line 647 of file imagedata.cpp.
648 {
649 for (auto *document : documents_) {
650 if (document->document_name() == document_name) {
651 return document;
652 }
653 }
654 return nullptr;
655}
◆ GetPageBySerial()
const ImageData * tesseract::DocumentCache::GetPageBySerial |
( |
int |
serial | ) |
|
|
inline |
Definition at line 317 of file imagedata.h.
317 {
319 return GetPageSequential(serial);
320 } else {
321 return GetPageRoundRobin(serial);
322 }
323 }
◆ LoadDocuments()
bool tesseract::DocumentCache::LoadDocuments |
( |
const std::vector< std::string > & |
filenames, |
|
|
CachingStrategy |
cache_strategy, |
|
|
FileReader |
reader |
|
) |
| |
Definition at line 614 of file imagedata.cpp.
616 {
617 cache_strategy_ = cache_strategy;
618 int64_t fair_share_memory = 0;
619
620
621
623 fair_share_memory = max_memory_ / filenames.size();
624 }
625 for (const auto &filename : filenames) {
626 auto *document = new DocumentData(filename);
627 document->SetDocument(filename.c_str(), fair_share_memory, reader);
629 }
630 if (!documents_.empty()) {
631
633 return true;
634 }
635 tprintf(
"Load of page 0 failed!\n");
636 }
637 return false;
638}
void tprintf(const char *format,...)
bool AddToCache(DocumentData *data)
const ImageData * GetPageBySerial(int serial)
◆ TotalPages()
int tesseract::DocumentCache::TotalPages |
( |
| ) |
|
Definition at line 659 of file imagedata.cpp.
659 {
661
662
663 if (num_pages_per_doc_ == 0) {
664 GetPageSequential(0);
665 }
666 return num_pages_per_doc_ * documents_.size();
667 }
668 int total_pages = 0;
669 for (auto *document : documents_) {
670
671 document->GetPage(0);
672 total_pages += document->NumPages();
673 }
674 return total_pages;
675}
The documentation for this class was generated from the following files:
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/imagedata.h
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/imagedata.cpp