pdf::PDFLibrary Class Reference

#include <pdf_library.h>

Collaboration diagram for pdf::PDFLibrary:
Collaboration graph
[legend]

Public Member Functions

 ~PDFLibrary ()
Threadget_thread ()
 get the instance of thread
bool make_enough_memory (PDFController *doc_ptr, const int page_num, const int length)
 make enough memory for some one document
void add_document (PDFController *doc_ptr)
 add new document
void remove_document (PDFController *doc_ptr)
 remove the existing document
void remove_tasks_by_document (PDFController *doc)
 remove all of the tasks related to a document
void thread_add_render_task (Task *task, bool prerender, bool abort_current)
 handle adding render task
void thread_add_search_task (Task *task)
 handle adding search task
void thread_cancel_render_tasks (void *user_data)
 clear all of the render tasks

Static Public Member Functions

static PDFLibraryinstance ()
 get the instance of library

Detailed Description

Definition at line 35 of file pdf_library.h.


Constructor & Destructor Documentation

pdf::PDFLibrary::~PDFLibrary (  ) 

Definition at line 61 of file pdf_library.cpp.

References pdf::Thread::stop().

00062 {
00063     // stop the task executing thread
00064     thread.stop();
00065 }

Here is the call graph for this function:


Member Function Documentation

void pdf::PDFLibrary::add_document ( PDFController doc_ptr  ) 

add new document

Definition at line 111 of file pdf_library.cpp.

Referenced by pdf::PDFController::PDFController().

00112 {
00113     try_start_thread();
00114     docs.push_back(doc_ptr);
00115 }

Here is the caller graph for this function:

Thread& pdf::PDFLibrary::get_thread (  )  [inline]

get the instance of thread

Definition at line 44 of file pdf_library.h.

Referenced by pdf::PDFController::abort_search(), thread_add_render_task(), thread_add_search_task(), and thread_cancel_render_tasks().

00047 { return thread; }

Here is the caller graph for this function:

PDFLibrary & pdf::PDFLibrary::instance (  )  [static]
bool pdf::PDFLibrary::make_enough_memory ( PDFController doc_ptr,
const int  page_num,
const int  length 
)

make enough memory for some one document

Definition at line 86 of file pdf_library.cpp.

References pdf::get_system_free_memory(), and WARNPRINTF.

00089 {
00090     if (length <= 0)
00091     {
00092         WARNPRINTF("Should NOT make enough memory by length:%d", length);
00093         return false;
00094     }
00095 
00096     // check the free memory in system
00097     unsigned long free_mem = get_system_free_memory();
00098     if (free_mem < static_cast<unsigned long>(length << 1))
00099     {
00100         // release all of the cached bitmaps
00101         DocumentsIter idx = docs.begin();
00102         for (; idx != docs.end(); ++idx)
00103         {
00104             (*idx)->clear_cached_bitmaps();
00105         }
00106     }
00107 
00108     return doc_ptr->make_enough_memory(page_num, length);
00109 }

Here is the call graph for this function:

void pdf::PDFLibrary::remove_document ( PDFController doc_ptr  ) 

remove the existing document

Definition at line 122 of file pdf_library.cpp.

Referenced by pdf::PDFController::~PDFController().

00123 {
00124     DocumentsIter idx = std::find(docs.begin(), docs.end(), doc_ptr);
00125     if (idx != docs.end())
00126     {
00127         docs.erase(idx);
00128     }
00129     try_stop_thread();
00130 }

Here is the caller graph for this function:

void pdf::PDFLibrary::remove_tasks_by_document ( PDFController doc  ) 

remove all of the tasks related to a document

Definition at line 117 of file pdf_library.cpp.

References pdf::Thread::cancel_tasks().

Referenced by pdf::PDFController::close().

00118 {
00119     thread.cancel_tasks(doc);
00120 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pdf::PDFLibrary::thread_add_render_task ( Task task,
bool  prerender,
bool  abort_current 
)

handle adding render task

Definition at line 132 of file pdf_library.cpp.

References pdf::Thread::append_task(), get_thread(), and pdf::Thread::prepend_task().

Referenced by pdf::PDFRenderer::post_render_task().

00133 {
00134     if (prerender)
00135     {
00136         get_thread().append_task(task);
00137     }
00138     else
00139     {
00140         // post the rendering task into the thread's task list
00141         get_thread().prepend_task(task, abort_current);
00142     }
00143 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pdf::PDFLibrary::thread_add_search_task ( Task task  ) 

handle adding search task

Definition at line 145 of file pdf_library.cpp.

References get_thread(), and pdf::Thread::prepend_task().

Referenced by pdf::PDFController::search_all(), and pdf::PDFController::search_next().

00146 {
00147     get_thread().prepend_task(task, true);
00148 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pdf::PDFLibrary::thread_cancel_render_tasks ( void *  user_data  ) 

clear all of the render tasks

Definition at line 150 of file pdf_library.cpp.

References pdf::Thread::clear_all(), get_thread(), and pdf::TASK_RENDER.

Referenced by pdf::PDFRenderer::post_render_task(), and pdf::PDFController::set_memory_limit().

00151 {
00152     get_thread().clear_all(user_data, TASK_RENDER);
00153 }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208