Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Go to the source code of this file.
Classes | |
class | DirWatchNotification |
Typedefs | |
typedef std::shared_ptr< DirWatch > | PDirWatch |
typedef std::vector< DirWatchNotification > | DirWatchNotifications |
Functions | |
Status | dir_watch_Add (const OsPath &path, PDirWatch &dirWatch) |
start watching a single directory for changes. More... | |
Status | dir_watch_Poll (DirWatchNotifications ¬ifications) |
return all pending directory watch notifications. More... | |
typedef std::vector<DirWatchNotification> DirWatchNotifications |
start watching a single directory for changes.
path | (must end in slash) |
dirWatch | opaque smart pointer to the watch state; used to manage its lifetime (this is deemed more convenient than a separate dir_watch_Remove interface). |
clients typically want to watch entire directory subtrees (e.g. a mod), which is supported by Windows but not FAM. to reduce overhead, the Windows backend always watches subtrees, but portable clients should still add a watch for each subdirectory (the shared watch state is reference-counted). rationale: since the VFS has per-directory data structures, it is convenient to store PDirWatch there instead of creating a second tree structure here.
Status dir_watch_Poll | ( | DirWatchNotifications & | notifications | ) |
return all pending directory watch notifications.
notifications | receives any pending notifications in unspecified order. |
note: the run time of this function is independent of the number of directory watches and number of files.
rationale for a polling interface: users (e.g. the main game loop) typically want to receive change notifications at a single point, rather than deal with the complexity of asynchronous notifications.