VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtFunctionQueue Class Reference

#include <functionQueue.h>

Classes

struct  QueuedFunction
 

Public Types

enum  ExecTiming { PRE_TICK , POST_TICK }
 

Public Member Functions

 DtFunctionQueue ()=default
 
virtual ~DtFunctionQueue ()
 
void add (std::function< void()> f, int delayInTicks=0, ExecTiming timing=PRE_TICK)
 
void add (std::function< void()> f, double delayInSeconds, ExecTiming timing=PRE_TICK)
 

Protected Member Functions

void preTick (makVrv::DtDe &)
 
void postTick ()
 
void connectTicks ()
 
void processQueue (std::list< QueuedFunction > &queue, double dt)
 

Protected Attributes

std::list< QueuedFunction > myPreTickQueue
 
std::list< QueuedFunction > myPostTickQueue
 
bool myTicksConnected = false
 
double myPreTickLastTime = 0.0
 
double myPostTickLastTime = 0.0
 
makVrv::DtDe * myDe = nullptr
 

Member Enumeration Documentation

◆ ExecTiming

Enumerator
PRE_TICK 
POST_TICK 

Constructor & Destructor Documentation

◆ DtFunctionQueue()

makVre::DtFunctionQueue::DtFunctionQueue ( )
default

◆ ~DtFunctionQueue()

virtual makVre::DtFunctionQueue::~DtFunctionQueue ( )
virtual

Member Function Documentation

◆ add() [1/2]

void makVre::DtFunctionQueue::add ( std::function< void()> f,
int delayInTicks = 0,
ExecTiming timing = PRE_TICK )

Defers a function to be executed after a number of ticks.

Parameters
fFunction to execute
delayInTicksNumber of ticks to wait before execution (default: 0)
timingTick phase in which to execute: PRE_TICK or POST_TICK (default: PRE_TICK)

Schedules a function to be executed after the specified number of ticks.

References PRE_TICK.

◆ add() [2/2]

void makVre::DtFunctionQueue::add ( std::function< void()> f,
double delayInSeconds,
ExecTiming timing = PRE_TICK )

Defers a function to be executed after a time delay.

Parameters
fFunction to execute
delayInSecondsSeconds to wait before execution
timingTick phase in which to execute: PRE_TICK or POST_TICK (default: PRE_TICK)

Schedules a function to be executed after the specified time delay in seconds.

References PRE_TICK.

◆ preTick()

void makVre::DtFunctionQueue::preTick ( makVrv::DtDe & )
protected

◆ postTick()

void makVre::DtFunctionQueue::postTick ( )
protected

◆ connectTicks()

void makVre::DtFunctionQueue::connectTicks ( )
protected

◆ processQueue()

void makVre::DtFunctionQueue::processQueue ( std::list< QueuedFunction > & queue,
double dt )
protected

Member Data Documentation

◆ myPreTickQueue

std::list<QueuedFunction> makVre::DtFunctionQueue::myPreTickQueue
protected

List of deferred functions.

Contains functions that are scheduled to be executed after a delay.

◆ myPostTickQueue

std::list<QueuedFunction> makVre::DtFunctionQueue::myPostTickQueue
protected

◆ myTicksConnected

bool makVre::DtFunctionQueue::myTicksConnected = false
protected

◆ myPreTickLastTime

double makVre::DtFunctionQueue::myPreTickLastTime = 0.0
protected

◆ myPostTickLastTime

double makVre::DtFunctionQueue::myPostTickLastTime = 0.0
protected

◆ myDe

makVrv::DtDe* makVre::DtFunctionQueue::myDe = nullptr
protected

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