Skip to content

Unique callback handler#37

Merged
JonathSpirit merged 7 commits intomasterfrom
uniqueCallbackHandler
Feb 15, 2026
Merged

Unique callback handler#37
JonathSpirit merged 7 commits intomasterfrom
uniqueCallbackHandler

Conversation

@JonathSpirit
Copy link
Owner

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:

  • Updated CallbackHandler to use CallbackStaticHelpers for 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:

  • Introduced 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]
  • Updated usage in client code to use setLambda instead of addLambda for unique callback scenarios, reflecting the new API. (examples/clientServerLifeSimulator_004/server/main.cpp)

Subscription System Refactor:

  • Refactored the subscription base class, introducing BaseSubscription as an abstract base, and splitting into Subscription (multi-subscriber) and UniqueSubscription (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.

@JonathSpirit JonathSpirit self-assigned this Feb 15, 2026
@JonathSpirit JonathSpirit added this to the v0.9.5 milestone Feb 15, 2026
@JonathSpirit JonathSpirit merged commit 01ad9a7 into master Feb 15, 2026
12 checks passed
@JonathSpirit JonathSpirit deleted the uniqueCallbackHandler branch February 15, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments