SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::EventDelegate< EventT > Class Template Reference

#include <Delegate.hpp>

Inheritance diagram for Sleak::EventDelegate< EventT >:

Public Types

using FunctionType = std::function<void(const EventT&)>

Public Member Functions

 EventDelegate (FunctionType func)
void Execute () override
std::string GenerateID ()
 Assigns a fresh random 32-character ID, used to identify this delegate for unregistration.
std::string GetID () override
void SetEvent (const EventT &event)
Public Member Functions inherited from Sleak::EventDelegateBase
virtual ~EventDelegateBase ()=default
Public Member Functions inherited from Sleak::IDelegate
virtual ~IDelegate ()=default

Detailed Description

template<typename EventT>
class Sleak::EventDelegate< EventT >

Delegate bound to a single EventT callback; holds a non-owning pointer to the event set just before Execute() runs.

Definition at line 65 of file Delegate.hpp.

Member Typedef Documentation

◆ FunctionType

template<typename EventT>
using Sleak::EventDelegate< EventT >::FunctionType = std::function<void(const EventT&)>

Definition at line 67 of file Delegate.hpp.

Constructor & Destructor Documentation

◆ EventDelegate()

template<typename EventT>
Sleak::EventDelegate< EventT >::EventDelegate ( FunctionType func)
inline

Definition at line 69 of file Delegate.hpp.

Member Function Documentation

◆ Execute()

template<typename EventT>
void Sleak::EventDelegate< EventT >::Execute ( )
inlineoverridevirtual

Implements Sleak::IDelegate.

Definition at line 77 of file Delegate.hpp.

◆ GenerateID()

template<typename EventT>
std::string Sleak::EventDelegate< EventT >::GenerateID ( )
inline

Assigns a fresh random 32-character ID, used to identify this delegate for unregistration.

Definition at line 84 of file Delegate.hpp.

◆ GetID()

template<typename EventT>
std::string Sleak::EventDelegate< EventT >::GetID ( )
inlineoverridevirtual

Implements Sleak::EventDelegateBase.

Definition at line 100 of file Delegate.hpp.

◆ SetEvent()

template<typename EventT>
void Sleak::EventDelegate< EventT >::SetEvent ( const EventT & event)
inline

Definition at line 73 of file Delegate.hpp.