| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 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 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 // $Id: timemanager.h 6378 2008-06-02 13:30:09Z Konstantin_Baumann $ 00018 // $Date: 2008-06-02 15:30:09 +0200 (Mon, 02 Jun 2008) $ 00019 // $Revision: 6378 $ 00020 // $State$ 00021 // $Author: Konstantin_Baumann $ 00022 // 00023 // $Log$ 00024 // Revision 1.20 2005/09/20 09:36:11 baumann 00025 // visitor mechanism refined 00026 // 00027 // Revision 1.19 2005/01/03 01:43:10 klimetschek 00028 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00029 // - removed vrs.vcproj 00030 // minor things: 00031 // - added all glutexamples to vrs4glut.sln 00032 // - fixed some problems in glutexamples 00033 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00034 // 00035 // Revision 1.18 2004/10/28 14:16:01 basch 00036 // Class comment changed (Doxygen style) 00037 // 00038 // Revision 1.17 2004/06/22 15:13:39 baumann 00039 // method containsBehavior() added 00040 // 00041 // Revision 1.16 2004/03/12 16:28:41 baumann 00042 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00043 // 00044 // Revision 1.15 2003/07/24 09:31:43 baumann 00045 // acceptChildren() implemented 00046 // 00047 // Revision 1.14 2003/01/07 15:55:44 baumann 00048 // added parameter clock to the method switchOn() 00049 // 00050 // Revision 1.13 2002/07/02 15:23:48 baumann 00051 // non-persistent containers now have the prefix NonPersistent, e.g. NonPersistentArray<T> 00052 // persistent containers now have no prefix, e.g. Array<T> 00053 // 00054 // Revision 1.12 2002/03/04 12:04:17 kersting 00055 // directory structure changes 00056 // 00057 // Revision 1.11 2002/03/03 21:44:26 kosta 00058 // VRS_TYPEINFO-macro rewritten 00059 // 00060 // Revision 1.10 2002/02/27 15:03:29 kersting 00061 // renamed Time to VRSTime 00062 // 00063 // Revision 1.9 2002/02/19 10:34:21 kosta 00064 // undone all changes since 2002-02-15 00065 // 00066 // Revision 1.6 2002/02/12 15:04:34 kosta 00067 // VRS container classes completely rewritten using STL 00068 // 00069 // Revision 1.5 2002/01/15 16:25:55 kosta 00070 // macros rewritten for a better namespace support 00071 // 00072 // Revision 1.4 2002/01/07 07:33:02 kirsch 00073 // Removed Windows-style line endings 00074 // 00075 // Revision 1.3 2002/01/04 13:10:16 doellner 00076 // VRSTime manager and clock implementation redesigned. 00077 // 00078 // Revision 1.2 2001/11/13 16:36:32 kirsch 00079 // changed line feed to unix style (removed control-M) 00080 // 00081 // Revision 1.1.1.1 2001/06/08 08:09:21 kirsch 00082 // imported alpha-version by olli 00083 // 00084 00085 #ifndef VRS_SG_TIMEMANAGER_H 00086 #define VRS_SG_TIMEMANAGER_H 00087 00088 #include <vrs/container/deque.h> 00089 #include <vrs/container/dictionary.h> 00090 #include <vrs/sg/manager.h> 00091 #include <vrs/sg/behaviornode.h> 00092 #include <vrs/sg/moment.h> 00093 00094 namespace VRS { 00095 00096 class Clock; 00097 00099 class VRS_CORE_API TimeManager : public Manager { 00100 00101 public: 00102 TimeManager(double delay); 00111 virtual void appendBehavior(BehaviorNode* node); 00112 virtual void prependBehavior(BehaviorNode* node); 00113 virtual void insertBehavior(int, BehaviorNode* node); 00114 virtual void removeBehavior(int i); 00115 virtual void removeBehavior(BehaviorNode* node); 00116 virtual bool containsBehavior(BehaviorNode* node) const; 00118 00119 virtual int behaviors() const; 00120 virtual BehaviorNode* behavior(int i) const; 00121 00122 virtual int handle(Event* e); 00127 virtual void switchOn(BehaviorNode* node, Clock* clock = NULL); 00128 virtual void switchOff(BehaviorNode* node); 00129 virtual bool isSwitchedOn(BehaviorNode* node) const; 00140 virtual void reset(BehaviorNode*); 00141 00142 VRS_TYPEINFO(TimeManager, Manager); 00143 00144 protected: 00145 virtual void acceptChildren(std::vector<Visitable*>& appendChildrenHere) const; 00146 00147 private: 00148 void unregisterBehavior (BehaviorNode*); 00149 00150 SO<Deque<SO<BehaviorNode> > > behaviors_; 00151 SO<NonPersistentDictionary<BehaviorNode*, Moment> > lifetimes_; 00152 }; 00153 00154 } // namespace VRS 00155 00156 #endif // VRS_SG_TIMEMANAGER_H