LCOV - code coverage report
Current view: top level - slideshow/source/inc - activitiesqueue.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 1 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
      21             : #define INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
      22             : 
      23             : #include <deque>
      24             : 
      25             : #include "activity.hxx"
      26             : #include "unoviewcontainer.hxx"
      27             : 
      28             : #include <canvas/elapsedtime.hxx>
      29             : 
      30             : #include <boost/shared_ptr.hpp>
      31             : #include <boost/utility.hpp>
      32             : 
      33             : 
      34             : /* Definition of ActivitiesQueue class */
      35             : 
      36             : namespace slideshow
      37             : {
      38             :     namespace internal
      39             :     {
      40             :         /** This class handles the XSprite updates needed for
      41             :             animations, such as moves, scales etc. You can add
      42             :             activity objects to this class, which are called in a
      43             :             round-robin fashion.
      44             :         */
      45             :         class ActivitiesQueue : private ::boost::noncopyable
      46             :         {
      47             :         public:
      48             :             /** Create an ActivitiesQueue.
      49             : 
      50             :                 @param pPresTimer
      51             :                 Pointer to global presentation timer. Used for
      52             :                 adjusting and holding global presentation time.
      53             :              */
      54             :             ActivitiesQueue(
      55             :                 const ::boost::shared_ptr< ::canvas::tools::ElapsedTime >&  pPresTimer );
      56             :             ~ActivitiesQueue();
      57             : 
      58             :             /** Add the given activity to the queue.
      59             :              */
      60             :             bool addActivity( const ActivitySharedPtr& pActivity );
      61             : 
      62             :             /** Process the activities queue.
      63             : 
      64             :                 This method performs the smallest atomic processing
      65             :                 possible on the queue (typically, this means one
      66             :                 activity get processed).
      67             :              */
      68             :             void process();
      69             : 
      70             :             /** Call all dequeued activities' dequeued() method
      71             :              */
      72             :             void processDequeued();
      73             : 
      74             :             /** Query state of the queue
      75             : 
      76             :                 @return false, if queue is empty, true otherwise
      77             :              */
      78             :             bool isEmpty() const;
      79             : 
      80             :             /** Remove all pending activities from the queue.
      81             :              */
      82             :             void clear();
      83             : 
      84             :             /** Gets the queue's timer object.
      85             :              */
      86             :             ::boost::shared_ptr< ::canvas::tools::ElapsedTime > const &
      87           0 :             getTimer() const { return mpTimer; }
      88             : 
      89             :             /** returns number of all activities, waiting, reinserted and dequeued
      90             :              */
      91             :             std::size_t size() const
      92             :             {
      93             :                 return maCurrentActivitiesWaiting.size() + maCurrentActivitiesReinsert.size() + maDequeuedActivities.size();
      94             :             }
      95             : 
      96             :         private:
      97             :             ::boost::shared_ptr< ::canvas::tools::ElapsedTime > mpTimer;
      98             : 
      99             :             typedef ::std::deque< ActivitySharedPtr > ActivityQueue;
     100             : 
     101             :             ActivityQueue           maCurrentActivitiesWaiting;  // currently running
     102             :                                                                  // activities, that still
     103             :                                                                  // await processing for this
     104             :                                                                  // round
     105             : 
     106             :             ActivityQueue           maCurrentActivitiesReinsert;    // currently running
     107             :                                                                       // activities, that are
     108             :                                                                       // already processed for
     109             :                                                                       // this round, and wants
     110             :                                                                     // to be reinserted next
     111             :                                                                     // round
     112             : 
     113             :             ActivityQueue           maDequeuedActivities; // This list collects all activities which did not request
     114             :                                                           // a reinsertion. After the screen update has been
     115             :                                                           // performed, those are notified via dequeued(). This
     116             :                                                           // facilitates cleanup actions taking place _after_ the
     117             :                                                           // current frame has been displayed.
     118             :         };
     119             : 
     120             :     }
     121             : }
     122             : #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
     123             : 
     124             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11