![]() |
FastEngine 0.9.5
A multiplayer oriented 2D engine made with Vulkan.
|
This class is used for cases where only one callback is needed. More...
#include <C_callback.hpp>
Public Types | |
| using | CalleePtr = CalleeUniquePtr<void, Types...> |
| using | StaticHelpers = CallbackStaticHelpers<void, CalleePtr, Types...> |
| using | SubscriberCount = unsigned int |
Public Member Functions | |
| UniqueCallbackHandler (fge::UniqueCallbackHandler< Types... > const &n) | |
| Copy constructor that does nothing. | |
| UniqueCallbackHandler (fge::CallbackHandler< Types... > &&n)=delete | |
| Move constructor prohibited. | |
| fge::CallbackHandler< Types... > & | operator= (fge::CallbackHandler< Types... > const &n) |
| Copy operator that does nothing. | |
| fge::CallbackHandler< Types... > & | operator= (fge::CallbackHandler< Types... > &&n)=delete |
| Move operator prohibited. | |
| void | clear () |
| fge::CallbackBase< void, Types... > * | set (CalleePtr &&callback, fge::Subscriber *subscriber=nullptr) |
| Set a new callback to the handler, replacing the previous one if it exists. | |
| fge::CallbackFunctor< void, Types... > * | setFunctor (typename fge::CallbackFunctor< void, Types... >::CallbackFunction func, fge::Subscriber *subscriber=nullptr) |
| Helper method to set a callback functor. | |
| template<typename TLambda> | |
| fge::CallbackLambda< void, Types... > * | setLambda (TLambda const &lambda, fge::Subscriber *subscriber=nullptr) |
| Helper method to set a callback lambda. | |
| template<class TObject> | |
| fge::CallbackObjectFunctor< void, TObject, Types... > * | setObjectFunctor (typename fge::CallbackObjectFunctor< void, TObject, Types... >::CallbackFunctionObject func, TObject *object, Subscriber *subscriber=nullptr) |
| Helper method to set a callback object functor. | |
| void | delPtr (void *ptr) |
| Remove the callback if the function/object pointer is the same as the one used to construct the callback. | |
| void | delSub (fge::Subscriber *subscriber) |
| Remove the callback if the subscriber is the same as the one used to construct the callback. | |
| void | del (fge::CallbackBase< Types... > *callback) |
| Remove the callback if the callback pointer is the same as the one used to construct the callback. | |
| void | call (Types... args) |
| Call the callback with the given arguments. | |
Protected Member Functions | |
| void | onDetach (fge::Subscriber *subscriber) override |
| This method is called when a subscriber is destroyed (destructor called). | |
| void | detachAll () override |
| Detach all subscribers. | |
| bool | detach (fge::Subscriber *subscriber) override |
| Detach a specific subscriber. | |
| SubscriberCount | detachOnce (fge::Subscriber *subscriber) override |
| Detach only once a specific subscriber. | |
| SubscriberCount | attach (fge::Subscriber *subscriber) override |
| Attach a specific subscriber. | |
| SubscriberCount | getCount (fge::Subscriber *subscriber) const override |
| Get the SubscriberCount of a specific subscriber. | |
This class is used for cases where only one callback is needed.
| Types | The list of arguments types passed to the callbacks |
|
inline |
Copy constructor that does nothing.
|
delete |
Move constructor prohibited.
|
overrideprotectedvirtualinherited |
Attach a specific subscriber.
You can't directly attach a nullptr global scope subscriber. But if you do, this function will do nothing and return 1 as the SubscriberCount.
| subscriber | The subscriber to attach |
Implements fge::BaseSubscription.
| void fge::UniqueCallbackHandler< Types >::call | ( | Types... | args | ) |
Call the callback with the given arguments.
| args | The list of arguments |
| void fge::UniqueCallbackHandler< Types >::del | ( | fge::CallbackBase< Types... > * | callback | ) |
Remove the callback if the callback pointer is the same as the one used to construct the callback.
| Callback | The callback to remove |
| void fge::UniqueCallbackHandler< Types >::delPtr | ( | void * | ptr | ) |
Remove the callback if the function/object pointer is the same as the one used to construct the callback.
| ptr | The function/object pointer to remove |
| void fge::UniqueCallbackHandler< Types >::delSub | ( | fge::Subscriber * | subscriber | ) |
Remove the callback if the subscriber is the same as the one used to construct the callback.
| subscriber | The potential subscriber associated to the callback to remove |
|
overrideprotectedvirtualinherited |
Detach a specific subscriber.
Detaching a nullptr global scope subscriber will do nothing.
| subscriber | The subscriber to detach |
Implements fge::BaseSubscription.
|
overrideprotectedvirtualinherited |
Detach all subscribers.
Implements fge::BaseSubscription.
|
overrideprotectedvirtualinherited |
Detach only once a specific subscriber.
You can attach a subscriber multiple times, and it will augment the SubscriberCount. This function will only detach one time the subscriber and decrement the SubscriberCount. If the SubscriberCount is 0, the subscriber will be detached.
| subscriber | The subscriber to detach |
Implements fge::BaseSubscription.
|
overrideprotectedvirtualinherited |
Get the SubscriberCount of a specific subscriber.
| subscriber | The subscriber to get the SubscriberCount |
Implements fge::BaseSubscription.
|
overrideprotectedvirtual |
This method is called when a subscriber is destroyed (destructor called).
This avoids calling the callbacks when the subscriber is destroyed.
| subscriber | The subscriber that is destroyed (or going to be destroyed) |
Implements fge::BaseSubscription.
|
delete |
Move operator prohibited.
|
inline |
Copy operator that does nothing.
|
inline |
Set a new callback to the handler, replacing the previous one if it exists.
| Callback | The new callback to set |
| subscriber | The subscriber to use to categorize the callback |
|
inline |
Helper method to set a callback functor.
| func | The callback function |
| subscriber | The subscriber to use to categorize the callback |
|
inline |
Helper method to set a callback lambda.
| TLambda | The lambda type |
| lambda | The callback lambda |
| subscriber | The subscriber to use to categorize the callback |
|
inline |
Helper method to set a callback object functor.
| TObject | The object type |
| func | The callback method of the object |
| object | The object pointer |
| subscriber | The subscriber to use to categorize the callback |