Bump version to 24.04.3.4
[LibreOffice.git] / slideshow / source / inc / activitiesqueue.hxx
blobf98480bb33a63b222366f207f62dc1b82dda34cb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
23 #include <deque>
25 #include "activity.hxx"
27 #include <canvas/elapsedtime.hxx>
29 #include <memory>
32 /* Definition of ActivitiesQueue class */
34 namespace slideshow::internal
36 /** This class handles the XSprite updates needed for
37 animations, such as moves, scales etc. You can add
38 activity objects to this class, which are called in a
39 round-robin fashion.
41 class ActivitiesQueue
43 public:
44 /** Create an ActivitiesQueue.
46 @param pPresTimer
47 Pointer to global presentation timer. Used for
48 adjusting and holding global presentation time.
50 explicit ActivitiesQueue(
51 std::shared_ptr< ::canvas::tools::ElapsedTime > pPresTimer );
52 ~ActivitiesQueue();
53 ActivitiesQueue(const ActivitiesQueue&) = delete;
54 ActivitiesQueue& operator=(const ActivitiesQueue&) = delete;
56 /** Add the given activity to the queue.
58 bool addActivity( const ActivitySharedPtr& pActivity );
60 /** Add the given activity prioritized last in the queue.
62 bool addTailActivity( const ActivitySharedPtr& pActivity );
64 /** Process the activities queue.
66 This method performs the smallest atomic processing
67 possible on the queue (typically, this means one
68 activity get processed).
70 void process();
72 /** Call all dequeued activities' dequeued() method
74 void processDequeued();
76 /** Query state of the queue
78 @return false, if queue is empty, true otherwise
80 bool isEmpty() const;
82 /** Remove all pending activities from the queue.
84 void clear();
86 /** Gets the queue's timer object.
88 std::shared_ptr< ::canvas::tools::ElapsedTime > const &
89 getTimer() const { return mpTimer; }
91 private:
92 std::shared_ptr< ::canvas::tools::ElapsedTime > mpTimer;
94 typedef ::std::deque< ActivitySharedPtr > ActivityQueue;
96 ActivityQueue maCurrentActivitiesWaiting; // currently running
97 // activities, that still
98 // await processing for this
99 // round
101 ActivityQueue maCurrentTailActivitiesWaiting; // activities that will be
102 // processed last in the queue
104 ActivityQueue maCurrentActivitiesReinsert; // currently running
105 // activities, that are
106 // already processed for
107 // this round, and wants
108 // to be reinserted next
109 // round
111 ActivityQueue maDequeuedActivities; // This list collects all activities which did not request
112 // a reinsertion. After the screen update has been
113 // performed, those are notified via dequeued(). This
114 // facilitates cleanup actions taking place _after_ the
115 // current frame has been displayed.
119 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */