Doxygen with github
Loading...
Searching...
No Matches
ksEventHandle.h
1/*
2 * Copyright (c) 2021-2023, Krzysztof Strehlau
3 *
4 * This file is a part of the ksIotFramework library.
5 * All licensing information can be found inside LICENSE.md file.
6 *
7 * https://github.com/cziter15/ksIotFrameworkLib/blob/master/LICENSE
8 */
9
10#pragma once
11
12#include <memory>
13#include <cstddef>
14
15namespace ksf::evt
16{
17 class ksEventInterface;
18
26 {
27 protected:
28 std::weak_ptr<ksEventInterface> eventBaseWp;
29 std::size_t callbackUID{0};
30
31 public:
37 ksEventHandle(std::weak_ptr<ksEventInterface>&& eventBaseWp, std::size_t callbackUID);
38
42 virtual ~ksEventHandle();
43 };
44}
Implements event handle, used to automatically unbind callback on destruction.
Definition ksEventHandle.h:26
std::weak_ptr< ksEventInterface > eventBaseWp
Weak pointer to event object.
Definition ksEventHandle.h:28
std::size_t callbackUID
Unique callback ID.
Definition ksEventHandle.h:29
ksEventHandle(std::weak_ptr< ksEventInterface > &&eventBaseWp, std::size_t callbackUID)
Constructs event handle.
Definition ksEventHandle.cpp:15
virtual ~ksEventHandle()
Destructs event handle. Unbinds assigned callback from the list.
Definition ksEventHandle.cpp:19