iFun Engine API  1.0.0-b6053
Great Technology for Great Games
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
fun::Timer Class Reference

Timer singleton.

#include <timer.h>

Inheritance diagram for fun::Timer:
fun::Component

Public Types

typedef function< void(const Id &, const WallClock::Value &)> Handler
 Handler that is called when a timer gets fired.
 
typedef uint64_t Id
 Id to identify timers.
 

Static Public Member Functions

static void Cancel (const Id &timer_id) ASSERT_NO_ROLLBACK
 Cancel the given timer. More...
 
static Id ExpireAfter (const WallClock::Duration &rel_time, const Handler &handler, const EventTag &tag=kTimerEventTag) ASSERT_NO_ROLLBACK
 Sets a timer that will be fired in relative time T. More...
 
static Id ExpireAt (const WallClock::Value &abs_time, const Handler &handler, const EventTag &tag=kTimerEventTag) ASSERT_NO_ROLLBACK
 Sets a timer that will be fired at an absolute time T. More...
 
static Id ExpireRepeatedly (const WallClock::Duration &interval, const Handler &handler, const EventTag &tag=kTimerEventTag) ASSERT_NO_ROLLBACK
 Sets a timer that will be fired repeatedly. More...
 
static bool Install (const fun::ArgumentMap &arguments)
 Called by the Funapi framework.
 
static bool Uninstall ()
 
- Static Public Member Functions inherited from fun::Component
static const ArgumentMapFindArgument (const string &component_name)
 

Static Public Attributes

static const Id kInvalidTimerId
 invalid timer id.
 

Member Function Documentation

◆ Cancel()

static void fun::Timer::Cancel ( const Id timer_id)
static
Parameters
timer_idtimer id to cancel.

◆ ExpireAfter()

static Id fun::Timer::ExpireAfter ( const WallClock::Duration &  rel_time,
const Handler handler,
const EventTag tag = kTimerEventTag 
)
static
Parameters
rel_timerelative time to expire.
handlerHandler instance.
Returns
new timer id.

◆ ExpireAt()

static Id fun::Timer::ExpireAt ( const WallClock::Value &  abs_time,
const Handler handler,
const EventTag tag = kTimerEventTag 
)
static
Parameters
abs_timeabsolute time to expire.
handlerHandler instance.
Returns
new timer id.

◆ ExpireRepeatedly()

static Id fun::Timer::ExpireRepeatedly ( const WallClock::Duration &  interval,
const Handler handler,
const EventTag tag = kTimerEventTag 
)
static
Parameters
intervaltime interval
handlerHandler instance.
Returns
new timer id.