00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ANALOGNODE_H
00016 #define ANALOGNODE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "clientBase.h"
00021 #include "clientAnalogDevice.h"
00022 #include "dataNode.h"
00023 #include "linmath_events.h"
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class EXPCL_PANDA_DEVICE AnalogNode : public DataNode {
00046 PUBLISHED:
00047 AnalogNode(ClientBase *client, const string &device_name);
00048 virtual ~AnalogNode();
00049
00050 INLINE bool is_valid() const;
00051
00052 INLINE int get_num_controls() const;
00053
00054 INLINE double get_control_state(int index) const;
00055 INLINE bool is_control_known(int index) const;
00056
00057 INLINE void set_output(int channel, int index, bool flip);
00058 INLINE void clear_output(int channel);
00059 INLINE int get_output(int channel) const;
00060 INLINE bool is_output_flipped(int channel) const;
00061
00062 public:
00063 virtual void write(ostream &out, int indent_level = 0) const;
00064
00065 private:
00066 class OutputData {
00067 public:
00068 INLINE OutputData();
00069 int _index;
00070 bool _flip;
00071 };
00072
00073 enum { max_outputs = 2 };
00074 OutputData _outputs[max_outputs];
00075
00076 PT(ClientAnalogDevice) _analog;
00077
00078 protected:
00079
00080 virtual void do_transmit_data(DataGraphTraverser *trav,
00081 const DataNodeTransmit &input,
00082 DataNodeTransmit &output);
00083
00084 private:
00085
00086 int _xy_output;
00087
00088 PT(EventStoreVec2) _xy;
00089
00090 public:
00091 static TypeHandle get_class_type() {
00092 return _type_handle;
00093 }
00094 static void init_type() {
00095 DataNode::init_type();
00096 register_type(_type_handle, "AnalogNode",
00097 DataNode::get_class_type());
00098 }
00099 virtual TypeHandle get_type() const {
00100 return get_class_type();
00101 }
00102 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00103
00104 private:
00105 static TypeHandle _type_handle;
00106 };
00107
00108 #include "analogNode.I"
00109
00110 #endif