26#ifndef FSW_POLL_MONITOR_H
27# define FSW_POLL_MONITOR_H
63 static const unsigned int MIN_POLL_LATENCY = 1;
68 using path_visitor = std::function<bool(
const std::string&,
const struct stat&)>;
70 struct watched_file_info
76 using watched_file_info =
struct watched_file_info;
78 struct poll_monitor_data;
80 void scan(
const std::filesystem::path& path,
81 const path_visitor& fn,
82 bool is_root_path =
false);
83 void collect_initial_data();
85 bool add_path(
const std::string& path,
86 const struct stat& fd_stat,
87 const path_visitor& poll_callback);
88 bool initial_scan_callback(
const std::string& path,
const struct stat& stat);
89 bool intermediate_scan_callback(
const std::string& path,
90 const struct stat& stat);
91 void find_removed_files();
92 void swap_data_containers();
94 std::unique_ptr<poll_monitor_data> previous_data;
95 std::unique_ptr<poll_monitor_data> new_data;
97 std::vector<event> events;
Base class of all monitors.
Definition monitor.hpp:142
std::vector< std::string > paths
List of paths to watch.
Definition monitor.hpp:581
void * context
Pointer to context data that will be passed to the monitor::callback.
Definition monitor.hpp:601
FSW_EVENT_CALLBACK * callback
Callback to which change events should be notified.
Definition monitor.hpp:596
stat()-based monitor.
Definition poll_monitor.hpp:45
poll_monitor(std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context=nullptr)
Constructs an instance of this class.
~poll_monitor() override
Destroys an instance of this class.
void run() override
Execute monitor loop.
Definition poll_monitor.cpp:220
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:58