Panda3D
 All Classes Functions Variables Enumerations
userVertexSlider.h
1 // Filename: userVertexSlider.h
2 // Created by: drose (28Mar05)
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 USERVERTEXSLIDER_H
16 #define USERVERTEXSLIDER_H
17 
18 #include "pandabase.h"
19 #include "vertexSlider.h"
20 #include "cycleData.h"
21 #include "cycleDataReader.h"
22 #include "cycleDataWriter.h"
23 #include "pipelineCycler.h"
24 
25 class FactoryParams;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : UserVertexSlider
29 // Description : This is a specialization on VertexSlider that
30 // allows the user to specify any arbitrary slider
31 // valie he likes. This is rarely used except for
32 // testing.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_GOBJ UserVertexSlider : public VertexSlider {
35 PUBLISHED:
36  UserVertexSlider(const string &name);
37  UserVertexSlider(const InternalName *name);
38 
39  INLINE void set_slider(PN_stdfloat slider);
40  virtual PN_stdfloat get_slider() const;
41 
42 private:
43  // This is the data that must be cycled between pipeline stages.
44  class EXPCL_PANDA_GOBJ CData : public CycleData {
45  public:
46  INLINE CData();
47  INLINE CData(const CData &copy);
48  virtual CycleData *make_copy() const;
49  virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
50  virtual void fillin(DatagramIterator &scan, BamReader *manager);
51  virtual TypeHandle get_parent_type() const {
52  return UserVertexSlider::get_class_type();
53  }
54 
55  PN_stdfloat _slider;
56  };
57 
58  PipelineCycler<CData> _cycler;
61 
62 public:
63  static void register_with_read_factory();
64  virtual void write_datagram(BamWriter *manager, Datagram &dg);
65 
66 protected:
67  static TypedWritable *make_from_bam(const FactoryParams &params);
68  void fillin(DatagramIterator &scan, BamReader *manager);
69 
70 public:
71  static TypeHandle get_class_type() {
72  return _type_handle;
73  }
74  static void init_type() {
75  VertexSlider::init_type();
76  register_type(_type_handle, "UserVertexSlider",
77  VertexSlider::get_class_type());
78  }
79  virtual TypeHandle get_type() const {
80  return get_class_type();
81  }
82  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
83 
84 private:
85  static TypeHandle _type_handle;
86 };
87 
88 #include "userVertexSlider.I"
89 
90 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
This is a specialization on VertexSlider that allows the user to specify any arbitrary slider valie h...
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:50
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is an abstract base class that retains some slider value, which is a linear value that typically...
Definition: vertexSlider.h:41
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 calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class&#39;s make_from_bam() method to read in all...
Definition: cycleData.cxx:68
A class to retrieve the individual data elements previously stored in a 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:34
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