CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

timer.h

00001 /*
00002     Copyright (C) 2003 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_TIMER_H__
00020 #define __CS_TIMER_H__
00021 
00022 #include <stdarg.h>
00023 #include <stdio.h>
00024 #include "csutil/array.h"
00025 #include "iutil/timer.h"
00026 
00027 struct iEvent;
00028 struct iObjectRegistry;
00029 struct iVirtualClock;
00030 struct iEventHandler;
00031 struct timerevent;
00032 
00037 class csEventTimer : public iEventTimer
00038 {
00039 private:
00040   iObjectRegistry* object_reg;
00041   csArray<timerevent> timerevents;
00042   iEventHandler* handler;
00043   csRef<iVirtualClock> vc;
00044 
00045   int FindTimerEvent (iTimerEvent* ev);
00046 
00047   // Optimization: to prevent having to loop over all timer events
00048   // all the time we keep the minimum time needed before the first
00049   // event is triggered.
00050   int32 minimum_time;
00051   int32 accumulate_elapsed;
00052 
00053 public:
00054   csEventTimer (iObjectRegistry* object_reg);
00055   virtual ~csEventTimer ();
00056 
00057   bool HandleEvent (iEvent& e);
00058 
00059   SCF_DECLARE_IBASE;
00060 
00061   virtual void AddTimerEvent (iTimerEvent* ev, csTicks delay);
00062   virtual void RemoveTimerEvent (iTimerEvent* ev);
00063   virtual void RemoveAllTimerEvents ();
00064 
00070   static csPtr<iEventTimer> GetStandardTimer (iObjectRegistry* object_reg);
00071 };
00072 
00073 #endif // __CS_TIMER_H__
00074 

Generated for Crystal Space by doxygen 1.2.14