Panda3D
movingPart.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file movingPart.h
10  * @author drose
11  * @date 1999-02-22
12  */
13 
14 #ifndef MOVINGPART_H
15 #define MOVINGPART_H
16 
17 #include "pandabase.h"
18 
19 #include "movingPartBase.h"
20 #include "animChannel.h"
21 
22 /**
23  * This is the template instantiation of MovingPartBase, on the particular
24  * type of value provided by the channel.
25  */
26 template<class SwitchType>
27 class MovingPart : public MovingPartBase {
28 public:
29  typedef typename SwitchType::ValueType ValueType;
31 
32 protected:
33  INLINE MovingPart(const MovingPart &copy);
34 
35 public:
36  INLINE MovingPart(PartGroup *parent, const std::string &name,
37  const ValueType &default_value);
38 
39  virtual TypeHandle get_value_type() const;
40  virtual AnimChannelBase *make_default_channel() const;
41  virtual void output_value(std::ostream &out) const;
42 
43  ValueType _value;
44  ValueType _default_value;
45 
46 public:
47  INLINE virtual void write_datagram(BamWriter* manager, Datagram &me);
48 
49 protected:
50  INLINE MovingPart();
51  INLINE void fillin(DatagramIterator& scan, BamReader* manager);
52 
53 public:
54  virtual TypeHandle get_type() const {
55  return get_class_type();
56  }
57  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
58 PUBLISHED:
59  static TypeHandle get_class_type() {
60  return _type_handle;
61  }
62  INLINE ValueType get_value() const {
63  return _value;
64  }
65  INLINE ValueType get_default_value() const {
66  return _default_value;
67  }
68 public:
69  static void init_type() {
70  MovingPartBase::init_type();
71  register_type(_type_handle, SwitchType::get_part_type_name(),
72  MovingPartBase::get_class_type());
73  }
74 
75 private:
76  static TypeHandle _type_handle;
77 };
78 
79 #include "movingPart.I"
80 
81 #endif
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:81
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the template instantiation of MovingPartBase, on the particular type of value provided by the...
Definition: movingPart.h:27
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:63
This template class is the parent class for all kinds of AnimChannels that return different values.
Definition: animChannel.h:28
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
Definition: movingPart.I:100
virtual void output_value(std::ostream &out) const
Outputs a very brief description of the channel's current value.
Definition: movingPart.I:90
Parent class for all animation channels.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we are concerned with.
Definition: movingPart.I:69
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
This is the base class for PartRoot and MovingPart.
Definition: partGroup.h:43