Leosac  0.8.0
Open Source Access Control
Leosac::Tools::UnixFileWatcher Class Reference

#include <unixfilewatcher.hpp>

+ Collaboration diagram for Leosac::Tools::UnixFileWatcher:

Classes

struct  WatchParams
 

Public Member Functions

 UnixFileWatcher ()
 
 ~UnixFileWatcher ()
 
 UnixFileWatcher (const UnixFileWatcher &other)=delete
 
UnixFileWatcheroperator= (const UnixFileWatcher &other)=delete
 
void start ()
 
void stop ()
 
void watchFile (const std::string &path)
 
bool fileHasChanged (const std::string &path) const
 
void fileReset (const std::string &path)
 
std::size_t size () const
 

Private Types

using UnixFd = int
 
using Watches = std::map< UnixFd, WatchParams >
 

Private Member Functions

void run ()
 

Private Attributes

std::thread _thread
 
std::atomic< bool > _isRunning
 
UnixFd _inotifyFd
 
Watches _watches
 

Static Private Attributes

static const long DefaultTimeoutMs = 2000
 

Detailed Description

Definition at line 39 of file unixfilewatcher.hpp.

Member Typedef Documentation

◆ UnixFd

Definition at line 41 of file unixfilewatcher.hpp.

◆ Watches

Definition at line 47 of file unixfilewatcher.hpp.

Constructor & Destructor Documentation

◆ UnixFileWatcher() [1/2]

UnixFileWatcher::UnixFileWatcher ( )
explicit

Definition at line 39 of file unixfilewatcher.cpp.

◆ ~UnixFileWatcher()

UnixFileWatcher::~UnixFileWatcher ( )

Definition at line 46 of file unixfilewatcher.cpp.

◆ UnixFileWatcher() [2/2]

Leosac::Tools::UnixFileWatcher::UnixFileWatcher ( const UnixFileWatcher other)
delete

Member Function Documentation

◆ fileHasChanged()

bool UnixFileWatcher::fileHasChanged ( const std::string &  path) const

Definition at line 93 of file unixfilewatcher.cpp.

◆ fileReset()

void UnixFileWatcher::fileReset ( const std::string &  path)

Definition at line 103 of file unixfilewatcher.cpp.

◆ operator=()

UnixFileWatcher& Leosac::Tools::UnixFileWatcher::operator= ( const UnixFileWatcher other)
delete

◆ run()

void UnixFileWatcher::run ( )
private

Definition at line 121 of file unixfilewatcher.cpp.

◆ size()

std::size_t UnixFileWatcher::size ( ) const

Definition at line 116 of file unixfilewatcher.cpp.

◆ start()

void UnixFileWatcher::start ( )

Definition at line 59 of file unixfilewatcher.cpp.

◆ stop()

void UnixFileWatcher::stop ( )

Definition at line 66 of file unixfilewatcher.cpp.

◆ watchFile()

void UnixFileWatcher::watchFile ( const std::string &  path)

Definition at line 80 of file unixfilewatcher.cpp.

Member Data Documentation

◆ _inotifyFd

UnixFd Leosac::Tools::UnixFileWatcher::_inotifyFd
private

Definition at line 80 of file unixfilewatcher.hpp.

◆ _isRunning

std::atomic<bool> Leosac::Tools::UnixFileWatcher::_isRunning
private

Definition at line 79 of file unixfilewatcher.hpp.

◆ _thread

std::thread Leosac::Tools::UnixFileWatcher::_thread
private

Definition at line 78 of file unixfilewatcher.hpp.

◆ _watches

Watches Leosac::Tools::UnixFileWatcher::_watches
private

Definition at line 81 of file unixfilewatcher.hpp.

◆ DefaultTimeoutMs

const long Leosac::Tools::UnixFileWatcher::DefaultTimeoutMs = 2000
staticprivate

Definition at line 49 of file unixfilewatcher.hpp.


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