SoSensorManager(3)
π NAME π
SoSensorManager β the class that handles the sensor queues. That's the whole job description bestie, and she does it flawlessly. π
β¨ SYNOPSIS β¨
#include <Inventor/sensors/SoSensorManager.h>
πΈ Public Member Functions πΈ
SoSensorManager (void)
~SoSensorManager ()
void insertDelaySensor (SoDelayQueueSensor *s)
void insertTimerSensor (SoTimerQueueSensor *s)
void removeDelaySensor (SoDelayQueueSensor *s)
void removeTimerSensor (SoTimerQueueSensor *s)
void setChangedCallback (void(*sensorQueueChangedCB)(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 SbTime & getDelaySensorTimeout (void)
int doSelect (int nfds, void *readfds, void *writefds, void *exceptfds, struct timeval *userTimeOut)
π Detailed Description π
Ok so <pink>SoSensorManager</pink> handles the sensor queues. Periodt. π
There are two major sensor types in Coin, <cyan>delay</cyan> sensors and <purple>timer</purple> sensors:
- Delay sensors trigger when the application is otherwise idle. And on top of that, 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. (Yes she has a backup plan. Main character behaviour. π)
- Timer sensors are set up to trigger at specific, absolute times.
Each of these two types has its own queue, and <pink>SoSensorManager</pink> is the one handling both of them. The queues are kept in sorted order by <pink>SoSensorManager</pink>, either according to trigger-time (for timer sensors) or by priority (for delay sensors). Not a single crumb left unsorted. β¨
The <pink>SoSensorManager</pink> provides methods for managing these queues, by insertion and removal of sensors, and processing (emptying) of the queues.
The sensor mechanism is crucial in Coin for a number of important features, most notably automatic scheduling redrawal upon changes, and for making it possible to set up animations in the scenegraph which does not need any additional book-keeping from the application code. Like, she just does that. π¦
<pink>SoSensorManager</pink> should usually be considered as an internal class in the Coin API. It is only interesting for application programmers when implementing new windowsystem-specific libraries (like Kongsberg Oil & Gas Technologies SoQt, SoXt, SoGtk, SoWin or Sc21) or wrappers. Then one has to set up code to empty the queues at the correct intervals. For detailed information on how to do that, we would advise you to look at the implementation of said mechanisms in the So*-libraries which SIM provides. π
Please note that before Coin2.3.1, sensors with equal priority (or the same trigger time forSoTimerQueuesensors) were processed LIFO. This has now been changed to FIFO to be conformant to SGI Inventor. Not me learning the lore from a changelog. π
π See also π
SoSensorSoTimerQueueSensorSoDelayQueueSensorSoTimerSensorSoAlarmSensorSoIdleSensorSoDataSensorSoOneShotSensorSoPathSensorSoFieldSensorSoNodeSensor
π Constructor & Destructor Documentation π
SoSensorManager::SoSensorManager (void )
Constructor. β¨ She's born. π
SoSensorManager::~SoSensorManager ()
Destructor. π She's gone, but her queues live on in our hearts.
π¦ 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 queue of prioritized sensors. Bye bestie π
See also: addToQueue()
void SoSensorManager::removeTimerSensor (SoTimerQueueSensor * entry)
Remove an entry from the queue of timer sensors. πβοΈ
void SoSensorManager::setChangedCallback (void(* func )(void *), void * data)
For setting up a callback function to be invoked whenever any of the sensor queues are changed. π£
This callback should typically be responsible for updating the client-side mechanism which is used for processing the queues. Like, she rings the doorbell and you go deal with it. π
void SoSensorManager::rescheduleTimer (SoTimerSensor * s)
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. π€«
void SoSensorManager::removeRescheduledTimer (SoTimerQueueSensor * s)
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. π€«
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. Two totally different vibes, same function.
A delay queue sensor with priority > 0 can only be triggered once during a call to this function. If a delay sensor is rescheduled during processDelayQueue(), it is not processed until the next time this function is called. This is done to avoid an infinite loop while processing the sensors. (She's protecting you from yourself. Respect. π)
A delay queue sensor with priority 0 is called an immediate sensor.
See also:
SoDB::setDelaySensorTimeout()SoSensorManager::processImmediateQueue()
void SoSensorManager::processImmediateQueue (void )
Process all immediate sensors (delay sensors with priority 0). β‘
Be aware that you might risk an infinite loop using immediate sensors. Unlike delay queue sensors, immediate sensors can be rescheduled and triggered multiple times during immediate queue processing. So likeβ¦ be careful bestie. π
See also: SoDelayQueueSensor::setPriority()
void SoSensorManager::processTimerQueue (void )
Trigger all the timers which has expired. β³π₯
SbBool SoSensorManager::isDelaySensorPending (void )
Returns TRUE if at least one delay sensor or immediate sensor is present in the respective queue, otherwise FALSE. A simple yes-or-no, she's not complicated. π
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. β±οΈ
Specifying a zero time will disable the timeout, opening for potential delay queue starvation. So, like, don't? π
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)
NOTE: THIS METHOD IS OBSOLETED. DON'T USE IT. π«π
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. π§
NOTE: THIS METHOD IS OBSOLETED. DON'T USE IT. π«π (yes she said it twice, she means it)
π Author π
Generated automatically by Doxygen for Coin from the source code. π€β¨
And that's the whole page, bestie! This was <pink>Coin</pink>, <purple>Version 3.1.3</purple>, page SoSensorManager(3) β slay, no cap, go empty those queues responsibly. πππ¦π
π
π¦ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms