Panda3D
 All Classes Functions Variables Enumerations
recorderFrame.h
1 // Filename: recorderFrame.h
2 // Created by: drose (28Jan04)
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 RECORDERFRAME_H
16 #define RECORDERFRAME_H
17 
18 #include "pandabase.h"
19 #include "recorderBase.h"
20 #include "typedWritable.h"
21 #include "recorderTable.h"
22 #include "datagram.h"
23 
24 class BamWriter;
25 class BamReader;
26 class FactoryParams;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : RecorderFrame
30 // Description : This object represents one frame of data in the
31 // recorded session file. One of these is repeatedly
32 // created and destructed in recording and playback,
33 // respectively.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDA_RECORDER RecorderFrame : public TypedWritable {
36 public:
37  INLINE RecorderFrame();
38  INLINE RecorderFrame(double timestamp, int frame,
39  bool table_changed, RecorderTable *table);
40  INLINE ~RecorderFrame();
41 
42  void play_frame(BamReader *manager);
43 
44  double _timestamp;
45  int _frame;
46  bool _table_changed;
47  RecorderTable *_table;
48 
49  Datagram _data;
50  size_t _data_pos;
51 
52 private:
53  RecorderTable _local_table;
54 
55 public:
56  static void register_with_read_factory();
57  virtual void write_datagram(BamWriter *manager, Datagram &dg);
58  virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
59 
60 protected:
61  static TypedWritable *make_from_bam(const FactoryParams &params);
62  void fillin(DatagramIterator &scan, BamReader *manager);
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  TypedWritable::init_type();
70  register_type(_type_handle, "RecorderFrame",
71  TypedWritable::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
82 #include "recorderFrame.I"
83 
84 #endif
85 
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This is our own Panda specialization on the default STL list.
Definition: plist.h:38
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.
This object is used by the RecorderController to write (and read) a record of the set of recorders in...
Definition: recorderTable.h:35
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()...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This object represents one frame of data in the recorded session file.
Definition: recorderFrame.h:35
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:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43