00001 // Filename: movingPart.h 00002 // Created by: drose (22Feb99) 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 MOVINGPART_H 00020 #define MOVINGPART_H 00021 00022 #include <pandabase.h> 00023 00024 #include "movingPartBase.h" 00025 #include "animChannel.h" 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : MovingPart 00029 // Description : This is the template instantiation of MovingPartBase, 00030 // on the particular type of value provided by the 00031 // channel. 00032 //////////////////////////////////////////////////////////////////// 00033 template<class SwitchType> 00034 class MovingPart : public MovingPartBase { 00035 public: 00036 typedef TYPENAME SwitchType::ValueType ValueType; 00037 typedef AnimChannel<SwitchType> ChannelType; 00038 00039 protected: 00040 INLINE MovingPart(const MovingPart ©); 00041 00042 public: 00043 INLINE MovingPart(PartGroup *parent, const string &name, 00044 const ValueType &_initial_value); 00045 00046 virtual TypeHandle get_value_type() const; 00047 virtual AnimChannelBase *make_initial_channel() const; 00048 virtual void output_value(ostream &out) const; 00049 00050 ValueType _value; 00051 ValueType _initial_value; 00052 00053 public: 00054 INLINE virtual void write_datagram(BamWriter* manager, Datagram &me); 00055 00056 protected: 00057 INLINE MovingPart(void); 00058 INLINE void fillin(DatagramIterator& scan, BamReader* manager); 00059 00060 public: 00061 virtual TypeHandle get_type() const { 00062 return get_class_type(); 00063 } 00064 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00065 PUBLISHED: 00066 static TypeHandle get_class_type() { 00067 return _type_handle; 00068 } 00069 public: 00070 static void init_type() { 00071 MovingPartBase::init_type(); 00072 register_type(_type_handle, SwitchType::get_part_type_name(), 00073 MovingPartBase::get_class_type()); 00074 } 00075 00076 private: 00077 static TypeHandle _type_handle; 00078 }; 00079 00080 #include "movingPart.I" 00081 00082 #endif 00083 00084 00085