Panda3D
Loading...
Searching...
No Matches
socketStreamRecorder.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 socketStreamRecorder.I
10 * @author drose
11 * @date 2004-01-28
12 */
13
14/**
15 *
16 */
17INLINE SocketStreamRecorder::
18SocketStreamRecorder() :
19 _stream(nullptr),
20 _owns_stream(false),
21 _closed(true)
22{
23}
24
25/**
26 *
27 */
28INLINE SocketStreamRecorder::
29SocketStreamRecorder(SocketStream *stream, bool owns_stream) :
30 _stream(stream),
31 _owns_stream(owns_stream),
32 _closed(false)
33{
34}
35
36/**
37 *
38 */
39INLINE SocketStreamRecorder::
40~SocketStreamRecorder() {
41 if (_owns_stream) {
42 delete _stream;
43 }
44}
45
46/**
47 * See SocketStream::send_datagram().
48 */
49bool SocketStreamRecorder::
50send_datagram(const Datagram &dg) {
51 if (_stream != nullptr) {
52 return _stream->send_datagram(dg);
53 }
54 return true;
55}
56
57/**
58 * See SocketStream::is_closed().
59 */
60INLINE bool SocketStreamRecorder::
61is_closed() {
62 if (_stream != nullptr) {
63 return _stream->is_closed();
64 }
65 return is_playing() && _closed;
66}
67
68/**
69 * See SocketStream::close().
70 */
71INLINE void SocketStreamRecorder::
72close() {
73 if (_stream != nullptr) {
74 _stream->close();
75 }
76 _closed = true;
77}
78
79/**
80 * See SocketStream::set_collect_tcp().
81 */
82INLINE void SocketStreamRecorder::
83set_collect_tcp(bool collect_tcp) {
84 if (_stream != nullptr) {
85 _stream->set_collect_tcp(collect_tcp);
86 }
87}
88
89/**
90 * See SocketStream::get_collect_tcp().
91 */
92INLINE bool SocketStreamRecorder::
93get_collect_tcp() const {
94 if (_stream != nullptr) {
95 return _stream->get_collect_tcp();
96 }
97 return false;
98}
99
100/**
101 * See SocketStream::set_collect_tcp_interval().
102 */
103INLINE void SocketStreamRecorder::
104set_collect_tcp_interval(double interval) {
105 if (_stream != nullptr) {
106 _stream->set_collect_tcp_interval(interval);
107 }
108}
109
110/**
111 * See SocketStream::get_collect_tcp_interval().
112 */
113INLINE double SocketStreamRecorder::
114get_collect_tcp_interval() const {
115 if (_stream != nullptr) {
116 return _stream->get_collect_tcp_interval();
117 }
118 return 0.0;
119}
120
121/**
122 * See SocketStream::consider_flush()
123 */
124INLINE bool SocketStreamRecorder::
125consider_flush() {
126 if (_stream != nullptr) {
127 return _stream->consider_flush();
128 }
129 return true;
130}
131
132/**
133 * See SocketStream::flush()
134 */
135INLINE bool SocketStreamRecorder::
136flush() {
137 if (_stream != nullptr) {
138 return _stream->flush();
139 }
140 return true;
141}
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38