Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Protected Attributes
Support::TimedEventManager::TimerTracker Struct Reference

#include <TimedEventManager.h>

List of all members.

Public Member Functions

__inline bool execute ()
__inline bool isRecurring () const
__inline bool isTimerElapsed ()
bool operator== (const TimerTracker &rhs)
__inline void reset ()
__inline void setRecurring (bool val)
 TimerTracker ()
 TimerTracker (double periodInSeconds, ThreadTaskBase *task)

Protected Attributes

bool _recurring
ThreadTaskBase_task
Timer _timer

Detailed Description

This struct is used to keep the timers in a list The default shallow copy and copy constructor is fine for this class, we do not manage the _task variable

Definition at line 29 of file TimedEventManager.h.


Constructor & Destructor Documentation

Support::TimedEventManager::TimerTracker::TimerTracker ( )

Default constructor

Definition at line 18 of file TimedEventManager.cpp.

                                                : 
        _timer(0),
        _task(NULL), 
        _recurring(false)
    {
    }
Support::TimedEventManager::TimerTracker::TimerTracker ( double  periodInSeconds,
ThreadTaskBase task 
)

Constructor for filling in period and task

Definition at line 8 of file TimedEventManager.cpp.

                                                                                            : 
        _timer(periodInSeconds),
        _task(task), 
        _recurring(false)
    {
    }

Member Function Documentation

__inline bool Support::TimedEventManager::TimerTracker::execute ( ) [inline]

executes the task in this tracker Returns true if the task can be removed, else false

Definition at line 65 of file TimedEventManager.h.

References _recurring, _task, _timer, Support::ThreadTaskBase::execute(), and Support::Timer::restart().

            {
                _task->execute();
                if(_recurring)
                {
                    _timer.restart();
                    return false;
                }
                else
                    return true;
            }
__inline bool Support::TimedEventManager::TimerTracker::isRecurring ( ) const [inline]

Definition at line 50 of file TimedEventManager.h.

{
__inline bool Support::TimedEventManager::TimerTracker::isTimerElapsed ( ) [inline]

Returns true if the timer has elapsed, else false

Definition at line 45 of file TimedEventManager.h.

References _timer, and Support::Timer::isTargetTimeElapsed().

            {
                return _timer.isTargetTimeElapsed();
            }
bool Support::TimedEventManager::TimerTracker::operator== ( const TimerTracker rhs)

== operator for use in collections

Definition at line 28 of file TimedEventManager.cpp.

References _recurring, _task, and _timer.

    {
        if((_task == rhs._task) && (_timer == rhs._timer) && (_recurring == rhs._recurring))
            return true;
        else
            return false;
    }
__inline void Support::TimedEventManager::TimerTracker::reset ( ) [inline]

Restarts the timer, priming it to fire against after its period

Definition at line 56 of file TimedEventManager.h.

References _timer, and Support::Timer::restart().

            {
                _timer.restart();
            }
__inline void Support::TimedEventManager::TimerTracker::setRecurring ( bool  val) [inline]

Definition at line 51 of file TimedEventManager.h.

Referenced by Support::TimedEventManager::addTimedEvent().

{

Member Data Documentation

Definition at line 34 of file TimedEventManager.h.

Referenced by execute(), and operator==().

Definition at line 32 of file TimedEventManager.h.

Referenced by execute(), and operator==().

Definition at line 33 of file TimedEventManager.h.

Referenced by execute(), isTimerElapsed(), operator==(), and reset().


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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net