feat/add_eventbus #9

Merged
tqcq merged 7 commits from feat/add_eventbus into develop 2024-01-19 12:51:30 +08:00
Showing only changes of commit 377613c9ba - Show all commits

View File

@ -18,9 +18,9 @@ class ProtectedEventStream : public EventStream
using Callback = std::function<CallbackReturn(const Event&, ExtraArgTypes...)>;
public:
void postpone(std::any event) override
void postpone(nonstd::any event) override
{
auto myEvent = std::any_cast<Event>(event);
auto myEvent = nonstd::any_cast<Event>(event);
std::lock_guard writeGuard{_mutexEvent};
_queue.push_back(std::move(myEvent));
}
@ -67,10 +67,10 @@ public:
return processEvents.size();
}
bool addListener(const std::uint32_t listenerID, std::any callback) override
bool addListener(const std::uint32_t listenerID, nonstd::any callback) override
{
std::lock_guard writeGuard{_mutexCallbacks};
auto myCallback = std::any_cast<Callback>(callback);
auto myCallback = nonstd::any_cast<Callback>(callback);
if(_isProcessing)
{
_waiting.emplace_back(listenerID, std::move(myCallback));