Panda3D
vertexSlider.cxx
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 vertexSlider.cxx
10  * @author drose
11  * @date 2005-03-28
12  */
13 
14 #include "vertexSlider.h"
15 #include "vertexTransform.h"
16 #include "bamReader.h"
17 #include "bamWriter.h"
18 #include "indent.h"
19 #include "sliderTable.h"
20 
21 TypeHandle VertexSlider::_type_handle;
22 
23 /**
24  *
25  */
26 VertexSlider::
27 VertexSlider(const InternalName *name) : _name(name) {
28 }
29 
30 /**
31  *
32  */
33 VertexSlider::
34 ~VertexSlider() {
35  // We shouldn't destruct while any SliderTables are holding our pointer.
36  nassertv(_tables.empty());
37 }
38 
39 /**
40  *
41  */
42 void VertexSlider::
43 output(std::ostream &out) const {
44  out << get_type() << " " << *get_name();
45 }
46 
47 /**
48  *
49  */
50 void VertexSlider::
51 write(std::ostream &out, int indent_level) const {
52  indent(out, indent_level)
53  << *this << " = " << get_slider() << "\n";
54 }
55 
56 /**
57  * Intended to be called by a derived class whenever the reported transform
58  * might have changed. Without calling this method, changes to get_slider()
59  * may not be propagated through the system.
60  */
61 void VertexSlider::
62 mark_modified(Thread *current_thread) {
63  CDWriter cdata(_cycler, true, current_thread);
64  cdata->_modified = VertexTransform::get_next_modified(current_thread);
65 
66  Tables::iterator ti;
67  for (ti = _tables.begin(); ti != _tables.end(); ++ti) {
68  (*ti)->update_modified(cdata->_modified, current_thread);
69  }
70 }
71 
72 /**
73  * Writes the contents of this object to the datagram for shipping out to a
74  * Bam file.
75  */
76 void VertexSlider::
78  TypedWritable::write_datagram(manager, dg);
79 }
80 
81 /**
82  * This internal function is called by make_from_bam to read in all of the
83  * relevant data from the BamFile for the new VertexSlider.
84  */
85 void VertexSlider::
86 fillin(DatagramIterator &scan, BamReader *manager) {
87  TypedWritable::fillin(scan, manager);
88 }
89 
90 /**
91  *
92  */
93 CycleData *VertexSlider::CData::
94 make_copy() const {
95  return new CData(*this);
96 }
97 
98 /**
99  * Writes the contents of this object to the datagram for shipping out to a
100  * Bam file.
101  */
102 void VertexSlider::CData::
103 write_datagram(BamWriter *manager, Datagram &dg) const {
104 }
105 
106 /**
107  * Receives an array of pointers, one for each time manager->read_pointer()
108  * was called in fillin(). Returns the number of pointers processed.
109  */
110 int VertexSlider::CData::
111 complete_pointers(TypedWritable **p_list, BamReader *manager) {
112  int pi = CycleData::complete_pointers(p_list, manager);
113 
114  return pi;
115 }
116 
117 /**
118  * This internal function is called by make_from_bam to read in all of the
119  * relevant data from the BamFile for the new VertexSlider.
120  */
121 void VertexSlider::CData::
122 fillin(DatagramIterator &scan, BamReader *manager) {
123 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
get_name
Returns the name of this particular slider.
Definition: vertexSlider.h:43
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:47
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
static UpdateSeq get_next_modified(Thread *current_thread)
Returns a monotonically increasing sequence.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
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...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
Definition: cycleData.cxx:48
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encodes a string name in a hash table, mapping it to a pointer.
Definition: internalName.h:38
A thread; that is, a lightweight process.
Definition: thread.h:46
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.