16#include "ksEventInterface.h" 
   17#include "ksEventHandle.h" 
   24#define DECLARE_KS_EVENT(evtName, ...) \ 
   25    std::shared_ptr<ksf::evt::ksEvent<__VA_ARGS__>> evtName {std::make_shared<ksf::evt::ksEvent<__VA_ARGS__>>()}; 
   33    template <
typename... Params>
 
   37            std::vector<std::pair<std::size_t, std::function<void(Params...)>>> 
callbacks;  
 
   55            void registerEvent(std::unique_ptr<ksf::evt::ksEventHandle>& outHandle, std::function<
void(Params...)>&& function)
 
   58                outHandle = std::make_unique<ksf::evt::ksEventHandle>(weak_from_this(), 
lastCallbackUID);
 
 
   70            void unbind(std::size_t callbackUID)
 override 
   72                auto predicate = [callbackUID](
const auto& cb) {
 
   73                    auto& [uid, function] = cb;
 
   74                    return uid == callbackUID; 
 
 
   86                for (
const auto& [uid, function] : 
callbacks)
 
 
 
Base class for multicasting events.
Definition ksEvent.h:35
 
void registerEvent(std::unique_ptr< ksf::evt::ksEventHandle > &outHandle, std::function< void(Params...)> &&function)
Registers event (binds to callback list).
Definition ksEvent.h:55
 
std::vector< std::pair< std::size_t, std::function< void(Params...)> > > callbacks
List of bond callbacks.
Definition ksEvent.h:37
 
void unbind(std::size_t callbackUID) override
Unbinds event callback by specified unique ID.
Definition ksEvent.h:70
 
std::size_t lastCallbackUID
Last unique callback ID for this event (used as counter).
Definition ksEvent.h:38
 
bool isBound() const
Returns whether any callback is bound to this event.
Definition ksEvent.h:45
 
void broadcast(Params... params) const
Broadcasts event to all bound callbacks.
Definition ksEvent.h:84
 
Implements interface for multicasting events.
Definition ksEventInterface.h:21