1SoOneShotSensor(3IV)() SoOneShotSensor(3IV)()
2
3
4
6 SoOneShotSensor — sensor for one-time only callbacks
7
9 SoSensor > SoDelayQueueSensor > SoOneShotSensor
10
12 #include <Inventor/sensors/SoOneShotSensor.h>
13
14 Methods from class SoOneShotSensor:
15
16 SoOneShotSensor()
17 SoOneShotSensor(SoSensorCB *func, void *data)
18 ~SoOneShotSensor()
19
20 Methods from class SoDelayQueueSensor:
21
22 void setPriority(uint32_t pri)
23 uint32_t getPriority()
24 static uint32_t getDefaultPriority()
25 virtual void schedule()
26 virtual void unschedule()
27 virtual SbBool isScheduled()
28
29 Methods from class SoSensor:
30
31 void setFunction(SoSensorCB *callbackFunction)
32 SoSensorCB * getFunction() const
33 void setData(void *callbackData)
34 void * getData() const
35
36
38 A one-shot sensor is triggered once after it is scheduled, when the
39 delay queue is processed. Like all delay queue sensors, one-shot sen‐
40 sors with a non-zero priority are just added to the delay queue when
41 scheduled; if they are scheduled again before the delay queue is pro‐
42 cessed nothing happens, and they are guaranteed to be called only once
43 when the delay queue is processed. For example, a one-shot sensor whose
44 callback function redraws the scene might be scheduled whenever the
45 scene graph changes and whenever a window-system event reporting that
46 the window changed size occurs. By using a one-shot, the scene will
47 only be redrawn once even if a window-changed-size event occurs just
48 after the scene graph is modified (or if several window-changed-size
49 events occur in a row).
50
51 Calling schedule() in the callback function is a useful way of getting
52 something to happen repeatedly as often as possible, while still han‐
53 dling events and timeouts.
54
55 A priority 0 one-shot sensor isn't very useful, since scheduling it is
56 exactly the same as directly calling its callback function.
57
59 SoOneShotSensor()
60 SoOneShotSensor(SoSensorCB *func, void *data)
61 Creation methods. The second method takes the callback function and
62 data to be called when the sensor is triggered.
63
64 ~SoOneShotSensor()
65 Destroys the sensor, freeing up any memory associated with it after
66 unscheduling it.
67
68
70 SoIdleSensor, SoDelayQueueSensor
71
72
73
74
75 SoOneShotSensor(3IV)()