libmoost
moost::io::ionotify Class Reference

#include <ionotify_linux.hpp>

Collaboration diagram for moost::io::ionotify:

List of all members.

Public Types

enum  file_action { CREATED = 0, CHANGED = 1, DELETED = 2 }
typedef boost::function< void(file_action
fa, const std::string &path)> 
callback_t
typedef file_watcher::file_action file_action
typedef file_watcher::callback_t callback_t

Public Member Functions

 ionotify (bool stop_immediately=false)
 ~ionotify ()
void insert (std::string const &path, callback_t const &callback, bool call_now=false)
void erase (std::string const &path)
void start ()
void stop ()
 ionotify (bool ignore_dup_events=false, bool stop_immediately=false)
 ~ionotify ()
void insert (std::string const &path, callback_t const &callback, bool call_now=false)
void erase (std::string const &path)
void start ()
void stop ()

Static Public Attributes

static file_action const CHANGED = file_watcher::CHANGED
static file_action const CREATED = file_watcher::CREATED
static file_action const DELETED = file_watcher::DELETED

Private Types

typedef std::pair< callback_t,
std::string > 
event_t
typedef std::map< int, event_tevent_map_t
typedef std::map< std::string,
int > 
path_map_t
typedef boost::shared_ptr
< boost::thread > 
pthread_t

Private Member Functions

bool is_file_action (int mask, int eventid)
bool get_file_action (int mask, file_action &fa)
void thread_proc ()

Private Attributes

int fd_
event_map_t event_map_
path_map_t path_map_
pthread_t pthread_event
boost::shared_mutex smtx_event_
boost::mutex mtx_stop_start_
boost::asio::io_service ioservice_
boost::shared_ptr
< boost::asio::io_service::work > 
spwork_
pthread_t pthread_handler
bool stop_immediately_
file_watcher fw_

Static Private Attributes

static const int EVENT_MASK = IN_ATTRIB | IN_DELETE | IN_DELETE_SELF | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM

Detailed Description

Definition at line 55 of file ionotify_linux.hpp.


Member Typedef Documentation

typedef boost::function<void(file_action fa, const std::string & path)> moost::io::ionotify::callback_t

Definition at line 90 of file ionotify_linux.hpp.

typedef std::map<int, event_t> moost::io::ionotify::event_map_t [private]

Definition at line 94 of file ionotify_linux.hpp.

typedef std::pair<callback_t, std::string> moost::io::ionotify::event_t [private]

Definition at line 93 of file ionotify_linux.hpp.

typedef std::map<std::string, int> moost::io::ionotify::path_map_t [private]

Definition at line 95 of file ionotify_linux.hpp.

typedef boost::shared_ptr<boost::thread> moost::io::ionotify::pthread_t [private]

Definition at line 96 of file ionotify_linux.hpp.


Member Enumeration Documentation

Enumerator:
CREATED 

File creation (here to be backwards compatible with file_watcher, but not directly supported by inotify!)

CHANGED 

File modification.

DELETED 

File deletion.

Definition at line 83 of file ionotify_linux.hpp.


Constructor & Destructor Documentation

moost::io::ionotify::ionotify ( bool  stop_immediately = false) [inline]

Definition at line 58 of file ionotify_linux.hpp.

Definition at line 70 of file ionotify_linux.hpp.

Here is the call graph for this function:

moost::io::ionotify::ionotify ( bool  ignore_dup_events = false,
bool  stop_immediately = false 
) [inline]

Definition at line 39 of file ionotify_windows.hpp.

Definition at line 43 of file ionotify_windows.hpp.


Member Function Documentation

void moost::io::ionotify::erase ( std::string const &  path) [inline]

Definition at line 59 of file ionotify_windows.hpp.

Here is the call graph for this function:

void moost::io::ionotify::erase ( std::string const &  path) [inline]

Definition at line 124 of file ionotify_linux.hpp.

bool moost::io::ionotify::get_file_action ( int  mask,
file_action fa 
) [inline, private]

Definition at line 196 of file ionotify_linux.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void moost::io::ionotify::insert ( std::string const &  path,
callback_t const &  callback,
bool  call_now = false 
) [inline]

Definition at line 54 of file ionotify_windows.hpp.

Here is the call graph for this function:

void moost::io::ionotify::insert ( std::string const &  path,
callback_t const &  callback,
bool  call_now = false 
) [inline]

Definition at line 101 of file ionotify_linux.hpp.

Here is the caller graph for this function:

bool moost::io::ionotify::is_file_action ( int  mask,
int  eventid 
) [inline, private]

Definition at line 190 of file ionotify_linux.hpp.

Here is the caller graph for this function:

void moost::io::ionotify::start ( ) [inline]

Definition at line 64 of file ionotify_windows.hpp.

Here is the call graph for this function:

void moost::io::ionotify::start ( ) [inline]

Definition at line 139 of file ionotify_linux.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void moost::io::ionotify::stop ( ) [inline]

Definition at line 69 of file ionotify_windows.hpp.

Here is the call graph for this function:

void moost::io::ionotify::stop ( ) [inline]

Definition at line 160 of file ionotify_linux.hpp.

Here is the caller graph for this function:

void moost::io::ionotify::thread_proc ( ) [inline, private]

Definition at line 208 of file ionotify_linux.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 312 of file ionotify_linux.hpp.

const int moost::io::ionotify::EVENT_MASK = IN_ATTRIB | IN_DELETE | IN_DELETE_SELF | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM [static, private]

Definition at line 98 of file ionotify_linux.hpp.

int moost::io::ionotify::fd_ [private]

Definition at line 311 of file ionotify_linux.hpp.

Definition at line 75 of file ionotify_windows.hpp.

boost::asio::io_service moost::io::ionotify::ioservice_ [private]

Definition at line 317 of file ionotify_linux.hpp.

boost::mutex moost::io::ionotify::mtx_stop_start_ [private]

Definition at line 316 of file ionotify_linux.hpp.

Definition at line 313 of file ionotify_linux.hpp.

Definition at line 314 of file ionotify_linux.hpp.

boost::shared_mutex moost::io::ionotify::smtx_event_ [private]

Definition at line 315 of file ionotify_linux.hpp.

boost::shared_ptr<boost::asio::io_service::work> moost::io::ionotify::spwork_ [private]

Definition at line 318 of file ionotify_linux.hpp.

Definition at line 320 of file ionotify_linux.hpp.


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