Ditto 4.13.1
 
Loading...
Searching...
No Matches
Observer.hpp
1#ifndef DITTO_OBSERVER_H
2#define DITTO_OBSERVER_H
3
4#include <memory>
5#include <mutex>
6
7namespace ditto {
8
13
14class Observer {
15private:
19 virtual void on_stop() = 0;
20
21protected:
26 bool stopped; // NOLINT
27
33 std::shared_ptr<std::mutex> stopped_mutex; // NOLINT
34
39
45
46public:
50 void stop();
51
55 bool is_stopped();
56};
57
58} // namespace ditto
59
60#endif
std::shared_ptr< std::mutex > stopped_mutex
Mutex that should be held when reading or modifying stopped
Definition Observer.hpp:33
void stop()
Stops the observation and cleans up all associated resources.
bool is_stopped()
Returns true is the Observer was stopped.
Observer()
Constructs a new Observer.
bool stopped
Track if the Observer has already been stopped so we don't stop it twice when destroying the object.
Definition Observer.hpp:26
~Observer()
Destroy the Abstract Observer object canceling the observer if it hasn't been done in stop
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19