My Project
|
file system watcher service. More...
#include <FileSystemWatcher.h>
Public Types | |
typedef std::map< std::string, CFileSystemWatcherPtr > | file_watcher_map_t |
Public Member Functions | |
void | Clear () |
clear all system watcher references that is created by GetDirWatcher() | |
CFileSystemWatcherPtr | GetDirWatcher (const std::string &name) |
create get a watcher by its name. More... | |
void | DeleteDirWatcher (const std::string &name) |
delete a watcher, it will no longer receive callbacks. More... | |
int | DispatchEvents () |
Dispatch event for all watchers. More... | |
boost::asio::io_service & | GetIOService () |
get io service object. More... | |
bool | IsStarted () |
whether it is started. More... | |
bool | Start () |
start the io service in a different thread. More... | |
![]() | |
void | addref () const |
add reference count of the object. More... | |
bool | delref () const |
decrease reference count of the object. More... | |
int | GetRefCount () const |
get the reference count | |
virtual int | Release () |
CRefCounted * | AddToAutoReleasePool () |
addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More... | |
Static Public Member Functions | |
static CFileSystemWatcherService * | GetInstance () |
Protected Member Functions | |
int | fileWatcherThreadMain () |
Additional Inherited Members | |
![]() | |
int | m_refcount |
file system watcher service.
this is a singleton.
void ParaEngine::CFileSystemWatcherService::DeleteDirWatcher | ( | const std::string & | name | ) |
delete a watcher, it will no longer receive callbacks.
note that if someone else still keeps a pointer to the directory watcher, it will not be deleted.
int ParaEngine::CFileSystemWatcherService::DispatchEvents | ( | ) |
Dispatch event for all watchers.
this allows us to process queued messages in main thread's frame move. this function only works when message are told to be dispatched from the main thread.
CFileSystemWatcherPtr ParaEngine::CFileSystemWatcherService::GetDirWatcher | ( | const std::string & | name | ) |
create get a watcher by its name.
it is good practice to use the directory name as watcher name, since it will reuse it as much as possible.
|
inline |
get io service object.
|
inline |
whether it is started.
bool ParaEngine::CFileSystemWatcherService::Start | ( | ) |
start the io service in a different thread.
this function can be called multiple times, where only the first time takes effect.