Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
API::Timer Class Reference

#include <Timer.h>

Classes

struct  TimerFunc
 

Public Member Functions

 Timer (const Timer &)=delete
 
 Timer (Timer &&)=delete
 
Timeroperator= (const Timer &)=delete
 
Timeroperator= (Timer &&)=delete
 
template<typename Func , typename... Args>
void DelayExecute (const Func &callback, int delay, Args &&... args)
 Executes function after X seconds.
 
template<typename Func , typename... Args>
void RecurringExecute (const Func &callback, int execution_interval, int execution_counter, bool async, Args &&... args)
 Executes function every X seconds.
 

Static Public Member Functions

static ARK_API TimerGet ()
 

Private Member Functions

 Timer ()
 
 ~Timer ()
 
ARK_API void DelayExecuteInternal (const std::function< void()> &callback, int delay_seconds)
 
ARK_API void RecurringExecuteInternal (const std::function< void()> &callback, int execution_interval, int execution_counter, bool async)
 
void Update ()
 

Private Attributes

std::vector< std::unique_ptr< TimerFunc > > timer_funcs_
 

Detailed Description

Definition at line 10 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer() [1/3]

API::Timer::Timer ( const Timer & )
delete

◆ Timer() [2/3]

API::Timer::Timer ( Timer && )
delete

◆ Timer() [3/3]

API::Timer::Timer ( )
private

Definition at line 7 of file Timer.cpp.

+ Here is the call graph for this function:

◆ ~Timer()

API::Timer::~Timer ( )
private

Definition at line 12 of file Timer.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ DelayExecute()

template<typename Func , typename... Args>
void API::Timer::DelayExecute ( const Func & callback,
int delay,
Args &&... args )
inline

Executes function after X seconds.

Template Parameters
FuncCallback function type
ArgsCallback arguments types
Parameters
callbackCallback function
delayDelay in seconds
argsCallback arguments

Definition at line 29 of file Timer.h.

◆ DelayExecuteInternal()

void API::Timer::DelayExecuteInternal ( const std::function< void()> & callback,
int delay_seconds )
private

Definition at line 23 of file Timer.cpp.

◆ Get()

Timer & API::Timer::Get ( )
static

Definition at line 17 of file Timer.cpp.

◆ operator=() [1/2]

Timer & API::Timer::operator= ( const Timer & )
delete

◆ operator=() [2/2]

Timer & API::Timer::operator= ( Timer && )
delete

◆ RecurringExecute()

template<typename Func , typename... Args>
void API::Timer::RecurringExecute ( const Func & callback,
int execution_interval,
int execution_counter,
bool async,
Args &&... args )
inline

Executes function every X seconds.

Template Parameters
FuncCallback function type
ArgsCallback arguments types
Parameters
callbackCallback function
execution_intervalDelay between executions in seconds
execution_counterAmount of times to execute function, -1 for unlimited
asyncIf true, function will be executed in the new thread
argsCallback arguments

Definition at line 45 of file Timer.h.

◆ RecurringExecuteInternal()

void API::Timer::RecurringExecuteInternal ( const std::function< void()> & callback,
int execution_interval,
int execution_counter,
bool async )
private

Definition at line 31 of file Timer.cpp.

◆ Update()

void API::Timer::Update ( )
private

Definition at line 62 of file Timer.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ timer_funcs_

std::vector<std::unique_ptr<TimerFunc> > API::Timer::timer_funcs_
private

Definition at line 82 of file Timer.h.


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