15 #include "recorderTable.h"
16 #include "bamReader.h"
17 #include "bamWriter.h"
18 #include "config_recorder.h"
19 #include "recorderController.h"
31 Recorders::iterator ri;
32 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
33 unref_delete(ri->second);
48 Recorders::const_iterator ori;
49 for (ori = other._recorders.begin(); ori != other._recorders.end(); ++ori) {
50 const string &name = (*ori).first;
53 Recorders::iterator ri = _recorders.find(name);
54 if (ri == _recorders.end()) {
58 <<
"No data for " << name <<
" in session.\n";
60 }
else if ((*ri).second->get_type() == recorder->get_type()) {
63 if ((*ri).second != recorder) {
65 unref_delete((*ri).second);
66 (*ri).second = recorder;
70 recorder_cat.warning()
71 <<
"Keeping recorder " << name <<
" of type "
72 << (*ri).second->get_type() <<
" instead of recorder of type "
73 << recorder->get_type() <<
"\n";
79 Recorders::const_iterator ri;
80 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
81 const string &name = (*ri).first;
82 ori = other._recorders.find(name);
83 if (ori == other._recorders.end()) {
84 recorder_cat.warning()
85 <<
"Ignoring " << name <<
" in session.\n";
97 Recorders::iterator ri;
98 for (ri = _recorders.begin();
99 ri != _recorders.end();
113 Recorders::iterator ri;
114 for (ri = _recorders.begin();
115 ri != _recorders.end();
129 Recorders::iterator ri;
130 for (ri = _recorders.begin();
131 ri != _recorders.end();
134 recorder->_flags |= flags;
145 Recorders::iterator ri;
146 for (ri = _recorders.begin();
147 ri != _recorders.end();
150 recorder->_flags &= ~flags;
160 write(ostream &out,
int indent_level)
const {
161 indent(out, indent_level)
162 <<
"RecorderTable:\n";
164 Recorders::const_iterator ri;
165 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
166 const string &name = (*ri).first;
168 indent(out, indent_level + 2)
169 << name <<
" : " << recorder->get_type() <<
"\n";
195 Recorders::const_iterator ri;
196 for (ri = _recorders.begin(); ri != _recorders.end(); ++ri) {
197 const string &name = (*ri).first;
219 parse_params(params, scan, manager);
220 table->fillin(scan, manager);
237 for (
int i = 0; i < num_recorders; i++) {
249 <<
"Unable to create Recorder of type " << type <<
"\n";
255 _recorders.insert(Recorders::value_type(name, recorder)).second;
void add_string(const string &str)
Adds a variable-length string to the datagram.
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.
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 ...
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...
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
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...
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...
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.
This is the base class to a number of objects that record particular kinds of user input (like a Mous...
void clear_flags(short flags)
Clears the given flags on all recorders.
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
void add_uint16(PN_uint16 value)
Adds an unsigned 16-bit integer to the datagram.
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...
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 ...
TypeHandle read_handle(DatagramIterator &scan)
Reads a TypeHandle out of the Datagram.