Panda3D
|
00001 // Filename: recorderFrame.h 00002 // Created by: drose (28Jan04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef RECORDERFRAME_H 00016 #define RECORDERFRAME_H 00017 00018 #include "pandabase.h" 00019 #include "recorderBase.h" 00020 #include "typedWritable.h" 00021 #include "recorderTable.h" 00022 #include "datagram.h" 00023 00024 class BamWriter; 00025 class BamReader; 00026 class FactoryParams; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : RecorderFrame 00030 // Description : This object represents one frame of data in the 00031 // recorded session file. One of these is repeatedly 00032 // created and destructed in recording and playback, 00033 // respectively. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA_RECORDER RecorderFrame : public TypedWritable { 00036 public: 00037 INLINE RecorderFrame(); 00038 INLINE RecorderFrame(double timestamp, int frame, 00039 bool table_changed, RecorderTable *table); 00040 INLINE ~RecorderFrame(); 00041 00042 void play_frame(BamReader *manager); 00043 00044 double _timestamp; 00045 int _frame; 00046 bool _table_changed; 00047 RecorderTable *_table; 00048 00049 Datagram _data; 00050 size_t _data_pos; 00051 00052 private: 00053 RecorderTable _local_table; 00054 00055 public: 00056 static void register_with_read_factory(); 00057 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00058 virtual int complete_pointers(TypedWritable **plist, BamReader *manager); 00059 00060 protected: 00061 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00062 void fillin(DatagramIterator &scan, BamReader *manager); 00063 00064 public: 00065 static TypeHandle get_class_type() { 00066 return _type_handle; 00067 } 00068 static void init_type() { 00069 TypedWritable::init_type(); 00070 register_type(_type_handle, "RecorderFrame", 00071 TypedWritable::get_class_type()); 00072 } 00073 virtual TypeHandle get_type() const { 00074 return get_class_type(); 00075 } 00076 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00077 00078 private: 00079 static TypeHandle _type_handle; 00080 }; 00081 00082 #include "recorderFrame.I" 00083 00084 #endif 00085