17#ifndef _FGE_C_SUBSCRIPTION_HPP_INCLUDED
18#define _FGE_C_SUBSCRIPTION_HPP_INCLUDED
20#include "FastEngine/fge_extern.hpp"
22#include <unordered_map>
23#include <unordered_set>
50 using SubscriberCount =
unsigned int;
123 using SubscriptionDataType = std::unordered_map<fge::Subscriber*, fge::Subscription::SubscriberCount>;
135 fge::Subscription::SubscriptionDataType g_subData;
189 using SubscriberDataType = std::unordered_set<fge::Subscription*>;
207 fge::Subscriber::SubscriberDataType g_subData;
This class is a useful utility to "link" multiple objects around.
Definition C_subscription.hpp:150
fge::Subscriber & operator=(fge::Subscriber &&n) noexcept=delete
Subscriber(fge::Subscriber const &n)
Definition C_subscription.hpp:155
fge::Subscriber & operator=(fge::Subscriber const &n)
Definition C_subscription.hpp:165
virtual void onDetach(fge::Subscription *subscription)
Callback called when a subscription is detached.
Definition C_subscription.hpp:186
void detachAll()
Detach from all subscriptions.
void detach(fge::Subscription *subscription)
Detach from a specific subscription.
Subscriber(fge::Subscriber &&n) noexcept=delete
virtual ~Subscriber()
When the object is destroyed, it will detach from all subscriptions.
Definition C_subscription.hpp:162
This class is a useful utility to "link" multiple objects around a specific use with automatic lifeti...
Definition C_subscription.hpp:48
Subscription(fge::Subscription const &r)
Definition C_subscription.hpp:55
virtual ~Subscription()
When the object is destroyed, it will detach all subscribers.
Definition C_subscription.hpp:61
fge::Subscription::SubscriberCount detachOnce(fge::Subscriber *subscriber)
Detach only once a specific subscriber.
fge::Subscription::SubscriberCount attach(fge::Subscriber *subscriber)
Attach a specific subscriber.
virtual void onDetach(fge::Subscriber *subscriber)=0
Callback called when a subscriber is detached.
void detachAll()
Detach all subscribers.
fge::Subscription::SubscriberCount getCount(fge::Subscriber *subscriber) const
Get the SubscriberCount of a specific subscriber.
bool detach(fge::Subscriber *subscriber)
Detach a specific subscriber.
fge::Subscription & operator=(fge::Subscription const &r)
Definition C_subscription.hpp:64