ITimeObserver.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   (c) Art Tevs, MPI Informatik Saarbruecken                             *
00004  *       mailto: <tevs@mpi-sb.mpg.de>                                      *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  ***************************************************************************/
00012 
00013 
00014 #ifndef _NR_I_TIMEOBSERVER_H_
00015 #define _NR_I_TIMEOBSERVER_H_
00016 
00017 
00018 //----------------------------------------------------------------------------------
00019 // Includes
00020 //----------------------------------------------------------------------------------
00021 #include "Prerequisities.h"
00022 
00023 namespace nrEngine{
00024 
00025         //! Interface for every kind of objects used to observe the ticking of the clock        
00026         /**
00027         * ITimeObserver is an object which observers our global clock. Each time clock ticks
00028         * (this is not every second, but every frame) observer will be notified about
00029         * this and can do his work. Good example for such an observer is a timer, which
00030         * is updated every frame and provide time for parts of your application.
00031         * This also can be an alarm-clock which wait until certain time point and then fires.
00032         *
00033         * \ingroup time
00034         **/
00035         class _NRExport ITimeObserver {
00036         public:
00037                 
00038                 // Clock class is a friend, so he has full access
00039                 friend class Clock;
00040                 
00041                 // constructor & destructor
00042                 ITimeObserver() : _observerID(0) {}
00043                 virtual ~ITimeObserver(){}
00044                 
00045                 /**
00046                 * Clock should notify me every frame.
00047                 **/
00048                 virtual void notifyTimeObserver() = 0;
00049                 
00050                 /**
00051                 * Returns the observer id given us by the clock.
00052                 * You will need this id if you want to delete observer
00053                 * from the clock's list of observers
00054                 **/
00055                 int32 getObserverID(){return _observerID; }
00056                 
00057                 /**
00058                  * Call this method to reset an observer.
00059                  * Each observer should know how to reset himself
00060                  * @param resetToTime reset the observer to this starting time
00061                  **/
00062                 virtual void resetObserver(float64 resetToTime = 0.0f) = 0;
00063                 
00064         private:
00065                 int32 _observerID;
00066                 
00067         };
00068         
00069 }; // end namespace
00070 
00071 #endif

Generated on Wed Sep 12 23:19:42 2007 for nrEngine by  doxygen 1.5.1