BVB Source Codes

CRYENGINE Show CallbackTimer.h Source code

Return Download CRYENGINE: download CallbackTimer.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef __CallbackTimer_h__
  4. #define __CallbackTimer_h__
  5.  
  6. #pragma once
  7.  
  8. #include <CryCore/Containers/IDMap.h>
  9.  
  10. class CTimeValue;
  11. class CallbackTimer
  12. {
  13. public:
  14.         CallbackTimer();
  15.  
  16.         typedef uint32                   TimerID;
  17.         typedef Functor2<void*, TimerID> Callback;
  18.  
  19.         void    Clear();
  20.         void    Update();
  21.  
  22.         TimerID AddTimer(CTimeValue interval, bool repeating, const Callback& callback, void* userdata = 0);
  23.         void*   RemoveTimer(TimerID timerID);
  24.  
  25.         void    GetMemoryStatistics(ICrySizer* s);
  26. private:
  27.         struct TimerInfo
  28.         {
  29.                 TimerInfo(CTimeValue _interval, bool _repeating, const Callback& _callback, void* _userdata)
  30.                         : interval(_interval)
  31.                         , repeating(_repeating)
  32.                         , callback(_callback)
  33.                         , userdata(_userdata)
  34.                 {
  35.                 }
  36.  
  37.                 CTimeValue interval;
  38.                 Callback   callback;
  39.                 void*      userdata;
  40.                 bool       repeating;
  41.         };
  42.  
  43.         typedef id_map<size_t, TimerInfo> Timers;
  44.  
  45.         struct TimeoutInfo
  46.         {
  47.                 TimeoutInfo(CTimeValue _timeout, TimerID _timerID)
  48.                         : timeout(_timeout)
  49.                         , timerID(_timerID)
  50.                 {
  51.                 }
  52.  
  53.                 CTimeValue timeout;
  54.                 TimerID    timerID;
  55.  
  56.                 ILINE bool operator<(const TimeoutInfo& other) const
  57.                 {
  58.                         return timeout < other.timeout;
  59.                 }
  60.         };
  61.         typedef std::deque<TimeoutInfo> Timeouts;
  62.  
  63.         Timers   m_timers;
  64.         Timeouts m_timeouts;
  65.         bool     m_resort;
  66. };
  67.  
  68. #endif //__CallbackTimer_h__
  69.  
downloadCallbackTimer.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top