VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtBalancedUpdater.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2009 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #ifndef DtBalancedUpdater_H_
11 #define DtBalancedUpdater_H_
12 
13 #include <vrvUtil/vrvUtil.h>
14 #include <vector>
15 
16 namespace makVrv
17 {
25  template <typename Updatee>
27  {
28  public:
29 
32  DtBalancedUpdater(double timeStep = 1.0);
33 
35  virtual ~DtBalancedUpdater();
36 
39  void addUpdatee(const Updatee& updater);
40 
42  void removeUpdatee(const Updatee& updater);
43 
45  void update(double newTime);
46 
48  void finishUpdates(double newTime);
49 
51  size_t numberOfUpdatees() const;
52 
54  double timeStep() const;
55 
61  void setTimeStep(double timeStep);
62 
63  protected:
64 
65  typedef std::vector<Updatee> UpdateeList;
66 
67  double myTimeStep;
68  double myCurrentTime;
70 
73  };
74 }
75 
76 #define DtBalancedUpdater_INL_
77 #include <vrvUtil/DtBalancedUpdater.inl>
78 #undef DtBalancedUpdater_INL_
79 
80 #endif
81 
virtual ~DtBalancedUpdater()
Override if necessary.
void addUpdatee(const Updatee &updater)
Add an updatee object to the group. The updatee class should support value semantics.
UpdateeList myFinishedList
Definition: DtBalancedUpdater.h:72
std::vector< Updatee > UpdateeList
Definition: DtBalancedUpdater.h:65
Contains DLL export macros.
double myTimeStep
Definition: DtBalancedUpdater.h:67
void removeUpdatee(const Updatee &updater)
Remove an updater object from the group.
void setTimeStep(double timeStep)
Change the time step of the updater which is the time between updates of a particular instance...
size_t numberOfUpdatees() const
Get the number of updaters added.
UpdateeList myWaitingList
Definition: DtBalancedUpdater.h:71
DtBalanacedUpdater updates updatee classes at a desired rate in a fair (each instance gets the same n...
Definition: DtBalancedUpdater.h:26
void update(double newTime)
Update the group, this function should be called frequently.
size_t myInitialWaitingSize
Definition: DtBalancedUpdater.h:69
void finishUpdates(double newTime)
Finish all remaining updates.
double myCurrentTime
Definition: DtBalancedUpdater.h:68
double timeStep() const
Get the time step of the updater.
DtBalancedUpdater(double timeStep=1.0)
Create a balanced updater which will update at a given rate. Time step may not be 0...

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)