A class to poll files for modifications.
More...
#include <tsPollFiles.h>
|
|
| PollFiles ()=default |
| | Default constructor.
|
| |
| template<class Rep1 , class Period1 , class Rep2 , class Period2 > |
| | PollFiles (const UString &wildcard, PollFilesListener *listener=nullptr, const cn::duration< Rep1, Period1 > &poll_interval=DEFAULT_POLL_INTERVAL, const cn::duration< Rep2, Period2 > &min_stable_delay=DEFAULT_MIN_STABLE_DELAY, Report &report=(ts::CerrReport::Instance())) |
| | Constructor.
|
| |
| bool | pollOnce () |
| | Perform one poll operation, notify listener if necessary, and return immediately.
|
| |
| void | pollRepeatedly () |
| | Poll files continuously until the listener asks to terminate.
|
| |
| void | setFileWildcard (const UString &wildcard) |
| | Set a new file wildcard specification to poll.
|
| |
| void | setListener (PollFilesListener *listener) |
| | Set a new file listener.
|
| |
| template<class Rep , class Period > |
| void | setMinStableDelay (const cn::duration< Rep, Period > &min_stable_delay) |
| | Set a new minimum file stability delay.
|
| |
| template<class Rep , class Period > |
| void | setPollInterval (const cn::duration< Rep, Period > &poll_interval) |
| | Set a new polling interval.
|
| |
|
| static constexpr cn::milliseconds | DEFAULT_MIN_STABLE_DELAY = cn::milliseconds(500) |
| | Default minimum file stability delay.
|
| |
|
static constexpr cn::milliseconds | DEFAULT_POLL_INTERVAL = cn::milliseconds(1000) |
| | Default interval between two poll operations.
|
| |
A class to poll files for modifications.
◆ PollFiles()
template<class Rep1 , class Period1 , class Rep2 , class Period2 >
Constructor.
- Parameters
-
| [in] | wildcard | Wildcard specification of files to poll (eg "/path/to/*.dat"). |
| [in] | listener | Invoked on file modification. Can be null. |
| [in] | poll_interval | Interval between two poll operations. |
| [in] | min_stable_delay | A file size needs to be stable during that duration for the file to be reported as added or modified. This prevent too frequent poll notifications when a file is being written and his size modified at each poll. |
| [in,out] | report | For debug messages only. |
◆ setFileWildcard()
| void ts::PollFiles::setFileWildcard |
( |
const UString & |
wildcard | ) |
|
|
inline |
Set a new file wildcard specification to poll.
- Parameters
-
| [in] | wildcard | Wildcard specification of files to poll (eg "/path/to/*.dat"). |
◆ setListener()
Set a new file listener.
- Parameters
-
| [in] | listener | Invoked on file modification. Can be null. |
◆ setPollInterval()
template<class Rep , class Period >
| void ts::PollFiles::setPollInterval |
( |
const cn::duration< Rep, Period > & |
poll_interval | ) |
|
|
inline |
Set a new polling interval.
- Parameters
-
| [in] | poll_interval | Interval in milliseconds between two poll operations. |
◆ setMinStableDelay()
template<class Rep , class Period >
| void ts::PollFiles::setMinStableDelay |
( |
const cn::duration< Rep, Period > & |
min_stable_delay | ) |
|
|
inline |
Set a new minimum file stability delay.
- Parameters
-
| [in] | min_stable_delay | A file size needs to be stable during that duration for the file to be reported as added or modified. This prevent too frequent poll notifications when a file is being written and his size modified at each poll. |
◆ pollRepeatedly()
| void ts::PollFiles::pollRepeatedly |
( |
| ) |
|
Poll files continuously until the listener asks to terminate.
Invoke the listener each time something has changed. The first time, all files are reported as "added".
◆ pollOnce()
| bool ts::PollFiles::pollOnce |
( |
| ) |
|
Perform one poll operation, notify listener if necessary, and return immediately.
- Returns
- True to continue polling, false to exit polling.
◆ DEFAULT_MIN_STABLE_DELAY
| constexpr cn::milliseconds ts::PollFiles::DEFAULT_MIN_STABLE_DELAY = cn::milliseconds(500) |
|
staticconstexpr |
Default minimum file stability delay.
A file size needs to be stable during that duration for the file to be reported as added or modified. This prevent too frequent poll notifications when a file is being written and his size modified at each poll.
The documentation for this class was generated from the following file: