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