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