FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
PollMonitor Class Reference

Monitor files and directories for changes. More...

#include <poll_monitor.hpp>

Classes

struct  PollResult
 Return result from polling monitor. More...
 

Public Types

enum  { NEW_FILE_DATA_AVAILABLE =1, WRITER_CLOSED =8, POLLING_STOPPED =16, WATCHED_BY_INOTIFY =64 }
 
enum  { MAX_FDS =2048 }
 

Public Member Functions

 PollMonitor ()
 
 ~PollMonitor ()
 
int addFile (const char *fileName, int connType=0, void *extraInfo=nullptr, OS_HANDLE_TYPE openedFD=INVALID_HANDLE_VALUE)
 Monitor a file for changes. More...
 
int addDescriptor (OS_HANDLE_TYPE openedFD, int connType=0, void *extraInfo=nullptr)
 Monitor an open descriptor. More...
 
int addWatchDirectoryForNewFiles (const char *dirName)
 Watch directory for appearance of new files. More...
 
int addWatchFileForAddedContent (const char *fileName, OS_HANDLE_TYPE openedFD)
 Watch file for increase in size. More...
 
int dropDescriptor (OS_HANDLE_TYPE fd)
 
int doPoll (PollResult interestingFds[MAX_FDS], int timeout=-1)
 

Public Attributes

uint32_t fdsInUse
 
PollResult fdInfo [MAX_FDS]
 
int watchIdToFd [MAX_FDS]
 
int fdToWatchID [MAX_FDS]
 
int fdToEntry [MAX_FDS]
 

Protected Member Functions

int getInotifyResults (OS_HANDLE_TYPE *interestingFds, int *eventType)
 
int findFDentry (OS_HANDLE_TYPE fd)
 

Static Protected Member Functions

static uint64_t getFileSizeForDescriptor (OS_HANDLE_TYPE fd)
 

Detailed Description

Monitor files and directories for changes.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_FDS 

◆ anonymous enum

anonymous enum
Enumerator
NEW_FILE_DATA_AVAILABLE 

Indicates new data available.

WRITER_CLOSED 

Indicates writer closed file.

POLLING_STOPPED 

Polling stopped.

WATCHED_BY_INOTIFY 

Being watched via inotify()

Constructor & Destructor Documentation

◆ PollMonitor()

PollMonitor::PollMonitor ( )

◆ ~PollMonitor()

PollMonitor::~PollMonitor ( )

Member Function Documentation

◆ addDescriptor()

int PollMonitor::addDescriptor ( OS_HANDLE_TYPE  openedFD,
int  connType = 0,
void *  extraInfo = nullptr 
)
inline

Monitor an open descriptor.

References addFile().

◆ addFile()

◆ addWatchDirectoryForNewFiles()

◆ addWatchFileForAddedContent()

int PollMonitor::addWatchFileForAddedContent ( const char *  fileName,
OS_HANDLE_TYPE  openedFD 
)

◆ doPoll()

int PollMonitor::doPoll ( PollResult  interestingFds[MAX_FDS],
int  timeout = -1 
)

◆ dropDescriptor()

int PollMonitor::dropDescriptor ( OS_HANDLE_TYPE  fd)

◆ findFDentry()

int PollMonitor::findFDentry ( OS_HANDLE_TYPE  fd)
protected

References fd, fdInfo, fdsInUse, and fdToEntry.

Referenced by doPoll(), and dropDescriptor().

◆ getFileSizeForDescriptor()

uint64_t PollMonitor::getFileSizeForDescriptor ( OS_HANDLE_TYPE  fd)
staticprotected

References fd.

◆ getInotifyResults()

int PollMonitor::getInotifyResults ( OS_HANDLE_TYPE interestingFds,
int *  eventType 
)
protected

Referenced by doPoll().

Member Data Documentation

◆ fdInfo

◆ fdsInUse

◆ fdToEntry

int PollMonitor::fdToEntry[MAX_FDS]

◆ fdToWatchID

int PollMonitor::fdToWatchID[MAX_FDS]

◆ watchIdToFd

int PollMonitor::watchIdToFd[MAX_FDS]

The documentation for this class was generated from the following files:
Generated: Fri Jul 31 2020 18:19:16
Support Information