main
Last change
on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago |
Pred finalna verzija
|
-
Property mode
set to
100644
|
File size:
874 bytes
|
Rev | Line | |
---|
[0c6b92a] | 1 | #ifndef BACKEND_H
|
---|
| 2 | #define BACKEND_H
|
---|
| 3 |
|
---|
| 4 | #include "Event.hh"
|
---|
| 5 | #include "Watcher.hh"
|
---|
| 6 | #include "Signal.hh"
|
---|
| 7 | #include <thread>
|
---|
| 8 |
|
---|
| 9 | class Backend {
|
---|
| 10 | public:
|
---|
| 11 | virtual ~Backend();
|
---|
| 12 | void run();
|
---|
| 13 | void notifyStarted();
|
---|
| 14 |
|
---|
| 15 | virtual void start();
|
---|
| 16 | virtual void writeSnapshot(WatcherRef watcher, std::string *snapshotPath) = 0;
|
---|
| 17 | virtual void getEventsSince(WatcherRef watcher, std::string *snapshotPath) = 0;
|
---|
| 18 | virtual void subscribe(WatcherRef watcher) = 0;
|
---|
| 19 | virtual void unsubscribe(WatcherRef watcher) = 0;
|
---|
| 20 |
|
---|
| 21 | static std::shared_ptr<Backend> getShared(std::string backend);
|
---|
| 22 |
|
---|
| 23 | void watch(WatcherRef watcher);
|
---|
| 24 | void unwatch(WatcherRef watcher);
|
---|
| 25 | void unref();
|
---|
| 26 | void handleWatcherError(WatcherError &err);
|
---|
| 27 |
|
---|
| 28 | std::mutex mMutex;
|
---|
| 29 | std::thread mThread;
|
---|
| 30 | private:
|
---|
| 31 | std::unordered_set<WatcherRef> mSubscriptions;
|
---|
| 32 | Signal mStartedSignal;
|
---|
| 33 |
|
---|
| 34 | void handleError(std::exception &err);
|
---|
| 35 | };
|
---|
| 36 |
|
---|
| 37 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.