Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsMonitor.h
Go to the documentation of this file.
1 
14 #ifndef WS_MONITOR_H__
15 #define WS_MONITOR_H__
16 
17 #define BOOST_NO_DEPRECATED
18 #include <fam.h>
19 #include <vector>
20 #include <iostream>
21 #include <boost/thread.hpp>
22 
23 #include <Logger/WsLogger.h>
24 #include "WsAbstractMonitor.h"
25 
26 class WsFsTreeUpdater;
27 
31 class WsMonitor : public WsAbstractMonitor {
32 
33 public:
34 
41  WsMonitor(WsFsTreeUpdater* u, std::vector<path> v, unsigned int delay);
42 
46  ~WsMonitor();
47 
52  boost::thread* start();
53 
54 private:
55 
61  int startCallBack();
62 
69 
70 
76  int startChecker();
77 
81  int addDirectory(const path& p);
82 
83 
91  const char* eventName(const int& code);
92 
103  int signal(const std::string& filename, const int& code);
104 
115  int signalConf(const std::string& filename, const int& code);
116 
120  std::vector<path> m_paths;
121 
126 
127 
131  bool m_updated;
132  unsigned int m_delay;
133 
134  FAMRequest* m_frp;
135  FAMRequest* m_frp2;
136  FAMConnection* m_fc;
137  FAMConnection* m_fc2;
138 };
139 
140 #endif
141 
int startCallBack()
Starts monitoring the Files of the filesystemtree Should be started in a separated thread...
Definition: WsMonitor.cpp:95
FAMConnection * m_fc
Definition: WsMonitor.h:136
FAMRequest * m_frp
Definition: WsMonitor.h:134
Monitors the filesystem and call the WsFsTreeUpdater::update() method accordignly.
Definition: WsMonitor.h:31
unsigned int m_delay
Definition: WsMonitor.h:132
int addDirectory(const path &p)
const char * eventName(const int &code)
Matches an event code with it's name.
Definition: WsMonitor.cpp:47
handles the update of the FileSystemTree
std::vector< path > m_paths
Definition: WsMonitor.h:120
WsFsTreeUpdater * m_updater
pointer to the WsFsTreeUpdater class
Definition: WsMonitor.h:125
WsMonitor(WsFsTreeUpdater *u, std::vector< path > v, unsigned int delay)
Constructor.
Definition: WsMonitor.cpp:18
bool m_updated
Changed occured ?
Definition: WsMonitor.h:131
int signal(const std::string &filename, const int &code)
Called when a change occurs on a file monitored.
Definition: WsMonitor.cpp:205
FAMConnection * m_fc2
Definition: WsMonitor.h:137
int signalConf(const std::string &filename, const int &code)
Called when a change occurs on a conf file monitored.
Definition: WsMonitor.cpp:228
~WsMonitor()
Destructor.
Definition: WsMonitor.cpp:26
int startCallBackConfOnly()
Starts monitoring the config Files of the filesystemtree Should be started in a separated thread...
Definition: WsMonitor.cpp:148
int startChecker()
Starts loop that will monitor the m_updated variable every m_delay and update the tree if changed occ...
Definition: WsMonitor.cpp:80
boost::thread * start()
Starts the monitoring process.
Definition: WsMonitor.cpp:71
Abstract class used for monitoring the filesystem.
FAMRequest * m_frp2
Definition: WsMonitor.h:135