Into

Modules

Documentation

classPiiFileSystemWatcher

#include <PiiFileSystemWatcher.h>

An operation for monitoring directories for new files.

Inherits PiiDefaultOperation

Description

If the file is added or modified in directory that are being watched, its absolute file name will be emitted.

Outputs

filenamethe absolute path of a file that was modified or added to a watched directory.

Properties

The list of watched directories.

Sets the name filters used in watching new files.

int

Delay the emission of a file name for this many seconds.

Constructors and destructor

Public member functions

virtual void
(
  • bool reset
)

Checks the operation for execution.

void
( )
void
( )
void
(
  • int watchDelay
)
int

Protected member functions

virtual void

Executes one round of processing.

Property details

  • QStringList directories

    [read, write]

    The list of watched directories.

  • QStringList nameFilters

    [read, write]

    Sets the name filters used in watching new files.

    Each name filter is a wildcard (globbing) filter that understands * and ? wildcards. The operation will only report files whose names match the one of the filters. If the filter list is empty, all changed files will be reported. An example:

     QStringList lstNameFilters = QStringList() << "*.jpg" << "*.png";
     pFileSystemWatcher->setProperty("nameFilters", lstNameFilters);
    
  • int watchDelay

    [read, write]

    Delay the emission of a file name for this many seconds.

    If watchDelay is non-zero, added and modified files will not be reported until they remain unchanged at least watchDelay seconds. This can be used delay the handling of a large file until it is completely stored into the file system. The default value is zero.

Function details

  • PiiFileSystemWatcher

    ()
  • virtual void check

    (
    • bool reset
    )
    [virtual]

    Checks the operation for execution.

    This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.

    If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.

    Reimplemented from PiiDefaultOperation.

  • QStringList directories

    ()
  • QStringList nameFilters

    ()
  • void setDirectories

    ( )
  • void setNameFilters

    ( )
  • void setWatchDelay

    (
    • int watchDelay
    )
  • int watchDelay

    ()
  • virtual void process

    ()
    [protected, virtual]

    Executes one round of processing.

    This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.

    Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().

    Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns Running.

    Exceptions
    PiiExecutionException

    whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.

    Reimplemented from PiiDefaultOperation.

  • void directoryChanged

    ()
    [slot]

    This slot is called when the directory at a specified path is modified.

  • void emitNotModifiedFileNames

    ()
    [slot]
Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.