commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DirectoryListenerImpl.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014 Raphael David / CANTOR
3 //
4 // this file contains DirectoryListener::Impl declaration.
5 // implementation is OS specific and can be found in Directory-<os>.cpp
6 
7 #ifndef CMR_DIRECTORY_LISTENER_IMPL_INCLUDED
8 #define CMR_DIRECTORY_LISTENER_IMPL_INCLUDED
9 
10 #include "commore/Commore.h"
11 #include "commore/Path.h"
12 #include "commore/Directory.h"
13 #include "commore/Time.h"
14 
15 namespace commore
16 {
17  //
18  // System dependent
19  //
20 #ifdef WIN32
21 
22  class DirectoryListener::Impl : public RefObject
23  {
24  public:
25  Impl(const Directory& dir, bool all);
26  ~Impl();
27 
28  bool wait(TimePeriod in_timeout);
29  void abort();
30  bool init();
31  bool is_ok();
32 
33  private:
34  Directory listen_dir_;
35  HANDLE dir_handle_;
36  bool last_check_;
37  bool all_;
38  };
39 
40 
41 #else
42 
43 #include <sys/types.h>
44 #include <signal.h>
45 
47  {
48  public:
49  Impl(const Directory& dir, bool all);
50  ~Impl();
51 
52  bool wait(TimePeriod in_timeout);
53  void abort();
54  bool init();
55  bool is_ok();
56 
57  private:
58  Directory listen_dir_;
59  sigset_t signalset_;
60  struct sigaction act_;
61  struct sigaction old_act_;
62  int fd_;
63  bool last_check_;
64  bool all_;
65 
66  };
67 
68 #endif
69 
70 };
71 
72 #endif
Definition: Directory.h:58
Definition: DirectoryListenerImpl.h:46
Definition: Time.h:21
Impl(const Directory &dir, bool all)
Definition: Directory-linux.cpp:265
bool wait(TimePeriod in_timeout)
Definition: Directory-linux.cpp:278
bool is_ok()
Definition: Directory-linux.cpp:355
bool init()
Definition: Directory-linux.cpp:344
void abort()
Definition: Directory-linux.cpp:335
Definition: RefObject.h:89
~Impl()
Definition: Directory-linux.cpp:270