Panda3D
userVertexSlider.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 userVertexSlider.h
10  * @author drose
11  * @date 2005-03-28
12  */
13 
14 #ifndef USERVERTEXSLIDER_H
15 #define USERVERTEXSLIDER_H
16 
17 #include "pandabase.h"
18 #include "vertexSlider.h"
19 #include "cycleData.h"
20 #include "cycleDataReader.h"
21 #include "cycleDataWriter.h"
22 #include "pipelineCycler.h"
23 
24 class FactoryParams;
25 
26 /**
27  * This is a specialization on VertexSlider that allows the user to specify
28  * any arbitrary slider valie he likes. This is rarely used except for
29  * testing.
30  */
31 class EXPCL_PANDA_GOBJ UserVertexSlider : public VertexSlider {
32 PUBLISHED:
33  explicit UserVertexSlider(const std::string &name);
34  explicit UserVertexSlider(const InternalName *name);
35 
36  INLINE void set_slider(PN_stdfloat slider);
37  virtual PN_stdfloat get_slider() const;
38 
39 private:
40  // This is the data that must be cycled between pipeline stages.
41  class EXPCL_PANDA_GOBJ CData : public CycleData {
42  public:
43  INLINE CData();
44  INLINE CData(const CData &copy);
45  virtual CycleData *make_copy() const;
46  virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
47  virtual void fillin(DatagramIterator &scan, BamReader *manager);
48  virtual TypeHandle get_parent_type() const {
49  return UserVertexSlider::get_class_type();
50  }
51 
52  PN_stdfloat _slider;
53  };
54 
55  PipelineCycler<CData> _cycler;
58 
59 public:
60  static void register_with_read_factory();
61  virtual void write_datagram(BamWriter *manager, Datagram &dg);
62 
63 protected:
64  static TypedWritable *make_from_bam(const FactoryParams &params);
65  void fillin(DatagramIterator &scan, BamReader *manager);
66 
67 public:
68  static TypeHandle get_class_type() {
69  return _type_handle;
70  }
71  static void init_type() {
72  VertexSlider::init_type();
73  register_type(_type_handle, "UserVertexSlider",
74  VertexSlider::get_class_type());
75  }
76  virtual TypeHandle get_type() const {
77  return get_class_type();
78  }
79  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
80 
81 private:
82  static TypeHandle _type_handle;
83 };
84 
85 #include "userVertexSlider.I"
86 
87 #endif
CycleData
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:50
vertexSlider.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleData::get_parent_type
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
Definition: cycleData.cxx:76
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition: datagramIterator.h:27
register_type
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
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
BamWriter
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
InternalName
Encodes a string name in a hash table, mapping it to a pointer.
Definition: internalName.h:38
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
userVertexSlider.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleData::write_datagram
virtual void write_datagram(BamWriter *, Datagram &) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: cycleData.cxx:32
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
CycleDataWriter
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
Definition: cycleDataWriter.h:34
cycleData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleDataReader
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Definition: cycleDataReader.h:35
cycleDataReader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleData::fillin
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
Definition: cycleData.cxx:58
VertexSlider
This is an abstract base class that retains some slider value, which is a linear value that typically...
Definition: vertexSlider.h:37
pipelineCycler.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
UserVertexSlider
This is a specialization on VertexSlider that allows the user to specify any arbitrary slider valie h...
Definition: userVertexSlider.h:31
cycleDataWriter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PipelineCycler< CData >