This class subscribes to notifications of file system changes, thus it can be used to efficiently stay informed about changes in a directory tree.
Definition at line 29 of file CFileSystemWatcher.h.
#include <mrpt/system/CFileSystemWatcher.h>
Classes | |
| struct | TFileSystemChange |
| Each of the changes detected by utils::CFileSystemWatcher. More... | |
Public Types | |
| using | TFileSystemChangeList = std::deque< TFileSystemChange > |
Public Member Functions | |
| CFileSystemWatcher (const std::string &path) | |
| Creates the subscription to a specified path. More... | |
| virtual | ~CFileSystemWatcher () |
| Destructor. More... | |
| void | getChanges (TFileSystemChangeList &out_list) |
| Call this method sometimes to get the list of changes in the watched directory. More... | |
Private Member Functions | |
| void | thread_win32_watch () |
| Watch thread; only needed in win32. More... | |
Private Attributes | |
| std::string | m_watchedDirectory |
| Ended in "/". More... | |
| void * | m_hNotif {nullptr} |
| std::thread | m_watchThread |
| std::queue< TFileSystemChange * > | m_queue_events_win32_msgs |
| std::mutex | m_queue_events_win32_cs |
| using mrpt::system::CFileSystemWatcher::TFileSystemChangeList = std::deque<TFileSystemChange> |
Definition at line 50 of file CFileSystemWatcher.h.
| CFileSystemWatcher::CFileSystemWatcher | ( | const std::string & | path | ) |
Creates the subscription to a specified path.
| path | The file or directory to watch. |
Definition at line 41 of file CFileSystemWatcher.cpp.
References ASSERT_, m_hNotif, m_watchedDirectory, m_watchThread, MRPT_END, MRPT_START, thread_win32_watch(), and THROW_EXCEPTION.
|
virtual |
| void CFileSystemWatcher::getChanges | ( | TFileSystemChangeList & | out_list | ) |
Call this method sometimes to get the list of changes in the watched directory.
Definition at line 116 of file CFileSystemWatcher.cpp.
References ASSERTMSG_, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventAccessed, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventCloseWrite, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventCreated, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventDeleted, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventModified, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventMovedFrom, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventMovedTo, mrpt::system::CFileSystemWatcher::TFileSystemChange::isDir, m_hNotif, m_queue_events_win32_cs, m_queue_events_win32_msgs, m_watchedDirectory, mrpt::system::os::memcpy(), and mrpt::system::CFileSystemWatcher::TFileSystemChange::path.
|
private |
Watch thread; only needed in win32.
Definition at line 252 of file CFileSystemWatcher.cpp.
References ASSERTMSG_, mrpt::system::directoryExists(), mrpt::system::CFileSystemWatcher::TFileSystemChange::eventCreated, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventDeleted, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventModified, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventMovedFrom, mrpt::system::CFileSystemWatcher::TFileSystemChange::eventMovedTo, mrpt::system::CFileSystemWatcher::TFileSystemChange::isDir, m_hNotif, m_queue_events_win32_cs, m_queue_events_win32_msgs, m_watchedDirectory, and mrpt::system::CFileSystemWatcher::TFileSystemChange::path.
Referenced by CFileSystemWatcher().
|
private |
Definition at line 71 of file CFileSystemWatcher.h.
Referenced by CFileSystemWatcher(), getChanges(), thread_win32_watch(), and ~CFileSystemWatcher().
|
mutableprivate |
Definition at line 76 of file CFileSystemWatcher.h.
Referenced by getChanges(), and thread_win32_watch().
|
private |
Definition at line 75 of file CFileSystemWatcher.h.
Referenced by getChanges(), and thread_win32_watch().
|
private |
Ended in "/".
Definition at line 69 of file CFileSystemWatcher.h.
Referenced by CFileSystemWatcher(), getChanges(), and thread_win32_watch().
|
private |
Definition at line 72 of file CFileSystemWatcher.h.
Referenced by CFileSystemWatcher().
| Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST |