blob: 14377591297820659a0892fc382f8fd263926957 (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#ifndef DIRMONINVOKER_H_W09J90F0
#define DIRMONINVOKER_H_W09J90F0
#include <uscxml/Interpreter.h>
#include "FileWatcher/FileWatcher.h"
#include <map>
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
#endif
namespace uscxml {
class DirMonInvoker : public InvokerImpl, public FW::FileWatchListener {
public:
DirMonInvoker();
virtual ~DirMonInvoker();
virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
names.insert("dirmon");
names.insert("DirectoryMonitor");
names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#dirmon");
return names;
}
virtual Data getDataModelVariables();
virtual void send(const SendRequest& req);
virtual void cancel(const std::string sendId);
virtual void invoke(const InvokeRequest& req);
void handleFileAction(FW::WatchID watchid, const FW::String& dir, const FW::String& filename, FW::Action action);
void reportExisting();
void reportExistingIn(const std::string dir, FW::WatchID watchid);
virtual bool filter(const std::string filename);
static void run(void* instance);
protected:
bool _reportExisting;
bool _recurse;
std::string _suffix;
bool _isRunning;
tthread::thread* _thread;
FW::FileWatcher _fileWatcher;
std::multimap<std::string, FW::WatchID> _watchIds;
};
#ifdef BUILD_AS_PLUGINS
PLUMA_INHERIT_PROVIDER(DirMonInvoker, Invoker);
#endif
}
#endif /* end of include guard: DIRMONINVOKER_H_W09J90F0 */
|