Subscription.h
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 
6 namespace Stormancer
7 {
10  {
11  public:
12 
14  Subscription_impl(std::function<void(void)> callback);
15 
18 
20  void unsubscribe();
21 
22  private:
23 
24  // internal callback
25  std::function<void(void)> _callback;
26  };
27 
28  using Subscription = std::shared_ptr<Subscription_impl>;
29 }
~Subscription_impl()
Call the callback when deleted.
Subscription (execute destroy when destructor is called)
Definition: Subscription.h:9
Subscription_impl(std::function< void(void)> callback)
The callback will be called when the Subscription is deleted.
void unsubscribe()
Unsubscribe and reset the callback.