BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
CancellableSet.h
1 #pragma once
2 
3 #include <set>
4 
5 #include <Poco/Mutex.h>
6 
7 #include "util/Cancellable.h"
8 #include "util/Loggable.h"
9 
10 namespace BeeeOn {
11 
13 public:
15  ~CancellableSet();
16 
22  void manage(Cancellable::Ptr cancellable);
23 
28  bool unmanage(Cancellable::Ptr cancellable);
29 
33  void cancel() override;
34 
35 private:
36  std::set<Cancellable::Ptr> m_cancellables;
37  Poco::FastMutex m_lock;
38 };
39 
40 }
Any class that can be cancelled should inherit from this interface. This allows to maintain a set of ...
Definition: Cancellable.h:12
void cancel() override
Cancel all managed Cancellable instances.
Definition: CancellableSet.cpp:43
bool unmanage(Cancellable::Ptr cancellable)
Stop managing the given Cancellable instance.
Definition: CancellableSet.cpp:28
void manage(Cancellable::Ptr cancellable)
Manage the given Cancellable instance. If CancellableSet::cancel() is called, all managed instances a...
Definition: CancellableSet.cpp:18
Definition: Loggable.h:19
Definition: CancellableSet.h:12