fswatch 1.20.1
Loading...
Searching...
No Matches
fsw::windows_monitor Class Reference

Windows monitor. More...

#include <windows_monitor.hpp>

Inheritance diagram for fsw::windows_monitor:
fsw::monitor

Public Member Functions

 windows_monitor (std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context=nullptr)
 Constructs an instance of this class.
virtual ~windows_monitor ()
 Destroys an instance of this class.
Public Member Functions inherited from fsw::monitor
 monitor (std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context=nullptr)
 Constructs a monitor watching the specified paths.
virtual ~monitor ()
 Destructs a monitor instance.
 monitor (const monitor &orig)=delete
 This class is not copy constructible.
monitoroperator= (const monitor &that)=delete
 This class is not copy assignable.
void set_property (const std::string &name, const std::string &value)
 Sets a custom property.
void set_properties (const std::map< std::string, std::string > options)
 Sets the custom properties.
std::string get_property (std::string name)
 Gets the value of a property.
void set_latency (double latency)
 Sets the latency.
void set_fire_idle_event (bool fire_idle_event)
 Sets the fire idle event flag.
void set_allow_overflow (bool overflow)
 Notify buffer overflows as change events.
void set_recursive (bool recursive)
 Recursively scan subdirectories.
void set_directory_only (bool directory_only)
 Watch directories only.
void add_filter (const monitor_filter &filter)
 Add a path filter.
void set_filters (const std::vector< monitor_filter > &filters)
 Set the path filters.
void set_follow_symlinks (bool follow)
 Follow symlinks.
void * get_context () const
 Get the pointer to the context data.
void set_context (void *context)
 Set the context data.
void set_bubble_events (bool bubble_events)
 Set the bubble events flag.
void start ()
 Start the monitor.
void stop ()
 Stop the monitor.
bool is_running ()
 Check whether the monitor is running.
void add_event_type_filter (const fsw_event_type_filter &filter)
 Add an event type filter.
void set_event_type_filters (const std::vector< fsw_event_type_filter > &filters)
 Set the event type filters.
void set_watch_access (bool access)
 Monitor file access.

Protected Member Functions

void run ()
 Executes the monitor loop.
Protected Member Functions inherited from fsw::monitor
bool accept_event_type (fsw_event_flag event_type) const
 Check whether an event should be accepted.
bool accept_path (const std::string &path) const
 Check whether a path should be accepted.
void notify_events (const std::vector< event > &events) const
 Notify change events.
void notify_overflow (const std::string &path) const
 Notify an overflow event.
std::vector< fsw_event_flagfilter_flags (const event &evt) const
 Filter event types.
virtual void on_stop ()
 Execute an implementation-specific stop handler.

Additional Inherited Members

Protected Attributes inherited from fsw::monitor
std::vector< std::string > paths
 List of paths to watch.
std::map< std::string, std::string > properties
 Map of custom properties.
FSW_EVENT_CALLBACKcallback
 Callback to which change events should be notified.
void * context = nullptr
 Pointer to context data that will be passed to the monitor::callback.
double latency = 1.0
 Latency of the monitor.
bool fire_idle_event = false
 If true, the monitor will notify an event when idle.
bool allow_overflow = false
 If true, queue overflow events will be notified to the caller, otherwise the monitor will throw a libfsw_exception.
bool recursive = false
 If true, directories will be scanned recursively.
bool follow_symlinks = false
 If true, symbolic links are followed.
bool directory_only = false
 Flag indicating whether only directories should be monitored.
bool watch_access = false
 Flag indicating whether file access should be watched.
bool running = false
 Flag indicating whether the monitor is in the running state.
bool should_stop = false
 Flag indicating whether the monitor should preemptively stop.
bool bubble_events = false
 Bubble events by joining flags received for the same (time, path) pair.
std::mutex run_mutex
 Mutex used to serialize access to the monitor state from multiple threads.
std::mutex notify_mutex
 Mutex used to serialize access to the notify_events() method.

Detailed Description

Windows monitor.

This monitor is built upon the ReadDirectoryChanges API of the Windows operating systems.

Member Function Documentation

◆ run()

void fsw::windows_monitor::run ( )
protectedvirtual

Executes the monitor loop.

This call does not return until the monitor is stopped.

See also
stop()

Implements fsw::monitor.


The documentation for this class was generated from the following file: