#include <pdf_render_requests.h>
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. |
Definition at line 38 of file pdf_render_requests.h.
pdf::PDFRenderRequests::PDFRenderRequests | ( | ) |
Definition at line 34 of file pdf_render_requests.cpp.
pdf::PDFRenderRequests::~PDFRenderRequests | ( | ) |
Definition at line 38 of file pdf_render_requests.cpp.
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.
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.
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.
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 }
void pdf::PDFRenderRequests::remove_request | ( | const size_t | page_number | ) |
Remove render request.
Definition at line 71 of file pdf_render_requests.cpp.
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 }