Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/putil/timedCycle.h

Go to the documentation of this file.
00001 // Filename: timedCycle.h
00002 // Created by:  jason (01Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef TIMED_CYCLE_H
00020 #define TIMED_CYCLE_H
00021 //
00022 ////////////////////////////////////////////////////////////////////
00023 // Includes
00024 ////////////////////////////////////////////////////////////////////
00025 #include <pandabase.h>
00026 
00027 #include "clockObject.h"
00028 
00029 class Datagram;
00030 class DatagramIterator;
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //       Class : TimedCycle
00034 // Description : A class for anything that needs to cycle over
00035 //               some finite list of elements in increments based on
00036 //               time.  All time variables are assumed to be set in
00037 //               seconds.
00038 ////////////////////////////////////////////////////////////////////
00039 
00040 class EXPCL_PANDA TimedCycle
00041 {
00042 public:
00043   INLINE TimedCycle();
00044   INLINE TimedCycle(float cycle_time, int element_count);
00045 
00046   INLINE void set_element_count(int element_count);
00047   INLINE void set_cycle_time(float cycle_time);
00048   INLINE int next_element();
00049 
00050 public:
00051   void write_datagram(Datagram &me);
00052   void fillin(DatagramIterator &scan);
00053 
00054 private:
00055   ClockObject* _global_clock;
00056   float _cycle_time;
00057   float _inv_cycle_time;
00058   double _next_switch;
00059   int _current_child;
00060   int _element_count;
00061 };
00062 
00063 #include "timedCycle.I"
00064 
00065 #endif

Generated on Fri May 2 00:43:45 2003 for Panda by doxygen1.3