Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoFileSensor Class Reference

Sensor that triggers a callback each time a file is changed. More...

#include <Inventor/sensors/SoFileSensor.h>

+ Inheritance diagram for SoFileSensor:

Public Member Functions

 SoFileSensor ()
 Default constructor.
 
 SoFileSensor (SoSensorCB *func, void *data)
 Constructor that takes the callback function and data to be called when the sensor is triggered.
 
virtual ~SoFileSensor ()
 Destroys the sensor, freeing up any memory associated with it after unscheduling it.
 
void addFile (const SbString &filename)
 Add file to be monitored.
 
void removeFile (const SbString &filename)
 Remove file from monitored list.
 
void clearFiles ()
 Stop monitoring all previously registered files.
 
SbString getFilename () const
 Return changed file name.
 
- Public Member Functions inherited from SoTimerSensor
 SoTimerSensor ()
 Default constructor.
 
 SoTimerSensor (SoSensorCB *func, void *data)
 Constructor that takes the function and data to be called when the sensor is triggered.
 
virtual ~SoTimerSensor ()
 Destroys the sensor, freeing up any memory associated with it after unscheduling it.
 
void setBaseTime (const SbTime &base)
 Sets the base time.
 
void setInterval (const SbTime &intvl)
 Sets the interval.
 
const SbTimegetBaseTime () const
 Gets the base time.
 
const SbTimegetInterval () const
 Gets the interval.
 
virtual void schedule ()
 Adds this sensor to the timer queue.
 
virtual void unschedule ()
 If this sensor is scheduled, removes it from the timer queue so that it will not be triggered.
 
- Public Member Functions inherited from SoTimerQueueSensor
 SoTimerQueueSensor ()
 Constructor.
 
 SoTimerQueueSensor (SoSensorCB *func, void *data)
 Constructor that takes standard callback function and data.
 
const SbTimegetTriggerTime () const
 Returns the time at which this sensor is scheduled to be triggered.
 
- Public Member Functions inherited from SoSensor
 SoSensor ()
 Constructor.
 
 SoSensor (SoSensorCB *f, void *d)
 Constructor that takes standard callback function and data.
 
void setFunction (SoSensorCB *f, void *userData)
 
void setFunction (SoSensorCB *f)
 Sets the callback function that is called when the sensor is triggered.
 
void setData (void *d)
 Sets the callback data passed to the callback function.
 
SoSensorCBgetFunction () const
 Returns the callback that will be called when the sensor is triggered.
 
void * getData () const
 Returns the user-supplied pointer that will be passed to the callback function.
 
virtual SbBool isScheduled () const
 Returns TRUE if this sensor has been scheduled and is waiting in a sensor queue to be triggered.
 

Detailed Description

Sensor that triggers a callback each time a file is changed.

File sensors trigger their callback function when a watched file changes. Files are checked at the interval specified with SoTimerSensor::setInterval.

SEE ALSO

SoOneShotSensor, SoAlarmSensor, SoTimerQueueSensor, SbTime

Definition at line 50 of file SoFileSensor.h.

Constructor & Destructor Documentation

◆ SoFileSensor() [1/2]

SoFileSensor::SoFileSensor ( )

Default constructor.

◆ SoFileSensor() [2/2]

SoFileSensor::SoFileSensor ( SoSensorCB func,
void *  data 
)

Constructor that takes the callback function and data to be called when the sensor is triggered.

◆ ~SoFileSensor()

virtual SoFileSensor::~SoFileSensor ( )
virtual

Destroys the sensor, freeing up any memory associated with it after unscheduling it.

Member Function Documentation

◆ addFile()

void SoFileSensor::addFile ( const SbString filename)

Add file to be monitored.

If file does not exist, the method does nothing.

◆ clearFiles()

void SoFileSensor::clearFiles ( )

Stop monitoring all previously registered files.

◆ getFilename()

SbString SoFileSensor::getFilename ( ) const
inline

Return changed file name.


Note: Only valid when called from the callback function.

Definition at line 89 of file SoFileSensor.h.

◆ removeFile()

void SoFileSensor::removeFile ( const SbString filename)

Remove file from monitored list.

If file is not being monitored, the method does nothing.


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