My Project
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
ParaEngine::CFileSystemWatcherService Class Reference

file system watcher service. More...

#include <FileSystemWatcher.h>

Inheritance diagram for ParaEngine::CFileSystemWatcherService:
ParaEngine::CRefCounted

Public Types

typedef std::map< std::string, CFileSystemWatcherPtrfile_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...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
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 ()
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 

Static Public Member Functions

static CFileSystemWatcherServiceGetInstance ()
 

Protected Member Functions

int fileWatcherThreadMain ()
 

Additional Inherited Members

- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 

Detailed Description

file system watcher service.

this is a singleton.

Member Function Documentation

§ DeleteDirWatcher()

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.

§ DispatchEvents()

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.

Returns
number of events dispatched.

§ GetDirWatcher()

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.

§ GetIOService()

boost::asio::io_service& ParaEngine::CFileSystemWatcherService::GetIOService ( )
inline

get io service object.

§ IsStarted()

bool ParaEngine::CFileSystemWatcherService::IsStarted ( )
inline

whether it is started.

§ Start()

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.


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