Open Inventor Reference
SoDelayQueueSensor.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91,92 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | Abstract base class for all sensors that are added to the delay
48 | queue, which means that they will be executed at some time in the
49 | future (when there is idle time, or when a user-defined timeout
50 | occurs-- see SoDB::setDelaySensorTimeout()).
51 |
52 | Sensors in the delay queue are sorted by priorities. A priority of
53 | 0 indicates that the sensor is immediate and should be triggered
54 | immediately when it is scheduled. Sensors with other priorities
55 | are sorted by increasing priority.
56 |
57 | Author(s) : Nick Thompson, Paul Strauss, Gavin Bell
58 |
59 ______________ S I L I C O N G R A P H I C S I N C . ____________
60 _______________________________________________________________________
61 */
62
63#ifndef _SO_DELAY_QUEUE_SENSOR_
64#define _SO_DELAY_QUEUE_SENSOR_
65
66
68
71
109
111
112 public:
115 SoDelayQueueSensor(SoSensorCB *func, void *data);
116
119
126 uint32_t getPriority() const { return priority; }
127
129 static uint32_t getDefaultPriority() { return 100; }
130
143 virtual void schedule();
146 virtual void unschedule();
150 virtual bool isScheduled() const;
151
155 virtual bool isIdleOnly() const;
156 SoINTERNAL public:
160 void setCounter(uint32_t c) { counter = c; }
161 uint32_t getCounter() const { return counter; }
162
163 protected:
167 virtual void trigger();
168
170
171 private:
172 uint32_t priority;
173 uint32_t counter;
174
177 virtual bool isBefore(const SoSensor *s) const;
178};
179
180#endif /* _SO_DELAY_QUEUE_SENSOR_ */
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
unsigned int uint32_t
Definition SbTypeDefs.h:44
void SoSensorCB(void *data, SoSensor *sensor)
This typedef defines the calling sequence for all callbacks from sensors.
Definition SoSensor.h:89
Abstract base class for sensors not dependent on time.
virtual void trigger()
Triggers the sensor, calling its callback function.
SoDelayQueueSensor()
Constructors. The second form takes standard callback function and data.
virtual ~SoDelayQueueSensor()
Destructor.
bool scheduled
Whether sensor is scheduled.
virtual void schedule()
If this sensor's priority is non-zero, adds this sensor to the list of delay queue sensors ready to b...
uint32_t getPriority() const
Gets the priority of the sensor.
static uint32_t getDefaultPriority()
Returns the default delay queue sensor priority, which is 100.
void setCounter(uint32_t c)
Set/inquire counter when sensor was last triggered.
virtual bool isScheduled() const
Returns TRUE if this sensor has been scheduled and is waiting in the delay queue to be triggered.
virtual bool isIdleOnly() const
This method is overriden by IdleSensors to tell sensor manager that they should only be processed whe...
void setPriority(uint32_t pri)
Sets the priority of the sensor.
uint32_t getCounter() const
virtual void unschedule()
If this sensor is scheduled, removes it from the delay queue so that it will not be triggered.
SoDelayQueueSensor(SoSensorCB *func, void *data)
Abstract base class for Inventor sensors.
Definition SoSensor.h:108
virtual bool isBefore(const SoSensor *s) const =0
This returns TRUE if this sensor should precede sensor s in whichever queue this sensor would be in.