路泰科技体检小程序UI设计新版本
1
wwl
6 天以前 a6cdbcfe28fcc40ebb4919f57d60fb20122e8e57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef BACKEND_H
#define BACKEND_H
 
#include "Event.hh"
#include "Watcher.hh"
#include "Signal.hh"
#include <thread>
 
class Backend {
public:
  virtual ~Backend();
  void run();
  void notifyStarted();
 
  virtual void start();
  virtual void writeSnapshot(WatcherRef watcher, std::string *snapshotPath) = 0;
  virtual void getEventsSince(WatcherRef watcher, std::string *snapshotPath) = 0;
  virtual void subscribe(WatcherRef watcher) = 0;
  virtual void unsubscribe(WatcherRef watcher) = 0;
 
  static std::shared_ptr<Backend> getShared(std::string backend);
 
  void watch(WatcherRef watcher);
  void unwatch(WatcherRef watcher);
  void unref();
  void handleWatcherError(WatcherError &err);
 
  std::mutex mMutex;
  std::thread mThread;
private:
  std::unordered_set<WatcherRef> mSubscriptions;
  Signal mStartedSignal;
 
  void handleError(std::exception &err);
};
 
#endif