![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2009 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtBalancedUpdater.h,v $ $Revision: 1.4 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtBalancedUpdater_H_ 00014 #define DtBalancedUpdater_H_ 00015 00016 #include <vrvUtil/vrvUtil.h> 00017 #include <vector> 00018 00019 namespace makVrv 00020 { 00028 template <typename Updatee> 00029 class DtBalancedUpdater 00030 { 00031 public: 00032 00035 DtBalancedUpdater(double timeStep = 1.0); 00036 00038 virtual ~DtBalancedUpdater(); 00039 00042 void addUpdatee(const Updatee& updater); 00043 00045 void removeUpdatee(const Updatee& updater); 00046 00048 void update(double newTime); 00049 00051 void finishUpdates(double newTime); 00052 00054 size_t numberOfUpdatees() const; 00055 00057 double timeStep() const; 00058 00064 void setTimeStep(double timeStep); 00065 00066 protected: 00067 00068 typedef std::vector<Updatee> UpdateeList; 00069 00070 double myTimeStep; 00071 double myCurrentTime; 00072 size_t myInitialWaitingSize; 00073 00074 UpdateeList myWaitingList; 00075 UpdateeList myFinishedList; 00076 }; 00077 } 00078 00079 #define DtBalancedUpdater_INL_ 00080 #include <vrvUtil/DtBalancedUpdater.inl> 00081 #undef DtBalancedUpdater_INL_ 00082 00083 #endif 00084