Doxygen with github
Loading...
Searching...
No Matches
ksf::evt::ksEventHandle Class Reference

Implements an event handle that automatically unbinds callbacks on destruction. More...

#include <ksEventHandle.h>

Public Member Functions

 ksEventHandle (std::weak_ptr< ksEventInterface > &&eventBaseWp, std::size_t callbackUID)
 Constructs event handle.
 
virtual ~ksEventHandle ()
 Destructs event handle. Unbinds assigned callback from the list.
 

Protected Attributes

std::weak_ptr< ksEventInterfaceeventBaseWp
 Weak pointer to event object.
 
std::size_t callbackUID {0}
 Unique callback ID.
 

Detailed Description

Implements an event handle that automatically unbinds callbacks on destruction.

This prevents program crashes caused by forgetting to manually unbind callbacks. When the parent object is destroyed, the event handle ensures the callback is automatically unbound.

Constructor & Destructor Documentation

◆ ksEventHandle()

ksf::evt::ksEventHandle::ksEventHandle ( std::weak_ptr< ksEventInterface > && eventBaseWp,
std::size_t callbackUID )

Constructs event handle.

Parameters
eventBaseWpR-value reference to weak pointer to event object.
callbackUIDUnique callback ID.

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