Ark Server API (ASA) - 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 DelayExecute (const FString &identifier, 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.
 
template<typename Func , typename... Args>
void RecurringExecute (const FString &identifier, const Func &callback, int execution_interval, int execution_counter, bool async, Args &&... args)
 Executes function every X seconds.
 
void UnloadTimer (const FString &identifier)
 Unloads timer by identifier.
 
void UnloadAllTimers ()
 Unloads all timers from the caller plugin.
 

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, const FString &identifier="", const FString &moduleName="")
 
ARK_API void RecurringExecuteInternal (const std::function< void()> &callback, int execution_interval, int execution_counter, bool async, const FString &identifier, const FString &moduleName)
 
ARK_API void UnloadTimerInternal (const FString &identifier)
 
ARK_API void UnloadTimersFromModule (const FString &moduleName)
 
void Update ()
 

Private Attributes

std::vector< std::shared_ptr< TimerFunc > > timer_funcs_
 

Friends

class PluginManager
 

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 9 of file Timer.cpp.

◆ ~Timer()

API::Timer::~Timer ( )
private

Definition at line 14 of file Timer.cpp.

Member Function Documentation

◆ DelayExecute() [1/2]

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

Executes function after X seconds.

Parameters
identifierUnique identifier for the delay execute
Template Parameters
FuncCallback function type
ArgsCallback arguments types
Parameters
callbackCallback function
delayDelay in seconds
argsCallback arguments

Definition at line 44 of file Timer.h.

◆ DelayExecute() [2/2]

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,
const FString & identifier = "",
const FString & moduleName = "" )
private

Definition at line 25 of file Timer.cpp.

◆ Get()

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

Definition at line 19 of file Timer.cpp.

+ Here is the caller graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ RecurringExecute() [1/2]

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

Executes function every X seconds.

Parameters
identifierUnique identifier for the delay execute
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 80 of file Timer.h.

◆ RecurringExecute() [2/2]

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 60 of file Timer.h.

◆ RecurringExecuteInternal()

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

Definition at line 33 of file Timer.cpp.

◆ UnloadAllTimers()

void API::Timer::UnloadAllTimers ( )
inline

Unloads all timers from the caller plugin.

Definition at line 99 of file Timer.h.

+ Here is the call graph for this function:

◆ UnloadTimer()

void API::Timer::UnloadTimer ( const FString & identifier)
inline

Unloads timer by identifier.

Parameters
identifierUnique identifier for the timer, either a delay execute or a recurring execute

Definition at line 91 of file Timer.h.

+ Here is the call graph for this function:

◆ UnloadTimerInternal()

void API::Timer::UnloadTimerInternal ( const FString & identifier)
private

Definition at line 64 of file Timer.cpp.

+ Here is the caller graph for this function:

◆ UnloadTimersFromModule()

void API::Timer::UnloadTimersFromModule ( const FString & moduleName)
private

Definition at line 73 of file Timer.cpp.

+ Here is the caller graph for this function:

◆ Update()

void API::Timer::Update ( )
private

Definition at line 82 of file Timer.cpp.

Friends And Related Symbol Documentation

◆ PluginManager

Definition at line 105 of file Timer.h.

Member Data Documentation

◆ timer_funcs_

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

Definition at line 143 of file Timer.h.


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