Panda3D
recorderHeader.h
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 recorderHeader.h
10  * @author drose
11  * @date 2004-01-29
12  */
13 
14 #ifndef RECORDERHEADER_H
15 #define RECORDERHEADER_H
16 
17 #include "pandabase.h"
18 #include "recorderBase.h"
19 #include "typedWritable.h"
20 
21 #include <time.h>
22 
23 class BamWriter;
24 class BamReader;
25 class FactoryParams;
26 
27 /**
28  * This object contains the header information written out at the beginning of
29  * a recorded session file.
30  */
31 class EXPCL_PANDA_RECORDER RecorderHeader : public TypedWritable {
32 public:
33  INLINE RecorderHeader();
34  INLINE RecorderHeader(const RecorderHeader &copy);
35  INLINE void operator = (const RecorderHeader &copy);
36  INLINE ~RecorderHeader();
37 
38  time_t _start_time;
39  int _random_seed;
40 
41 public:
42  static void register_with_read_factory();
43  virtual void write_datagram(BamWriter *manager, Datagram &dg);
44 
45 protected:
46  static TypedWritable *make_from_bam(const FactoryParams &params);
47  void fillin(DatagramIterator &scan, BamReader *manager);
48 
49 public:
50  static TypeHandle get_class_type() {
51  return _type_handle;
52  }
53  static void init_type() {
54  TypedWritable::init_type();
55  register_type(_type_handle, "RecorderHeader",
56  TypedWritable::get_class_type());
57  }
58  virtual TypeHandle get_type() const {
59  return get_class_type();
60  }
61  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
62 
63 private:
64  static TypeHandle _type_handle;
65 };
66 
67 #include "recorderHeader.I"
68 
69 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
This object contains the header information written out at the beginning of a recorded session file.
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