00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CLIENTANALOGDEVICE_H
00020 #define CLIENTANALOGDEVICE_H
00021
00022 #include <pandabase.h>
00023
00024 #include "clientDevice.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class EXPCL_PANDA ClientAnalogDevice : public ClientDevice {
00039 protected:
00040 INLINE ClientAnalogDevice(ClientBase *client, const string &device_name);
00041
00042 public:
00043 INLINE int get_num_controls() const;
00044
00045 INLINE void set_control_state(int index, double state);
00046 INLINE double get_control_state(int index) const;
00047 INLINE bool is_control_known(int index) const;
00048
00049 virtual void write(ostream &out, int indent_level = 0) const;
00050 void write_controls(ostream &out, int indent_level) const;
00051
00052 private:
00053 void ensure_control_index(int index);
00054
00055 protected:
00056 class AnalogState {
00057 public:
00058 INLINE AnalogState();
00059
00060 double _state;
00061 bool _known;
00062 };
00063
00064 typedef pvector<AnalogState> Controls;
00065 Controls _controls;
00066
00067
00068 public:
00069 static TypeHandle get_class_type() {
00070 return _type_handle;
00071 }
00072 static void init_type() {
00073 ClientDevice::init_type();
00074 register_type(_type_handle, "ClientAnalogDevice",
00075 ClientDevice::get_class_type());
00076 }
00077 virtual TypeHandle get_type() const {
00078 return get_class_type();
00079 }
00080 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00081
00082 private:
00083 static TypeHandle _type_handle;
00084 };
00085
00086 #include "clientAnalogDevice.I"
00087
00088 #endif