PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
EventQueueEntry< T > Struct Template Reference

Event queue entry. More...

#include <event_queue.h>

Public Types

enum  __Types {
  dummy =-1, caller =0, caller_t, caller_func,
  timer, wait_flag_var, wait_flag_func, wait_flag_func_t,
  wait_condition
}
 

Public Member Functions

void makeCaller (void(*_caller)(void), int _delay=0)
 makeCaller More...
 
void makeCallerT (T *_obj, void(T::*_caller)(void), int _delay=0)
 makeCallerT More...
 
void makeCaller (std::function< void()> _call_func, int _delay=0)
 makeCaller More...
 
void makeTimer (int _delay)
 makeTimer More...
 
void makeWaiterFlag (bool *_flag, bool target=true, int _delay=0)
 makeWaiterFlag Waits while flag is equal to target state More...
 
void makeWaiterFlag (bool(*_flag)(), bool target=true, int _delay=0)
 makeWaiterFlag Waits while static or non-member function returns equal to target state More...
 
void makeWaiterFlagT (T *_obj, bool(T::*_flag)(), bool target=true, int _delay=0)
 makeWaiterFlagT Waits while member function returns equal to target state More...
 
void makeWaiterCond (std::function< bool()> _condition, bool target=true, int _delay=0)
 makeWaiterCond Waits while lamda-function returns equal to target state More...
 
float trigger (float step=1)
 trigger More...
 

Public Attributes

T * obj
 
void(* call )(void)
 
void(T::* call_t )(void)
 
std::function< void()> call_func
 
float delay
 
bool * flag_var
 
bool(* flag_func )()
 
bool(T::* flag_func_t )()
 
std::function< bool()> condition
 
bool flag_target
 
__Types type
 

Detailed Description

template<class T>
struct EventQueueEntry< T >

Event queue entry.

Entry of an event queue, holds a delay time, pointer to variable, function. Also can hold a lamda-function code for execution.

Member Function Documentation

template<class T >
void EventQueueEntry< T >::makeCaller ( void(*)(void)  _caller,
int  _delay = 0 
)
inline

makeCaller

Executes a static or any static non-member function

Parameters
_callerpointer to a static or any non-member function
_delaytime in milliseconds to wait before this function will be executed
template<class T >
void EventQueueEntry< T >::makeCaller ( std::function< void()>  _call_func,
int  _delay = 0 
)
inline

makeCaller

Executes a code of lamda-function

Parameters
_call_funclamda-function which returns void
_delaytime in milliseconds to wait before this function will be executed
template<class T >
void EventQueueEntry< T >::makeCallerT ( T *  _obj,
void(T::*)(void)  _caller,
int  _delay = 0 
)
inline

makeCallerT

Executes a member function of object of a type equal to defined on creation of templated event queue entry

Parameters
_objpointer to object where function must be executed
_delaytime in milliseconds to wait before this function will be executed
template<class T >
void EventQueueEntry< T >::makeTimer ( int  _delay)
inline

makeTimer

Waits a specified time

Parameters
_delaymilliseconds to wait
template<class T >
void EventQueueEntry< T >::makeWaiterCond ( std::function< bool()>  _condition,
bool  target = true,
int  _delay = 0 
)
inline

makeWaiterCond Waits while lamda-function returns equal to target state

Parameters
_flaglamda-function which returns a boolean
targettarget state
_delaymilliseconds to wait before checking of target state will be processed
template<class T >
void EventQueueEntry< T >::makeWaiterFlag ( bool *  _flag,
bool  target = true,
int  _delay = 0 
)
inline

makeWaiterFlag Waits while flag is equal to target state

Parameters
_flagPointer to boolean variable
targettarget state
_delaymilliseconds to wait before checking of target state will be processed
template<class T >
void EventQueueEntry< T >::makeWaiterFlag ( bool(*)()  _flag,
bool  target = true,
int  _delay = 0 
)
inline

makeWaiterFlag Waits while static or non-member function returns equal to target state

Parameters
_flagPointer to function which returns a boolean
targettarget state
_delaymilliseconds to wait before checking of target state will be processed
template<class T >
void EventQueueEntry< T >::makeWaiterFlagT ( T *  _obj,
bool(T::*)()  _flag,
bool  target = true,
int  _delay = 0 
)
inline

makeWaiterFlagT Waits while member function returns equal to target state

Parameters
_flagPointer to function which returns a boolean
targettarget state
_delaymilliseconds to wait before checking of target state will be processed
template<class T >
float EventQueueEntry< T >::trigger ( float  step = 1)
inline

trigger

Warning
this function is using by event queue internally. Use this function if you use this event outside of queue!

Processes this event.

Parameters
steptime delay between loop steps
Returns
time left after delaying. Append this piece to step value in next time

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