class TEvent

template<typename ReturnType, ThreadSafetyPolicy Policy, typename ...ArgumentType>

Events allows you to register method callbacks that get notified when the event is triggered.

Template parameters

Policy

Thread safety policy. ThreadSafe uses a mutex and atomic ref-counting. ThreadUnsafe eliminates all locking overhead for use in single-threaded contexts.

Public

Constructors

TEvent<ReturnType, Policy, ArgumentType...>

TEvent<ReturnType, Policy, ArgumentType...>()

Methods

~TEvent<ReturnType, Policy, ArgumentType...>

~TEvent<ReturnType, Policy, ArgumentType...>()

Connect

THEvent<Policy> Connect(std::function<ReturnType (ArgumentType...)> callback)

Register a new callback that will get notified once the event is triggered.

Clear

void Clear()

Clear all callbacks from the event.

Empty

bool Empty() const

Check if event has any callbacks registered.

Operators

operator()

void operator()(ArgumentType ...arguments)

Trigger the event, notifying all register callback methods.

Private

Fields

mControlBlock

TShared<TEventControlBlock<Policy>, Policy> mControlBlock