Panda3D
 All Classes Functions Variables Enumerations
movingPart.h
1 // Filename: movingPart.h
2 // Created by: drose (22Feb99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MOVINGPART_H
16 #define MOVINGPART_H
17 
18 #include "pandabase.h"
19 
20 #include "movingPartBase.h"
21 #include "animChannel.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : MovingPart
25 // Description : This is the template instantiation of MovingPartBase,
26 // on the particular type of value provided by the
27 // channel.
28 ////////////////////////////////////////////////////////////////////
29 template<class SwitchType>
30 class MovingPart : public MovingPartBase {
31 public:
32  typedef TYPENAME SwitchType::ValueType ValueType;
34 
35 protected:
36  INLINE MovingPart(const MovingPart &copy);
37 
38 public:
39  INLINE MovingPart(PartGroup *parent, const string &name,
40  const ValueType &default_value);
41 
42  virtual TypeHandle get_value_type() const;
43  virtual AnimChannelBase *make_default_channel() const;
44  virtual void output_value(ostream &out) const;
45 
46  ValueType _value;
47  ValueType _default_value;
48 
49 public:
50  INLINE virtual void write_datagram(BamWriter* manager, Datagram &me);
51 
52 protected:
53  INLINE MovingPart();
54  INLINE void fillin(DatagramIterator& scan, BamReader* manager);
55 
56 public:
57  virtual TypeHandle get_type() const {
58  return get_class_type();
59  }
60  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
61 PUBLISHED:
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  INLINE ValueType get_value() const {
66  return _value;
67  }
68  INLINE ValueType get_default_value() const {
69  return _default_value;
70  }
71 public:
72  static void init_type() {
73  MovingPartBase::init_type();
74  register_type(_type_handle, SwitchType::get_part_type_name(),
75  MovingPartBase::get_class_type());
76  }
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
82 #include "movingPart.I"
83 
84 #endif
85 
86 
87 
virtual void output_value(ostream &out) const
Outputs a very brief description of the channel&#39;s current value.
Definition: movingPart.I:107
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
This is the template instantiation of MovingPartBase, on the particular type of value provided by the...
Definition: movingPart.h:30
This is the base class for a single animatable piece that may be bound to one channel (or more...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This template class is the parent class for all kinds of AnimChannels that return different values...
Definition: animChannel.h:30
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
Definition: movingPart.I:119
Parent class for all animation channels.
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we are concerned with.
Definition: movingPart.I:80
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
virtual AnimChannelBase * make_default_channel() const
Creates and returns a new AnimChannel that is not part of any hierarchy, but that returns the default...
Definition: movingPart.I:95
This is the base class for PartRoot and MovingPart.
Definition: partGroup.h:45