00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MOVINGPART_H
00016 #define MOVINGPART_H
00017
00018 #include "pandabase.h"
00019
00020 #include "movingPartBase.h"
00021 #include "animChannel.h"
00022
00023
00024
00025
00026
00027
00028
00029 template<class SwitchType>
00030 class MovingPart : public MovingPartBase {
00031 public:
00032 typedef TYPENAME SwitchType::ValueType ValueType;
00033 typedef AnimChannel<SwitchType> ChannelType;
00034
00035 protected:
00036 INLINE MovingPart(const MovingPart ©);
00037
00038 public:
00039 INLINE MovingPart(PartGroup *parent, const string &name,
00040 const ValueType &default_value);
00041
00042 virtual TypeHandle get_value_type() const;
00043 virtual AnimChannelBase *make_default_channel() const;
00044 virtual void output_value(ostream &out) const;
00045
00046 ValueType _value;
00047 ValueType _default_value;
00048
00049 public:
00050 INLINE virtual void write_datagram(BamWriter* manager, Datagram &me);
00051
00052 protected:
00053 INLINE MovingPart();
00054 INLINE void fillin(DatagramIterator& scan, BamReader* manager);
00055
00056 public:
00057 virtual TypeHandle get_type() const {
00058 return get_class_type();
00059 }
00060 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00061 PUBLISHED:
00062 static TypeHandle get_class_type() {
00063 return _type_handle;
00064 }
00065 INLINE ValueType get_value() const {
00066 return _value;
00067 }
00068 INLINE ValueType get_default_value() const {
00069 return _default_value;
00070 }
00071 public:
00072 static void init_type() {
00073 MovingPartBase::init_type();
00074 register_type(_type_handle, SwitchType::get_part_type_name(),
00075 MovingPartBase::get_class_type());
00076 }
00077
00078 private:
00079 static TypeHandle _type_handle;
00080 };
00081
00082 #include "movingPart.I"
00083
00084 #endif
00085
00086
00087