Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Static Public Member Functions | List of all members
Sharp::EventHandler Class Reference

#include <Event.hpp>

Static Public Member Functions

template<typename T >
static EventHandlerImpl< T > * Bind (void(*nonMemberFunctionToCall)(T &))
 
template<typename T , typename U >
static EventHandlerImpl< T > * Bind (void(U::*memberFunctionToCall)(T &), U *thisPtr)
 
static EventHandlerImpl< void > * Bind (void(*nonMemberFunctionToCall)())
 
template<typename U >
static EventHandlerImpl< void > * Bind (void(U::*memberFunctionToCall)(), U *thisPtr)
 

Detailed Description

a syntax-sugar class that is used to assign a function as a handler to an Event

myEvent += EventHandler::Bind(OnMessage);

// for non member or static functions

myEvent += EventHandler::Bind(&ThisClass::OnMessage, this);

// called inside ThisClass constructor as recommended

Author
Amer Saffo

Definition at line 317 of file Event.hpp.

Member Function Documentation

template<typename T >
static EventHandlerImpl<T>* Sharp::EventHandler::Bind ( void(*)(T &)  nonMemberFunctionToCall)
inlinestatic

to be used when setting the event handler function to an event

the event data type T should be the same as the one used to create the Event or the compiler will complain

that the the event can't accept the binded handler

Note
: EventHandler::Bind() was designed to be used ONLY to set event handlers to Event. // myEvent += EventHandler::Bind(...)
    It is important to note that Event will own the memory created by Bind when the created event handler is assigned to it by its += call,

    and so Event would destroy that memory when it no longer need it. So make sure not to keep the returned pointer yourself.

Definition at line 350 of file Event.hpp.

template<typename T , typename U >
static EventHandlerImpl<T>* Sharp::EventHandler::Bind ( void(U::*)(T &)  memberFunctionToCall,
U *  thisPtr 
)
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 357 of file Event.hpp.

static EventHandlerImpl<void>* Sharp::EventHandler::Bind ( void(*)()  nonMemberFunctionToCall)
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 367 of file Event.hpp.

template<typename U >
static EventHandlerImpl<void>* Sharp::EventHandler::Bind ( void(U::*)()  memberFunctionToCall,
U *  thisPtr 
)
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 374 of file Event.hpp.


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