pdf::PDFRenderRequests Class Reference

#include <pdf_render_requests.h>

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

Public Member Functions

 PDFRenderRequests ()
 ~PDFRenderRequests ()
void add_request (const size_t page_number, const int priority)
 Add render request with priority.
void append_request (const size_t page_number)
 Append render request without priority.
void remove_request (const size_t page_number)
 Remove render request.
void clear ()
 Clear all of the render requests.
int get_priority (const size_t page_number)
void update (const std::vector< size_t > &requests)
 Update the queue by new requests.
bool contains (const size_t page_number)
 Check whether the page is contained in the queue.

Detailed Description

Definition at line 38 of file pdf_render_requests.h.


Constructor & Destructor Documentation

pdf::PDFRenderRequests::PDFRenderRequests (  ) 

Definition at line 34 of file pdf_render_requests.cpp.

00035 {
00036 }

pdf::PDFRenderRequests::~PDFRenderRequests (  ) 

Definition at line 38 of file pdf_render_requests.cpp.

00039 {
00040 }


Member Function Documentation

void pdf::PDFRenderRequests::add_request ( const size_t  page_number,
const int  priority 
)

Add render request with priority.

Definition at line 42 of file pdf_render_requests.cpp.

00043 {
00044     ScopeMutex m(&queue_mutex);
00045     queue[page_number] = priority;
00046 }

void pdf::PDFRenderRequests::append_request ( const size_t  page_number  ) 

Append render request without priority.

Definition at line 48 of file pdf_render_requests.cpp.

00049 {
00050     ScopeMutex m(&queue_mutex);
00051     // the request is appeneded with the lowest priority in the queue
00052     if (queue.find(page_number) != queue.end())
00053     {
00054         // if the page is in the request list, stop appending
00055         return;
00056     }
00057 
00058     int priority = -1;
00059     QueueIter iter = queue.begin();
00060     for (; iter != queue.end(); ++iter)
00061     {
00062         if (iter->second > priority)
00063         {
00064             priority = iter->second;
00065         }
00066     }
00067 
00068     queue[page_number] = (priority + 1);
00069 }

void pdf::PDFRenderRequests::clear ( void   ) 

Clear all of the render requests.

Definition at line 81 of file pdf_render_requests.cpp.

00082 {
00083     ScopeMutex m(&queue_mutex);
00084     queue.clear();
00085 }

bool pdf::PDFRenderRequests::contains ( const size_t  page_number  ) 

Check whether the page is contained in the queue.

Definition at line 108 of file pdf_render_requests.cpp.

00109 {
00110     ScopeMutex m(&queue_mutex);
00111     return (queue.find(page_number) != queue.end());
00112 }

int pdf::PDFRenderRequests::get_priority ( const size_t  page_number  ) 

Get priority of a page. Return -1 means the page is not in the request queue

Definition at line 87 of file pdf_render_requests.cpp.

References pdf::PRIORITY_MIN.

Referenced by pdf::compare_priority().

00088 {
00089     ScopeMutex m(&queue_mutex);
00090     QueueIter iter = queue.find(page_number);
00091     if (iter == queue.end())
00092     {
00093         return PRIORITY_MIN;
00094     }
00095     return queue[page_number];
00096 }

Here is the caller graph for this function:

void pdf::PDFRenderRequests::remove_request ( const size_t  page_number  ) 

Remove render request.

Definition at line 71 of file pdf_render_requests.cpp.

00072 {
00073     ScopeMutex m(&queue_mutex);
00074     QueueIter iter = queue.find(page_number);
00075     if (iter != queue.end())
00076     {
00077         queue.erase(iter);
00078     }
00079 }

void pdf::PDFRenderRequests::update ( const std::vector< size_t > &  requests  ) 

Update the queue by new requests.

Definition at line 98 of file pdf_render_requests.cpp.

Referenced by pdf::PDFPrerenderPolicyNormal::generate_requests_list().

00099 {
00100     ScopeMutex m(&queue_mutex);
00101     queue.clear();
00102     for (size_t idx = 0; idx < requests.size(); ++idx)
00103     {
00104         queue[requests.at(idx)] = idx;
00105     }
00106 }

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