pdf_render_requests.h

Go to the documentation of this file.
00001 /*
00002  * File Name: pdf_render_requests.h
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-pdf.
00007  *
00008  * uds-plugin-pdf is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * uds-plugin-pdf is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 /**
00023  * Copyright (C) 2008 iRex Technologies B.V.
00024  * All rights reserved.
00025  */
00026 
00027 #ifndef PDF_RENDER_REQUESTS_H
00028 #define PDF_RENDER_REQUESTS_H
00029 
00030 #include "mutex.h"
00031 #include "pdf_define.h"
00032 
00033 namespace pdf
00034 {
00035 
00036 using namespace std;
00037 
00038 class PDFRenderRequests
00039 {
00040 public:
00041     PDFRenderRequests();
00042     ~PDFRenderRequests();
00043 
00044     /// Add render request with priority
00045     void add_request(const size_t page_number, const int priority);
00046 
00047     /// Append render request without priority
00048     void append_request(const size_t page_number);
00049 
00050     /// Remove render request
00051     void remove_request(const size_t page_number);
00052 
00053     /// Clear all of the render requests
00054     void clear();
00055 
00056     /// Get priority of a page. Return -1 means the page is not in the
00057     /// request queue
00058     int get_priority(const size_t page_number);
00059 
00060     /// Update the queue by new requests
00061     void update(const std::vector<size_t> & requests);
00062 
00063     /// Check whether the page is contained in the queue
00064     bool contains(const size_t page_number);
00065 
00066 private:
00067     typedef std::tr1::unordered_map<size_t, int> Queue;
00068     typedef Queue::iterator QueueIter;
00069 
00070 private:
00071     /// The queue of requests
00072     Queue queue;
00073 
00074     /// Mutex of the queue
00075     Mutex queue_mutex;
00076 };
00077 
00078 };
00079 
00080 #endif
Generated by  doxygen 1.6.2-20100208