Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoSensorManager Class Reference

The SoSensorManager class handles the sensor queues. More...

#include <Inventor/sensors/SoSensorManager.h>

List of all members.

Public Methods

 SoSensorManager (void)
 ~SoSensorManager ()
void insertDelaySensor (SoDelayQueueSensor *s)
void insertTimerSensor (SoTimerQueueSensor *s)
void removeDelaySensor (SoDelayQueueSensor *s)
void removeTimerSensor (SoTimerQueueSensor *s)
void setChangedCallback (void(*func)(void *), void *data)
void rescheduleTimer (SoTimerSensor *s)
void removeRescheduledTimer (SoTimerQueueSensor *s)
void processDelayQueue (SbBool isidle)
void processImmediateQueue (void)
void processTimerQueue (void)
SbBool isDelaySensorPending (void)
SbBool isTimerSensorPending (SbTime &tm)
void setDelaySensorTimeout (const SbTime &t)
const SbTimegetDelaySensorTimeout (void)
int doSelect (int nfds, void *readfds, void *writefds, void *exceptfds, struct timeval *userTimeOut)


Detailed Description

The SoSensorManager class handles the sensor queues.

There are two major sensor types in Coin: delay-sensors and timer-sensors. Each of these two types has its own queue, which is handled by the SoSensorManager. The queues are kept in sorted order by SoSensorManager, either according to trigger-time (for timer-sensors) or by priority (for delay-sensors).

Delay-sensors trigger when the application is otherwise idle. In addition, to avoid starvation in applications that are continually busy, the delay-sensor queue also has a timeout which, when reached, will empty the queue anyhow.

Timer-sensors are set up to trigger at specific, abolute times.

FIXME: doc

..provides methods for inserting, removing, processing (emptying) queues of sensors..

..the sensor mechanism is crucial in Coin for (automatic redrawal upon changes,)..

..should usually be considered as an internal class in the Coin system, only interesting for "normal users" when implementing new windowsystem-specific libraries (like SoQt,) ... which usually goes like this: (register change callback -- drop in delay queue sensor of type XXX for redraw queueing -- call process*Queue when... -- ...) ... confer the SoQt sourcecode to see a complete example of use (list interesting files)...

See also:
SoSensor SoTimerQueueSensor SoDelayQueueSensor , SoTimerSensor SoAlarmSensor , SoIdleSensor SoDataSensor SoOneShotSensor , SoPathSensor SoFieldSensor SoNodeSensor


Constructor & Destructor Documentation

SoSensorManager::SoSensorManager void
 

Constructor.

SoSensorManager::~SoSensorManager
 

Destructor.


Member Function Documentation

void SoSensorManager::insertDelaySensor SoDelayQueueSensor * newentry
 

Add a new entry to the queue of delay sensors.

See also:
removeFromQueue()

void SoSensorManager::insertTimerSensor SoTimerQueueSensor * newentry
 

Add a new entry to the timer queue of sensors. The queue will be sorted in order of supposed trigger time.

See also:
removeFromQueue()

void SoSensorManager::removeDelaySensor SoDelayQueueSensor * entry
 

Remove an entry from the sensor queue.

See also:
addToQueue()

void SoSensorManager::removeTimerSensor SoTimerQueueSensor * entry
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void SoSensorManager::setChangedCallback void(* func)(void *),
void * data
 

FIXME: write doc

void SoSensorManager::rescheduleTimer SoTimerSensor * s
 

FIXME: write doc

void SoSensorManager::removeRescheduledTimer SoTimerQueueSensor * s
 

FIXME: write doc

void SoSensorManager::processDelayQueue SbBool isidle
 

Trigger all delay queue entries in priority order.

The isidle flag indicates whether or not the processing happens because the application is idle or because the delay queue timeout was reached.

See also:
SoDB::setDelaySensorTimeout()

void SoSensorManager::processImmediateQueue void
 

FIXME: write doc

void SoSensorManager::processTimerQueue void
 

Trigger all the timers which has expired.

SbBool SoSensorManager::isDelaySensorPending void
 

FIXME: write doc

SbBool SoSensorManager::isTimerSensorPending SbTime & tm
 

Returns TRUE if at least one timer sensor is present in the queue, otherwise FALSE.

If sensors are pending, the time interval until the next one should be triggered will be put in the tm variable.

void SoSensorManager::setDelaySensorTimeout const SbTime & t
 

Delay sensors are usually triggered only when the system is idle. But when there are continuous updates to the scene graph, there's a possibility that the delay queue will starve and sensors are never triggered. To make sure this won't happen, this is a timeout value for the delay queue. When this timeout has been reached, the sensors in the delay queue gets processed before other sensors and events. This method will let the user set this timeout value.

The default value is 1/12 of a second.

See also:
getDelaySensorTimeout(), SoDelayQueueSensor

const SbTime & SoSensorManager::getDelaySensorTimeout void
 

Returns the timeout value for sensors in the delay queue.

See also:
setDelaySensorTimeout(), SoDelayQueueSensor

int SoSensorManager::doSelect int nfds,
void * readfds,
void * writefds,
void * exceptfds,
struct timeval * usertimeout
 

This is a wrapper around the standard select(2) call, which will make sure the sensor queues are updated while waiting for any action to happen on the given file descriptors.

The void* arguments must be valid pointers to fd_set structures. We've changed this from the original SGI Inventor API to avoid messing up the header file with system-specific includes.


The documentation for this class was generated from the following files:
Generated at Tue Mar 5 03:31:30 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001