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

Implements event handle, used to automatically unbind callback 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 event handle, used to automatically unbind callback on destruction.

This is very important to avoid crashing the program in case that user forgets to unbind the callback. Instead, the event handle will unbind the callback automatically when parent object is destroyed.

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: