SOALARMSENSOR(3iv)

✨ SoAlarmSensor ✨

okay bestie, welcome to the SoAlarmSensor(3IV) page, it's giving very "set it and forget it" energy and I am obsessed πŸ’–


🌸 NAME 🌸

SoAlarmSensor β€” triggers a callback once sometime in the future ⏰✨


πŸ¦‹ INHERITS FROM πŸ¦‹

SoSensor > SoTimerQueueSensor > SoAlarmSensor

it's a whole family tree and this one is the baby at the bottom, periodt πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <Inventor/sensors/SoAlarmSensor.h>

Methods from class SoAlarmSensor:

                     SoAlarmSensor()
                     SoAlarmSensor(SoSensorCB *func, void *data)
                     ~SoAlarmSensor()
 void                setTime(const SbTime &absTime)
 void                setTimeFromNow(const SbTime &relTime)
 const SbTime &      getTime() const

Methods from class SoTimerQueueSensor:

 const SbTime &      getTriggerTime()
 virtual void        schedule()
 virtual void        unschedule()
 virtual SbBool      isScheduled()

Methods from class SoSensor:

 void                setFunction(SoSensorCB *callbackFunction)
 SoSensorCB *        getFunction() const
 void                setData(void *callbackData)
 void *              getData() const

πŸ’œ DESCRIPTION πŸ’œ

so like, this type of sensor is here to schedule a one-time callback for some time in the future πŸ•°οΈβœ¨

and here's the tea: the sensor is not guaranteed to be called at exactly that time β€” it will be called sometime after the specified time. no cap, that's just how it is. so don't come for it if it's fashionably late πŸ’…


πŸ‘‘ METHODS πŸ‘‘

πŸ“ Creation methods

                     SoAlarmSensor()
                     SoAlarmSensor(SoSensorCB *func, void *data)

Creation methods, slay ✨ the second one takes the callback function and data to be called when the sensor is triggered β€” so you hand it the function, you hand it the data, and it handles the rest 🫢

🧚 The destructor

                     ~SoAlarmSensor()

Destroys the sensor, freeing up any memory associated with it after unscheduling it. very responsible, very demure, cleans up after itself πŸ’–

⭐ Setting the time

  • void setTime(const SbTime &absTime) β€” sets the sensor to go off at the specified time. heads up tho: you must also call schedule() for the sensor to be triggered. and if the sensor is already scheduled? it must be unscheduled and then rescheduled for the change in the trigger time to take effect. no shortcuts bestie 😭
  • void setTimeFromNow(const SbTime &relTime) β€” sets the sensor to go off the given amount of time from now. same rules fr fr: you must also call schedule() for the sensor to be triggered, and if it's already scheduled, it must be unscheduled and then rescheduled for the change in the trigger time to take effect πŸ¦‹
  • const SbTime & getTime() const β€” returns the time at which the sensor is set to be triggered. this one is similar to the getTriggerTime method, but it returns the time even if the sensor has not yet been scheduled. iconic behavior honestly πŸ‘‘

🌈 SEE ALSO 🌈

SoOneShotSensor, SoTimerSensor, SoTimerQueueSensor, SbTime

go read those too, iykyk πŸ’…


ok that's the whole page bestie, you ate that 🫢 remember: schedule it or it does nothing, and it might show up a lil late but it will show up ✨

signing off from the SoAlarmSensor(3IV)() era β€” source/version and date live right there in that footer line, mwah πŸ’‹πŸŽ€