Panda3D
timedCycle.h
1 // Filename: timedCycle.h
2 // Created by: jason (01Aug00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef TIMED_CYCLE_H
16 #define TIMED_CYCLE_H
17 //
18 ////////////////////////////////////////////////////////////////////
19 // Includes
20 ////////////////////////////////////////////////////////////////////
21 #include "pandabase.h"
22 
23 #include "clockObject.h"
24 
25 class Datagram;
26 class DatagramIterator;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : TimedCycle
30 // Description : A class for anything that needs to cycle over
31 // some finite list of elements in increments based on
32 // time. All time variables are assumed to be set in
33 // seconds.
34 ////////////////////////////////////////////////////////////////////
35 
36 class EXPCL_PANDA_PUTIL TimedCycle
37 {
38 public:
39  INLINE TimedCycle();
40  INLINE TimedCycle(PN_stdfloat cycle_time, int element_count);
41 
42  INLINE void set_element_count(int element_count);
43  INLINE void set_cycle_time(PN_stdfloat cycle_time);
44  INLINE int next_element();
45 
46 public:
47  void write_datagram(Datagram &me);
48  void fillin(DatagramIterator &scan);
49 
50 private:
51  ClockObject* _global_clock;
52  PN_stdfloat _cycle_time;
53  PN_stdfloat _inv_cycle_time;
54  double _next_switch;
55  int _current_child;
56  int _element_count;
57 };
58 
59 #include "timedCycle.I"
60 
61 #endif
A class for anything that needs to cycle over some finite list of elements in increments based on tim...
Definition: timedCycle.h:36
A ClockObject keeps track of elapsed real time and discrete time.
Definition: clockObject.h:66
A class to retrieve the individual data elements previously stored in a Datagram. ...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43