Potato Engine
Loading...
Searching...
No Matches
EventDelegate< CallbackArgs > Struct Template Reference

A wrapper that carries response delegate information. More...

#include <EventDelegate.hpp>

Public Member Functions

template<typename BindingClass>
 EventDelegate (BindingClass *obj, void(BindingClass::*method)(CallbackArgs...))
 Constructs delegate with class method binding.
 EventDelegate (void(*func)(CallbackArgs...))
 Constructs bare delegate.
bool Fire (CallbackArgs... args) const
 Fires event and forwards arguments to callback.
void * GetInstance () const
 Gets binded object.

Detailed Description

template<typename... CallbackArgs>
struct EventDelegate< CallbackArgs >

A wrapper that carries response delegate information.

Used to subscribe to events in a binding struct/method

Template Parameters
CallbackArgs...arguments to pass when notifying the callback function

Definition at line 12 of file EventDelegate.hpp.

Constructor & Destructor Documentation

◆ EventDelegate() [1/2]

template<typename... CallbackArgs>
template<typename BindingClass>
EventDelegate< CallbackArgs >::EventDelegate ( BindingClass * obj,
void(BindingClass::* method )(CallbackArgs...) )
inline

Constructs delegate with class method binding.

  • Template Parameters
    BindingClassClass for binding
    Parameters
    objobject to bind to
    methodcallback with additional arguments

Definition at line 31 of file EventDelegate.hpp.

◆ EventDelegate() [2/2]

template<typename... CallbackArgs>
EventDelegate< CallbackArgs >::EventDelegate ( void(* func )(CallbackArgs...))
inline

Constructs bare delegate.

Warning
This construction is not recommended.
See also
EventDelegate<...>(...)
Parameters
funccallback with additional arguments

Definition at line 43 of file EventDelegate.hpp.

Member Function Documentation

◆ Fire()

template<typename... CallbackArgs>
bool EventDelegate< CallbackArgs >::Fire ( CallbackArgs... args) const
inline

Fires event and forwards arguments to callback.

Returns
true if the fire was sucessfull

Definition at line 51 of file EventDelegate.hpp.

◆ GetInstance()

template<typename... CallbackArgs>
void * EventDelegate< CallbackArgs >::GetInstance ( ) const
inline

Gets binded object.

Returns
void* object

Definition at line 58 of file EventDelegate.hpp.