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

panda/src/device/clientDialDevice.h

Go to the documentation of this file.
00001 // Filename: clientDialDevice.h
00002 // Created by:  drose (26Jan01)
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 CLIENTDIALDEVICE_H
00020 #define CLIENTDIALDEVICE_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "clientDevice.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : ClientDialDevice
00028 // Description : A device, attached to the ClientBase by a
00029 //               DialNode, that records the data from a single
00030 //               named dial device.  The named device can contain
00031 //               any number of dials, numbered in sequence beginning
00032 //               at zero.
00033 //
00034 //               A dial is a rotating device that does not have
00035 //               stops--it can keep rotating any number of times.
00036 //               Therefore it does not have a specific position at any
00037 //               given time, unlike an AnalogDevice.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDA ClientDialDevice : public ClientDevice {
00040 protected:
00041   INLINE ClientDialDevice(ClientBase *client, const string &device_name);
00042 
00043 public:
00044   INLINE int get_num_dials() const;
00045 
00046   INLINE void push_dial(int index, double offset);
00047   INLINE double read_dial(int index);
00048   INLINE bool is_dial_known(int index) const;
00049 
00050 private:
00051   void ensure_dial_index(int index);
00052 
00053 protected:
00054   class DialState {
00055   public:
00056     INLINE DialState();
00057 
00058     double _offset;
00059     bool _known;
00060   };
00061 
00062   typedef pvector<DialState> Dials;
00063   Dials _dials;
00064 
00065 
00066 public:
00067   static TypeHandle get_class_type() {
00068     return _type_handle;
00069   }
00070   static void init_type() {
00071     ClientDevice::init_type();
00072     register_type(_type_handle, "ClientDialDevice",
00073                   ClientDevice::get_class_type());
00074   }
00075   virtual TypeHandle get_type() const {
00076     return get_class_type();
00077   }
00078   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00079 
00080 private:
00081   static TypeHandle _type_handle;
00082 };
00083 
00084 #include "clientDialDevice.I"
00085 
00086 #endif

Generated on Fri May 2 00:36:12 2003 for Panda by doxygen1.3