Open Inventor Reference
SoTimerQueueSensor.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 timer
48  | queue. Each sensor in the timer queue contains an SbTime
49  | indicating when the sensor should be triggered. Sensors in the
50  | timer queue are sorted by their trigger times.
51  | Each subclass defines public methods for specifying when and how
52  | to trigger the sensor.
53  |
54  | Author(s) : Nick Thompson, Paul Strauss, Gavin Bell
55  |
56  ______________ S I L I C O N G R A P H I C S I N C . ____________
57  _______________________________________________________________________
58  */
59 
60 #ifndef _SO_TIMER_QUEUE_SENSOR_
61 #define _SO_TIMER_QUEUE_SENSOR_
62 
64 #include <Inventor/SbTime.h>
65 
68 
84 
86 
87  public:
90  SoTimerQueueSensor(SoSensorCB *func, void *data);
91 
94 
97  const SbTime & getTriggerTime() const { return trigTime; }
98 
101  virtual void schedule();
104  virtual void unschedule();
107  virtual bool isScheduled() const;
108 
109  protected:
112  void setTriggerTime(const SbTime &time);
113 
117  virtual void trigger();
118 
119  bool scheduled;
120 
121  private:
122  SbTime trigTime;
123 
126  virtual bool isBefore(const SoSensor *s) const;
127 };
128 
129 #endif /* _SO_TIMER_SENSOR_ */
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition: SbSystem.h:81
void SoSensorCB(void *data, SoSensor *sensor)
This typedef defines the calling sequence for all callbacks from sensors.
Definition: SoSensor.h:89
Class for representation of a time.
Definition: SbTime.h:89
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.
Abstract base class for sensors dependent on time.
SoTimerQueueSensor(SoSensorCB *func, void *data)
const SbTime & getTriggerTime() const
Returns the time at which this sensor is scheduled to be triggered.
virtual void schedule()
Adds this sensor to the timer queue.
bool scheduled
Whether sensor is scheduled.
virtual ~SoTimerQueueSensor()
Destructor.
void setTriggerTime(const SbTime &time)
Used by subclasses to set the time at which the sensor is to be triggered.
virtual void trigger()
Triggers the sensor, calling its callback function.
virtual bool isScheduled() const
Returns TRUE if this sensor has been scheduled and is waiting in the timer queue to be triggered.
SoTimerQueueSensor()
Constructors. The second form takes standard callback function and data.
virtual void unschedule()
If this sensor is scheduled, removes it from the timer queue so that it will not be triggered.