Conversation
… callback must be implemented
…nto uniqueCallbackHandler
- also implement a BaseSubscription class for Subscriber
- Mostly to test the implementation, ReturnPacketHandler should have all unique handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to the callback and subscription system, enhancing flexibility, clarity, and type safety. The main changes include the addition of a unique callback handler class, and a refactoring of the subscription base class to support both multi-subscriber and unique-subscriber models. These updates make it easier to manage callbacks and their lifetimes, and to distinguish between single and multiple subscriber scenarios.
Callback System Enhancements:
CallbackHandlerto useCallbackStaticHelpersfor callback creation, simplifying the implementation and making callback addition more consistent. (includes/FastEngine/C_callback.hpp,includes/FastEngine/C_callback.inl) [1] [2] [3]Unique Callback Handler:
UniqueCallbackHandler, a class designed for scenarios where only one callback is needed. This class provides methods to set, remove, and call a single callback, and manages its subscriber explicitly. (includes/FastEngine/C_callback.hpp,includes/FastEngine/C_callback.inl) [1] [2]setLambdainstead ofaddLambdafor unique callback scenarios, reflecting the new API. (examples/clientServerLifeSimulator_004/server/main.cpp)Subscription System Refactor:
BaseSubscriptionas an abstract base, and splitting intoSubscription(multi-subscriber) andUniqueSubscription(single-subscriber) classes. This clarifies the intent and usage of each subscription type and improves type safety. (includes/FastEngine/C_subscription.hpp) [1] [2] [3] [4]These changes collectively modernize the callback and subscription infrastructure, making it easier for developers to implement and maintain callback-based features with clear subscriber management.