Open Inventor Reference
|
00001 /* 00002 * 00003 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * Further, this software is distributed without any warranty that it is 00016 * free of the rightful claim of any third person regarding infringement 00017 * or the like. Any license provided herein, whether implied or 00018 * otherwise, applies only to this software file. Patent licenses, if 00019 * any, provided herein do not apply to combinations of this program with 00020 * other software, or any other product whatsoever. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 00027 * Mountain View, CA 94043, or: 00028 * 00029 * http://www.sgi.com 00030 * 00031 * For further information regarding this notice, see: 00032 * 00033 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ 00034 * 00035 */ 00036 00037 00038 /* 00039 * Copyright (C) 1990,91,92 Silicon Graphics, Inc. 00040 * 00041 _______________________________________________________________________ 00042 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00043 | 00044 | $Revision: 1.1.1.1 $ 00045 | 00046 | Description: 00047 | Timer sensors trigger repeatedly at regular 00048 | intervals, starting at a given base time. By default, the base 00049 | time is the current time (at the time the sensor is scheduled or 00050 | rescheduled) and the interval is 1/30 of a second; both of these 00051 | values may be changed. If more than one interval passes while 00052 | sensors are being triggered, then the extra intervals will be lost 00053 | (timers always reschedule themselves to occur in the future). 00054 | If more than one timer has expired (and therefore more than one 00055 | needs to be rescheduled), all of them are first triggered, and are 00056 | then rescheduled relative to the current time. The reschedule() 00057 | method is called by the sensor manager to accomplish this (see the 00058 | comments there about saturating the timer queue). 00059 | 00060 | Author(s) : Nick Thompson, Paul Strauss, Gavin Bell 00061 | 00062 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00063 _______________________________________________________________________ 00064 */ 00065 00066 #ifndef _SO_TIMER_SENSOR_ 00067 #define _SO_TIMER_SENSOR_ 00068 00069 #include <Inventor/sensors/SoTimerQueueSensor.h> 00070 00073 00098 00099 00100 class INVENTOR_API SoTimerSensor : public SoTimerQueueSensor { 00101 00102 public: 00103 00106 SoTimerSensor(); 00109 SoTimerSensor(SoSensorCB *func, void *data); 00110 00113 virtual ~SoTimerSensor(); 00114 00117 void setBaseTime(const SbTime &base) { baseTime = base; 00118 baseTimeSet = TRUE;} 00121 void setInterval(const SbTime &intvl) { interval = intvl; } 00122 00124 const SbTime & getBaseTime() const { return baseTime; } 00126 const SbTime & getInterval() const { return interval; } 00127 00130 virtual void schedule(); 00131 00135 virtual void unschedule(); 00136 00137 SoINTERNAL public: 00138 00140 void reschedule(const SbTime &); 00141 00142 private: 00143 SbTime baseTime; 00144 SbTime interval; 00145 SbBool baseTimeSet; 00146 00147 SbBool triggering; 00148 00152 virtual void trigger(); 00153 }; 00154 00155 #endif /* _SO_TIMER_SENSOR_ */