LibreOffice Module sd (master) 1
Classes | Public Member Functions | Private Attributes | List of all members
sd::slidesorter::cache::RequestQueue Class Reference

The request queue stores requests that are described by the Request sorted according to priority class and then priority. More...

#include <SlsRequestQueue.hxx>

Inheritance diagram for sd::slidesorter::cache::RequestQueue:
[legend]
Collaboration diagram for sd::slidesorter::cache::RequestQueue:
[legend]

Classes

class  Container
 

Public Member Functions

 RequestQueue (SharedCacheContext pCacheContext)
 
virtual ~RequestQueue ()
 
void AddRequest (CacheKey aKey, RequestPriorityClass eRequestClass)
 Insert a request with highest or lowest priority in its priority class. More...
 
bool RemoveRequest (CacheKey aKey)
 Remove the specified request from the queue. More...
 
void ChangeClass (CacheKey aKey, RequestPriorityClass eNewRequestClass)
 Change the priority class of the specified request. More...
 
CacheKey GetFront ()
 Get the request with the highest priority int the highest priority class. More...
 
RequestPriorityClass GetFrontPriorityClass ()
 
void PopFront ()
 Really a synonym for RemoveRequest(GetFront());. More...
 
bool IsEmpty ()
 Returns <TRUE> when there is no element in the queue. More...
 
void Clear ()
 Remove all requests from the queue. More...
 
::osl::Mutex & GetMutex ()
 Return the mutex that guards the access to the priority queue. More...
 
virtual void PageInDestruction (const SdrPage &rPage) override
 Ensure we don't hand out a page deleted before anyone got a chance to process it. More...
 
virtual void PageInDestruction (const SdrPage &rPage)=0
 

Private Attributes

::osl::Mutex maMutex
 
std::unique_ptr< ContainermpRequestQueue
 
SharedCacheContext mpCacheContext
 
int mnMinimumPriority
 A lower bound of the lowest priority of all elements in the queues. More...
 
int mnMaximumPriority
 An upper bound of the highest priority of all elements in the queues. More...
 

Additional Inherited Members

- Protected Member Functions inherited from sdr::PageUser
 ~PageUser ()
 

Detailed Description

The request queue stores requests that are described by the Request sorted according to priority class and then priority.

Definition at line 34 of file SlsRequestQueue.hxx.

Constructor & Destructor Documentation

◆ RequestQueue()

sd::slidesorter::cache::RequestQueue::RequestQueue ( SharedCacheContext  pCacheContext)
explicit

Definition at line 95 of file SlsRequestQueue.cxx.

◆ ~RequestQueue()

sd::slidesorter::cache::RequestQueue::~RequestQueue ( )
virtual

Definition at line 103 of file SlsRequestQueue.cxx.

References Clear().

Member Function Documentation

◆ AddRequest()

void sd::slidesorter::cache::RequestQueue::AddRequest ( CacheKey  aKey,
RequestPriorityClass  eRequestClass 
)

Insert a request with highest or lowest priority in its priority class.

When the request is already present then it is first removed. This effect is then a re-prioritization.

Parameters
aKeyThe request.
eRequestClassThe priority class in which to insert the request with highest or lowest priority.
bInsertWithHighestPriorityWhen this flag is <TRUE> the request is inserted with highest priority in its class. When <FALSE> the request is inserted with lowest priority.

Definition at line 108 of file SlsRequestQueue.cxx.

References SdrPage::AddPageUser(), SdrPage::GetPageNum(), maMutex, sd::slidesorter::cache::MAX_CLASS, sd::slidesorter::cache::MIN_CLASS, mpCacheContext, mpRequestQueue, RemoveRequest(), and SAL_INFO.

Referenced by ChangeClass(), sd::slidesorter::cache::RequestFactory::operator()(), and sd::slidesorter::cache::GenericPageCache::RequestPreviewBitmap().

◆ ChangeClass()

void sd::slidesorter::cache::RequestQueue::ChangeClass ( CacheKey  aKey,
RequestPriorityClass  eNewRequestClass 
)

Change the priority class of the specified request.

Definition at line 192 of file SlsRequestQueue.cxx.

References AddRequest(), maMutex, sd::slidesorter::cache::MAX_CLASS, sd::slidesorter::cache::MIN_CLASS, and mpRequestQueue.

Referenced by sd::slidesorter::cache::GenericPageCache::SetPreciousFlag().

◆ Clear()

void sd::slidesorter::cache::RequestQueue::Clear ( )

Remove all requests from the queue.

This resets the minimum and maximum priorities to their default values.

Definition at line 259 of file SlsRequestQueue.cxx.

References maMutex, mnMaximumPriority, mnMinimumPriority, mpRequestQueue, and SdrPage::RemovePageUser().

Referenced by sd::slidesorter::cache::GenericPageCache::InvalidateCache(), sd::slidesorter::cache::GenericPageCache::~GenericPageCache(), and ~RequestQueue().

◆ GetFront()

CacheKey sd::slidesorter::cache::RequestQueue::GetFront ( )

Get the request with the highest priority int the highest priority class.

Definition at line 211 of file SlsRequestQueue.cxx.

References maMutex, and mpRequestQueue.

Referenced by sd::slidesorter::cache::QueueProcessor::ProcessRequests().

◆ GetFrontPriorityClass()

RequestPriorityClass sd::slidesorter::cache::RequestQueue::GetFrontPriorityClass ( )

◆ GetMutex()

::osl::Mutex & sd::slidesorter::cache::RequestQueue::GetMutex ( )
inline

Return the mutex that guards the access to the priority queue.

Definition at line 93 of file SlsRequestQueue.hxx.

References maMutex.

Referenced by sd::slidesorter::cache::QueueProcessor::ProcessRequests().

◆ IsEmpty()

bool sd::slidesorter::cache::RequestQueue::IsEmpty ( )

Returns <TRUE> when there is no element in the queue.

Definition at line 253 of file SlsRequestQueue.cxx.

References maMutex, and mpRequestQueue.

Referenced by sd::slidesorter::cache::QueueProcessor::ProcessRequests(), and sd::slidesorter::cache::QueueProcessor::Resume().

◆ PageInDestruction()

void sd::slidesorter::cache::RequestQueue::PageInDestruction ( const SdrPage rPage)
overridevirtual

Ensure we don't hand out a page deleted before anyone got a chance to process it.

Implements sdr::PageUser.

Definition at line 145 of file SlsRequestQueue.cxx.

References RemoveRequest().

◆ PopFront()

void sd::slidesorter::cache::RequestQueue::PopFront ( )

Really a synonym for RemoveRequest(GetFront());.

Definition at line 233 of file SlsRequestQueue.cxx.

References maMutex, mnMaximumPriority, mnMinimumPriority, mpRequestQueue, and SdrPage::RemovePageUser().

Referenced by sd::slidesorter::cache::QueueProcessor::ProcessRequests().

◆ RemoveRequest()

bool sd::slidesorter::cache::RequestQueue::RemoveRequest ( CacheKey  aKey)

Remove the specified request from the queue.

Parameters
aKeyIt is OK when the specified request is not a member of the queue.

Definition at line 156 of file SlsRequestQueue.cxx.

References maMutex, mnMaximumPriority, mnMinimumPriority, mpRequestQueue, and SdrPage::RemovePageUser().

Referenced by AddRequest(), PageInDestruction(), and sd::slidesorter::cache::GenericPageCache::SetPreciousFlag().

Member Data Documentation

◆ maMutex

::osl::Mutex sd::slidesorter::cache::RequestQueue::maMutex
private

◆ mnMaximumPriority

int sd::slidesorter::cache::RequestQueue::mnMaximumPriority
private

An upper bound of the highest priority of all elements in the queues.

The start value is 1. It is assigned and then increased every time when an element is inserted or marked as the request with highest priority.

Definition at line 117 of file SlsRequestQueue.hxx.

Referenced by Clear(), PopFront(), and RemoveRequest().

◆ mnMinimumPriority

int sd::slidesorter::cache::RequestQueue::mnMinimumPriority
private

A lower bound of the lowest priority of all elements in the queues.

The start value is 0. It is assigned and then decreased every time when an element is inserted or marked as the request with lowest priority.

Definition at line 111 of file SlsRequestQueue.hxx.

Referenced by Clear(), PopFront(), and RemoveRequest().

◆ mpCacheContext

SharedCacheContext sd::slidesorter::cache::RequestQueue::mpCacheContext
private

Definition at line 104 of file SlsRequestQueue.hxx.

Referenced by AddRequest().

◆ mpRequestQueue

std::unique_ptr<Container> sd::slidesorter::cache::RequestQueue::mpRequestQueue
private

The documentation for this class was generated from the following files: