26#ifndef FSW_POLL_MONITOR_H
27# define FSW_POLL_MONITOR_H
61 static const unsigned int MIN_POLL_LATENCY = 1;
66 typedef bool (
poll_monitor::*poll_monitor_scan_callback)(
67 const std::string& path,
68 const struct stat& stat);
70 typedef struct watched_file_info
76 struct poll_monitor_data;
78 void scan(
const std::string& path, poll_monitor_scan_callback fn);
79 void collect_initial_data();
81 bool add_path(
const std::string& path,
82 const struct stat& fd_stat,
83 poll_monitor_scan_callback poll_callback);
84 bool initial_scan_callback(
const std::string& path,
const struct stat& stat);
85 bool intermediate_scan_callback(
const std::string& path,
86 const struct stat& stat);
87 void find_removed_files();
88 void swap_data_containers();
90 std::unique_ptr<poll_monitor_data> previous_data;
91 std::unique_ptr<poll_monitor_data> new_data;
93 std::vector<event> events;
Base class of all monitors.
Definition: monitor.hpp:148
std::vector< std::string > paths
List of paths to watch.
Definition: monitor.hpp:534
void * context
Pointer to context data that will be passed to the monitor::callback.
Definition: monitor.hpp:554
FSW_EVENT_CALLBACK * callback
Callback to which change events should be notified.
Definition: monitor.hpp:549
stat()-based monitor.
Definition: poll_monitor.hpp:43
poll_monitor(std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context=nullptr)
Constructs an instance of this class.
virtual ~poll_monitor()
Destroys an instance of this class.
void run()
Execute monitor loop.
Definition: poll_monitor.cpp:188
Header of the fsw::monitor class.
Main namespace of libfswatch.
Definition: event.cpp:24
void FSW_EVENT_CALLBACK(const std::vector< event > &, void *)
Function definition of an event callback.
Definition: monitor.hpp:61