Panda3D
typedWritable.I
1 // Filename: typedWritable.I
2 // Created by: jason (08Jun00)
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 ////////////////////////////////////////////////////////////////////
16 // Function: TypedWritable::Constructor
17 // Access: Public
18 // Description:
19 ////////////////////////////////////////////////////////////////////
20 INLINE TypedWritable::
21 TypedWritable() : _bam_writers(NULL) {
22 }
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function: TypedWritable::Copy Constructor
26 // Access: Public
27 // Description:
28 ////////////////////////////////////////////////////////////////////
29 INLINE TypedWritable::
30 TypedWritable(const TypedWritable &) : _bam_writers(NULL) {
31 }
32 
33 ////////////////////////////////////////////////////////////////////
34 // Function: TypedWritable::Copy Assignment Operator
35 // Access: Public
36 // Description:
37 ////////////////////////////////////////////////////////////////////
38 INLINE void TypedWritable::
39 operator = (const TypedWritable &) {
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: TypedWritable::mark_bam_modified
44 // Access: Public
45 // Description: Increments the bam_modified counter, so that this
46 // object will be invalidated and retransmitted on any
47 // open bam streams. This should normally not need to
48 // be called by user code; it should be called
49 // internally when the object has been changed in a way
50 // that legitimately requires its retransmission to any
51 // connected clients.
52 ////////////////////////////////////////////////////////////////////
53 INLINE void TypedWritable::
55  ++_bam_modified;
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: TypedWritable::get_bam_modified
60 // Access: Public
61 // Description: Returns the current bam_modified counter. This
62 // counter is normally incremented automatically
63 // whenever the object is modified.
64 ////////////////////////////////////////////////////////////////////
67  return _bam_modified;
68 }
69 
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: TypedWritable::encode_to_bam_stream
73 // Access: Published
74 // Description: Converts the TypedWritable object into a single
75 // stream of data using a BamWriter, and returns that
76 // data as a string string. Returns empty string on
77 // failure.
78 //
79 // This is a convenience method particularly useful for
80 // cases when you are only serializing a single object.
81 // If you have many objects to process, it is more
82 // efficient to use the same BamWriter to serialize all
83 // of them together.
84 ////////////////////////////////////////////////////////////////////
85 INLINE string TypedWritable::
87  string data;
88  if (!encode_to_bam_stream(data)) {
89  return string();
90  }
91  return data;
92 }
93 
UpdateSeq get_bam_modified() const
Returns the current bam_modified counter.
Definition: typedWritable.I:66
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
string 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:86
This is a sequence number that increments monotonically.
Definition: updateSeq.h:43
void mark_bam_modified()
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any...
Definition: typedWritable.I:54