Panda3D
typedWritable.I
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 typedWritable.I
10  * @author jason
11  * @date 2000-06-08
12  */
13 
14 /**
15  *
16  */
17 INLINE TypedWritable::
18 TypedWritable() : _bam_writers(nullptr) {
19 }
20 
21 /**
22  *
23  */
24 INLINE TypedWritable::
25 TypedWritable(const TypedWritable &) : _bam_writers(nullptr) {
26 }
27 
28 /**
29  *
30  */
31 INLINE void TypedWritable::
32 operator = (const TypedWritable &) {
33 }
34 
35 /**
36  * Increments the bam_modified counter, so that this object will be
37  * invalidated and retransmitted on any open bam streams. This should
38  * normally not need to be called by user code; it should be called internally
39  * when the object has been changed in a way that legitimately requires its
40  * retransmission to any connected clients.
41  */
42 INLINE void TypedWritable::
44  ++_bam_modified;
45 }
46 
47 /**
48  * Returns the current bam_modified counter. This counter is normally
49  * incremented automatically whenever the object is modified.
50  */
53  return _bam_modified;
54 }
55 
56 /**
57  * Converts the TypedWritable object into a single stream of data using a
58  * BamWriter, and returns that data as a bytes object. Returns an empty bytes
59  * object on failure.
60  *
61  * This is a convenience method particularly useful for cases when you are
62  * only serializing a single object. If you have many objects to process, it
63  * is more efficient to use the same BamWriter to serialize all of them
64  * together.
65  */
66 INLINE vector_uchar TypedWritable::
68  vector_uchar data;
69  if (!encode_to_bam_stream(data)) {
70  data.clear();
71  }
72  return data;
73 }
vector_uchar encode_to_bam_stream() const
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that da...
Definition: typedWritable.I:67
UpdateSeq get_bam_modified() const
Returns the current bam_modified counter.
Definition: typedWritable.I:52
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
This is a sequence number that increments monotonically.
Definition: updateSeq.h:37
void mark_bam_modified()
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any...
Definition: typedWritable.I:43