LibreOffice Module slideshow (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
slideshow::internal::EventQueue Class Reference

This class handles events in a presentation. More...

#include <eventqueue.hxx>

Classes

struct  EventEntry
 

Public Member Functions

 EventQueue (std::shared_ptr< ::canvas::tools::ElapsedTime > pPresTimer)
 
 ~EventQueue ()
 
 EventQueue (const EventQueue &)=delete
 
EventQueueoperator= (const EventQueue &)=delete
 
bool addEvent (const EventSharedPtr &event)
 Add the given event to the queue. More...
 
bool addEventForNextRound (const EventSharedPtr &event)
 Add the given event to the queue. More...
 
bool addEventWhenQueueIsEmpty (const EventSharedPtr &rpEvent)
 Another way to control the order of asynchronous event execution. More...
 
void process ()
 Process the event queue. More...
 
bool isEmpty () const
 Query state of the queue. More...
 
double nextTimeout () const
 Query timeout for the topmost event in the queue. More...
 
void clear ()
 Remove all pending events from the queue. More...
 
void forceEmpty ()
 Forces an empty queue, firing all events immediately without minding any times. More...
 
std::shared_ptr< ::canvas::tools::ElapsedTime > const & getTimer () const
 Gets the queue's timer object. More...
 

Private Types

typedef ::std::priority_queue< EventEntryImplQueueType
 
typedef ::std::vector< EventEntryEventEntryVector
 

Private Member Functions

void process_ (bool bFireAllEvents)
 

Private Attributes

std::mutex maMutex
 
ImplQueueType maEvents
 
EventEntryVector maNextEvents
 
ImplQueueType maNextNextEvents
 
std::shared_ptr< ::canvas::tools::ElapsedTimempTimer
 

Detailed Description

This class handles events in a presentation.

Events are time instants where e.g. effects start.

Definition at line 40 of file eventqueue.hxx.

Member Typedef Documentation

◆ EventEntryVector

Definition at line 134 of file eventqueue.hxx.

◆ ImplQueueType

typedef ::std::priority_queue< EventEntry > slideshow::internal::EventQueue::ImplQueueType
private

Definition at line 132 of file eventqueue.hxx.

Constructor & Destructor Documentation

◆ EventQueue() [1/2]

slideshow::internal::EventQueue::EventQueue ( std::shared_ptr< ::canvas::tools::ElapsedTime pPresTimer)

◆ ~EventQueue()

slideshow::internal::EventQueue::~EventQueue ( )

Definition at line 55 of file eventqueue.cxx.

References maEvents, maNextEvents, and TOOLS_WARN_EXCEPTION.

◆ EventQueue() [2/2]

slideshow::internal::EventQueue::EventQueue ( const EventQueue )
delete

Member Function Documentation

◆ addEvent()

bool slideshow::internal::EventQueue::addEvent ( const EventSharedPtr event)

◆ addEventForNextRound()

bool slideshow::internal::EventQueue::addEventForNextRound ( const EventSharedPtr event)

Add the given event to the queue.

The event is fired at, or shortly after, its Event::getActivationTime instant. The difference to addEvent() is that events added during process() are postponed to next process().

Definition at line 105 of file eventqueue.cxx.

References ENSURE_OR_RETURN_FALSE, maMutex, maNextEvents, mpTimer, and SAL_INFO.

Referenced by slideshow::internal::EventMultiplexerImpl::scheduleTick().

◆ addEventWhenQueueIsEmpty()

bool slideshow::internal::EventQueue::addEventWhenQueueIsEmpty ( const EventSharedPtr rpEvent)

Another way to control the order of asynchronous event execution.

Use this method to schedule events that are to be executed after all regular events that have no delay, even when they schedule new regular events without delay.

Definition at line 122 of file eventqueue.cxx.

References ENSURE_OR_RETURN_FALSE, maMutex, maNextNextEvents, mpTimer, and SAL_INFO.

Referenced by slideshow::internal::SkipEffectEventHandler::handleEvent_impl().

◆ clear()

void slideshow::internal::EventQueue::clear ( )

Remove all pending events from the queue.

Definition at line 283 of file eventqueue.cxx.

References maEvents, maMutex, maNextEvents, and maNextNextEvents.

◆ forceEmpty()

void slideshow::internal::EventQueue::forceEmpty ( )

Forces an empty queue, firing all events immediately without minding any times.

Attention: \n do only call from event loop, this calls process_()!

Definition at line 142 of file eventqueue.cxx.

References process_().

Referenced by slideshow::internal::EffectRewinder::asynchronousRewind(), slideshow::internal::EffectRewinder::rewind(), slideshow::internal::SequentialTimeContainer::skipEffect(), and slideshow::internal::EffectRewinder::skipSingleMainSequenceEffects().

◆ getTimer()

std::shared_ptr< ::canvas::tools::ElapsedTime > const & slideshow::internal::EventQueue::getTimer ( ) const
inline

Gets the queue's timer object.

Definition at line 116 of file eventqueue.hxx.

References mpTimer.

Referenced by slideshow::internal::RehearseTimingsActivity::create(), and slideshow::internal::createDrawingLayerAnimActivity().

◆ isEmpty()

bool slideshow::internal::EventQueue::isEmpty ( ) const

Query state of the queue.

Returns
false, if queue is empty, true otherwise

Definition at line 259 of file eventqueue.cxx.

References maEvents, maMutex, maNextEvents, and maNextNextEvents.

◆ nextTimeout()

double slideshow::internal::EventQueue::nextTimeout ( ) const

Query timeout for the topmost event in the queue.

Returns
Timeout in seconds, until the next event is ready. The time returned here is relative to the pres timer (i.e. the timer specified at the EventQueue constructor). When the queue is empty (i.e. isEmpty() returns true), the returned value is the highest representable double value (::std::numeric_limits<double>::max()). If the topmost event in the queue is already pending, the timeout returned here will actually be negative.

Definition at line 266 of file eventqueue.cxx.

References maEvents, maMutex, maNextEvents, maNextNextEvents, and mpTimer.

◆ operator=()

EventQueue & slideshow::internal::EventQueue::operator= ( const EventQueue )
delete

◆ process()

void slideshow::internal::EventQueue::process ( )

Process the event queue.

This method executes all events whose timeout has expired when calling this method (i.e. all events whose scheduled time is less or equal the current time).

Check for the next available event's timeout via nextTimeout(), or whether the queue is empty altogether via isEmpty().

Definition at line 147 of file eventqueue.cxx.

References process_().

◆ process_()

void slideshow::internal::EventQueue::process_ ( bool  bFireAllEvents)
private

Member Data Documentation

◆ maEvents

ImplQueueType slideshow::internal::EventQueue::maEvents
private

Definition at line 133 of file eventqueue.hxx.

Referenced by addEvent(), clear(), isEmpty(), nextTimeout(), process_(), and ~EventQueue().

◆ maMutex

std::mutex slideshow::internal::EventQueue::maMutex
mutableprivate

◆ maNextEvents

EventEntryVector slideshow::internal::EventQueue::maNextEvents
private

Definition at line 135 of file eventqueue.hxx.

Referenced by addEventForNextRound(), clear(), isEmpty(), nextTimeout(), process_(), and ~EventQueue().

◆ maNextNextEvents

ImplQueueType slideshow::internal::EventQueue::maNextNextEvents
private

Definition at line 136 of file eventqueue.hxx.

Referenced by addEventWhenQueueIsEmpty(), clear(), isEmpty(), nextTimeout(), and process_().

◆ mpTimer

std::shared_ptr< ::canvas::tools::ElapsedTime > slideshow::internal::EventQueue::mpTimer
private

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