30 Recorders::iterator ri;
31 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
43 Recorders::const_iterator ori;
44 for (ori = other._recorders.begin(); ori != other._recorders.end(); ++ori) {
45 const string &name = (*ori).first;
48 Recorders::iterator ri = _recorders.find(name);
49 if (ri == _recorders.end()) {
53 <<
"No data for " << name <<
" in session.\n";
55 }
else if ((*ri).second->get_type() == recorder->get_type()) {
58 if ((*ri).second != recorder) {
61 (*ri).second = recorder;
65 recorder_cat.warning()
66 <<
"Keeping recorder " << name <<
" of type " 67 << (*ri).second->get_type() <<
" instead of recorder of type " 68 << recorder->get_type() <<
"\n";
74 Recorders::const_iterator ri;
75 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
76 const string &name = (*ri).first;
77 ori = other._recorders.find(name);
78 if (ori == other._recorders.end()) {
79 recorder_cat.warning()
80 <<
"Ignoring " << name <<
" in session.\n";
90 Recorders::iterator ri;
91 for (ri = _recorders.begin();
92 ri != _recorders.end();
104 Recorders::iterator ri;
105 for (ri = _recorders.begin();
106 ri != _recorders.end();
118 Recorders::iterator ri;
119 for (ri = _recorders.begin();
120 ri != _recorders.end();
123 recorder->_flags |= flags;
132 Recorders::iterator ri;
133 for (ri = _recorders.begin();
134 ri != _recorders.end();
137 recorder->_flags &= ~flags;
145 write(std::ostream &out,
int indent_level)
const {
147 <<
"RecorderTable:\n";
149 Recorders::const_iterator ri;
150 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
151 const string &name = (*ri).first;
153 indent(out, indent_level + 2)
154 << name <<
" : " << recorder->get_type() <<
"\n";
175 Recorders::const_iterator ri;
176 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
177 const string &name = (*ri).first;
197 table->fillin(scan, manager);
211 for (
int i = 0; i < num_recorders; i++) {
221 if (recorder ==
nullptr) {
223 <<
"Unable to create Recorder of type " << type <<
"\n";
229 _recorders.insert(Recorders::value_type(name, recorder)).second;
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...
virtual void play_frame(DatagramIterator &scan, BamReader *manager)
Reloads the most recent data collected from the indicated datagram.
Type * make_instance_more_general(TypeHandle handle, const FactoryParams ¶ms=FactoryParams())
Attempts to create an instance of the type requested, or some base type of the type requested.
static RecorderFactory * get_factory()
Returns the global RecorderFactory for generating TypedWritable objects.
void record_frame(BamWriter *manager, Datagram &dg)
Calls record_frame on all recorders.
Base class for objects that can be written to and read from Bam files.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Lens.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void play_frame(DatagramIterator &scan, BamReader *manager)
Calls play_frame on all recorders.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
std::string get_string()
Extracts a variable-length string.
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.
void write_handle(Datagram &packet, TypeHandle type)
Writes a TypeHandle to the file in such a way that the BamReader can read the same TypeHandle later v...
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
virtual void record_frame(BamWriter *manager, Datagram &dg)
Records the most recent data collected into the indicated datagram.
This object is used by the RecorderController to write (and read) a record of the set of recorders in...
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
This is the base class to a number of objects that record particular kinds of user input (like a Mous...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void clear_flags(short flags)
Clears the given flags on all recorders.
virtual void write_recorder(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for encoding in the session file.
void merge_from(const RecorderTable &other)
Combines the data in the current table (presumably just read from disk, and matching exactly with the...
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
The parameters that are passed through the Factory to any object constructing itself from a Bam file.
void set_flags(short flags)
Sets the given flags on all recorders.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle read_handle(DatagramIterator &scan)
Reads a TypeHandle out of the Datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.