GCC Code Coverage Report


Directory: src/gate/
File: src/gate/cxx_streams.cpp
Date: 2026-08-06 22:46:24
Exec Total Coverage
Lines: 466 529 88.1%
Functions: 136 153 88.9%
Branches: 113 286 39.5%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright (c) 2018-2026, Stefan Meislinger <sm@opengate.at> |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28
29 #include "gate/streams.hpp"
30 #include "gate/memalloc.hpp"
31 #include "gate/results.hpp"
32 #include "gate/exceptions.hpp"
33 #include "gate/synchronization.h"
34
35 namespace gate
36 {
37
38 2 IStream::~IStream()
39 {
40
41 2 }
42
43 2 IStreamBuilder::~IStreamBuilder()
44 {
45 2 }
46
47
48 1 result_t IStreamBuilder::stream_read(void* this_ptr, char* buffer, gate_size_t bufferlength, gate_size_t* returned)
49 {
50 1 cpp_object* obj = static_cast<cpp_object*>(this_ptr);
51
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 IStreamBuilder* builder = static_cast<IStreamBuilder*>(obj->parent);
52
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ExceptionInfo xcptInfo;
53
3/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
1 GATEXX_TRY_CATCHINFO(xcptInfo, {
54 size_t bytes_returned = builder->read(buffer, bufferlength);
55 if (returned)
56 {
57 *returned = bytes_returned;
58 }
59 });
60 1 return xcptInfo.result_code;
61 }
62 1 result_t IStreamBuilder::stream_peek(void* this_ptr, char* buffer, gate_size_t bufferlength, gate_size_t* returned)
63 {
64 1 cpp_object* obj = static_cast<cpp_object*>(this_ptr);
65
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 IStreamBuilder* builder = static_cast<IStreamBuilder*>(obj->parent);
66
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ExceptionInfo xcptInfo;
67
3/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
1 GATEXX_TRY_CATCHINFO(xcptInfo, {
68 size_t bytes_returned = builder->peek(buffer, bufferlength);
69 if (returned)
70 {
71 *returned = bytes_returned;
72 }
73 });
74 1 return xcptInfo.result_code;
75 }
76 1 result_t IStreamBuilder::stream_write(void* this_ptr, char const* buffer, gate_size_t bufferlength, gate_size_t* written)
77 {
78 1 cpp_object* obj = static_cast<cpp_object*>(this_ptr);
79
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 IStreamBuilder* builder = static_cast<IStreamBuilder*>(obj->parent);
80
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ExceptionInfo xcptInfo;
81
3/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
1 GATEXX_TRY_CATCHINFO(xcptInfo, {
82 size_t bytes_written = builder->write(buffer, bufferlength);
83 if (written)
84 {
85 *written = bytes_written;
86 }
87 });
88 1 return xcptInfo.result_code;
89 }
90 1 result_t IStreamBuilder::stream_flush(void* this_ptr)
91 {
92 1 cpp_object* obj = static_cast<cpp_object*>(this_ptr);
93
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 IStreamBuilder* builder = static_cast<IStreamBuilder*>(obj->parent);
94
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 ExceptionInfo xcptInfo;
95
2/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
1 GATEXX_TRY_CATCHINFO(xcptInfo, {
96 builder->flush();
97 });
98 1 return xcptInfo.result_code;
99 }
100
101 1 IStreamBuilder::VtblStream::VtblStream()
102 {
103 1 GATE_INTERFACE_VTBL(gate_stream)* this_ptr = reinterpret_cast<GATE_INTERFACE_VTBL(gate_stream)*>(this);
104 1 this_ptr->read = &IStreamBuilder::stream_read;
105 1 this_ptr->peek = &IStreamBuilder::stream_peek;
106 1 this_ptr->write = &IStreamBuilder::stream_write;
107 1 this_ptr->flush = &IStreamBuilder::stream_flush;
108 1 }
109
110 1 IStreamBuilder::VtblStream* IStreamBuilder::getVtblStream()
111 {
112
3/8
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
1 static IStreamBuilder::VtblStream cpp_vtbl_stream;
113 1 return &cpp_vtbl_stream;
114 }
115
116 IStreamBuilder::IStreamBuilder(GATE_INTERFACE_VTBL(gate_stream) const* vtbl_ptr, char const* name)
117 : object_builder_t(vtbl_ptr, name)
118 {
119 }
120
121 1 IStreamBuilder::IStreamBuilder()
122
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 : object_builder_t(IStreamBuilder::getVtblStream(), GATE_INTERFACE_NAME_STREAM)
123 {
124 1 }
125
126
127
128
129
130 enumint_t const Stream::Open_Read = GATE_STREAM_OPEN_READ;
131 enumint_t const Stream::Open_Write = GATE_STREAM_OPEN_WRITE;
132 enumint_t const Stream::Open_ReadWrite = GATE_STREAM_OPEN_READWRITE;
133 enumint_t const Stream::Open_Append = GATE_STREAM_OPEN_APPEND;
134 enumint_t const Stream::Open_AppendWrite = GATE_STREAM_OPEN_APPENDWRITE;
135 enumint_t const Stream::Open_AppendReadWrite = GATE_STREAM_OPEN_APPENDREADWRITE;
136
137
138 /////////////////////////////
139 // Stream implementation //
140 /////////////////////////////
141
142 307 Stream::Stream(gate_stream_t* strm)
143 307 : object_impl_t(strm)
144 {
145
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 307 times.
307 if (this->impl_ptr == NULL)
146 {
147 GATEXX_RAISE_ERROR(results::NullPointer);
148 }
149 307 }
150 22 Stream::Stream(Stream const& src) noexcept
151 22 : object_impl_t(src)
152 {
153
154 22 }
155
156 1 Result<size_t> Stream::tryRead(char* buffer, size_t bufferlen) noexcept
157 {
158 1 size_t ret = 0;
159 1 result_t result = gate_stream_read(this->impl_ptr, buffer, bufferlen, &ret);
160 1 return makeResult(result, ret);
161 }
162 500 Result<size_t> Stream::tryPeek(char* buffer, size_t bufferlen) noexcept
163 {
164 500 size_t ret = 0;
165 500 result_t result = gate_stream_peek(this->impl_ptr, buffer, bufferlen, &ret);
166 500 return makeResult(result, ret);
167 }
168 4 Result<size_t> Stream::tryWrite(char const* buffer, size_t bufferlen) noexcept
169 {
170 4 size_t ret = 0;
171 4 result_t result = gate_stream_write(this->impl_ptr, buffer, bufferlen, &ret);
172 4 return makeResult(result, ret);
173 }
174 4 Result<Void> Stream::tryFlush() noexcept
175 {
176 4 result_t result = gate_stream_flush(this->impl_ptr);
177 4 return makeResult(result);
178 }
179 5 Result<size_t> Stream::tryReadBlock(char* buffer, size_t bufferlen) noexcept
180 {
181 size_t ret;
182 5 result_t result = gate_stream_read_block(this->impl_ptr, buffer, bufferlen, &ret);
183 5 return makeResult(result, ret);
184 }
185 60004 Result<size_t> Stream::tryWriteBlock(char const* buffer, size_t bufferlen) noexcept
186 {
187 size_t ret;
188 60004 result_t result = gate_stream_write_block(this->impl_ptr, buffer, bufferlen, &ret);
189 60004 return makeResult(result, ret);
190 }
191
192
193
194 46 size_t Stream::read(char* buffer, size_t bufferlen)
195 {
196 46 size_t ret = 0;
197
1/2
✓ Branch 1 taken 46 times.
✗ Branch 2 not taken.
46 result_t result = gate_stream_read(this->impl_ptr, buffer, bufferlen, &ret);
198
3/4
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 41 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
46 GATEXX_CHECK_EXCEPTION(result);
199 41 return ret;
200 }
201 510 size_t Stream::peek(char* buffer, size_t bufferlen)
202 {
203 510 size_t ret = 0;
204
1/2
✓ Branch 1 taken 510 times.
✗ Branch 2 not taken.
510 result_t result = gate_stream_peek(this->impl_ptr, buffer, bufferlen, &ret);
205
3/4
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 503 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
510 GATEXX_CHECK_EXCEPTION(result);
206 503 return ret;
207 }
208 10 size_t Stream::write(char const* buffer, size_t bufferlen)
209 {
210 10 size_t ret = 0;
211
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 result_t result = gate_stream_write(this->impl_ptr, buffer, bufferlen, &ret);
212
3/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
10 GATEXX_CHECK_EXCEPTION(result);
213 6 return ret;
214 }
215 523 void Stream::flush()
216 {
217 523 result_t result = gate_stream_flush(this->impl_ptr);
218
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 519 times.
523 GATEXX_CHECK_EXCEPTION(result);
219 519 }
220
221 505 size_t Stream::readBlock(char* buffer, size_t bufferlen)
222 {
223 505 size_t ret = 0;
224
1/2
✓ Branch 1 taken 505 times.
✗ Branch 2 not taken.
505 result_t result = gate_stream_read_block(this->impl_ptr, buffer, bufferlen, &ret);
225
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 504 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
505 GATEXX_CHECK_EXCEPTION(result);
226 504 return ret;
227 }
228 517 size_t Stream::writeBlock(char const* buffer, size_t bufferlen)
229 {
230 517 size_t ret = 0;
231
1/2
✓ Branch 1 taken 517 times.
✗ Branch 2 not taken.
517 result_t result = gate_stream_write_block(this->impl_ptr, buffer, bufferlen, &ret);
232
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 517 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
517 GATEXX_CHECK_EXCEPTION(result);
233 517 return ret;
234 }
235
236 4 void Stream::transfer(Stream& src, Stream& dst)
237 {
238 4 result_t result = gate_stream_transfer(src.impl_ptr, dst.impl_ptr);
239
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATEXX_CHECK_EXCEPTION(result);
240 4 }
241 1 void Stream::transfer(gate_stream_t& src, gate_stream_t& dst)
242 {
243 1 result_t result = gate_stream_transfer(&src, &dst);
244
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_EXCEPTION(result);
245 1 }
246
247 1 Result<Void> Stream::tryTransfer(Stream& src, Stream& dst)
248 {
249
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_stream_transfer(src.impl_ptr, dst.impl_ptr);
250
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return makeResult(result);
251 }
252 1 Result<Void> Stream::tryTransfer(gate_stream_t& src, gate_stream_t& dst)
253 {
254
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_stream_transfer(&src, &dst);
255
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return makeResult(result);
256 }
257
258 8 void Stream::transferViaBuffer(Stream& src, Stream& dst, char* buffer, size_t buffersize)
259 {
260 8 result_t result = gate_stream_transfer_buffer(src.impl_ptr, dst.impl_ptr, buffer, buffersize);
261
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATEXX_CHECK_EXCEPTION(result);
262 8 }
263 1 void Stream::transferViaBuffer(gate_stream_t& src, gate_stream_t& dst, char* buffer, size_t buffersize)
264 {
265 1 result_t result = gate_stream_transfer_buffer(&src, &dst, buffer, buffersize);
266
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_EXCEPTION(result);
267 1 }
268
269 1 Result<Void> Stream::tryTransferViaBuffer(Stream& src, Stream& dst, char* buffer, size_t buffersize)
270 {
271
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_stream_transfer_buffer(src.impl_ptr, dst.impl_ptr, buffer, buffersize);
272
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return makeResult(result);
273 }
274 1 Result<Void> Stream::tryTransferViaBuffer(gate_stream_t& src, gate_stream_t& dst, char* buffer, size_t buffersize)
275 {
276
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_stream_transfer_buffer(&src, &dst, buffer, buffersize);
277
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return makeResult(result);
278 }
279
280
281
282 1 uint64_t Stream::transferLimit(Stream& src, uint64_t limit, Stream& dst)
283 {
284 1 gate_stream_t& srcStream = *src.impl_ptr;
285 1 gate_stream_t& dstStream = *dst.impl_ptr;
286 1 return Stream::transferLimit(srcStream, limit, dstStream);
287 }
288 1 uint64_t Stream::transferLimit(gate_stream_t& src, uint64_t limit, gate_stream_t& dst)
289 {
290 1 uint64_t ret = 0;
291
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_stream_transfer_limit(&src, limit, &dst, &ret);
292
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_EXCEPTION(result);
293 1 return ret;
294 }
295
296 1 Result<uint64_t> Stream::tryTransferLimit(Stream& src, uint64_t limit, Stream& dst)
297 {
298 1 gate_stream_t& srcStream = *src.impl_ptr;
299 1 gate_stream_t& dstStream = *dst.impl_ptr;
300 1 return Stream::tryTransferLimit(srcStream, limit, dstStream);
301 }
302 1 Result<uint64_t> Stream::tryTransferLimit(gate_stream_t& src, uint64_t limit, gate_stream_t& dst)
303 {
304 1 uint64_t ret = 0;
305
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_stream_transfer_limit(&src, limit, &dst, &ret);
306
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return makeResult(result, ret);
307 }
308
309 1 uint64_t Stream::skip(Stream& src, uint64_t count)
310 {
311 1 uint64_t ret = 0;
312
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_stream_skip(src.impl_ptr, count, &ret);
313
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_EXCEPTION(result);
314 1 return ret;
315 }
316 uint64_t Stream::skip(gate_stream_t& src, uint64_t count)
317 {
318 uint64_t ret = 0;
319 result_t result = gate_stream_skip(&src, count, &ret);
320 GATEXX_CHECK_EXCEPTION(result);
321 return ret;
322 }
323
324 Result<uint64_t> Stream::trySkip(Stream& src, uint64_t count)
325 {
326 uint64_t ret = 0;
327 result_t result = gate_stream_skip(src.impl_ptr, count, &ret);
328 return makeResult(result, ret);
329 }
330 Result<uint64_t> Stream::trySkip(gate_stream_t& src, uint64_t count)
331 {
332 uint64_t ret = 0;
333 result_t result = gate_stream_skip(&src, count, &ret);
334 return makeResult(result, ret);
335 }
336
337
338
339 1164 void Stream::print(char const* buffer, size_t bufferlen)
340 {
341 1164 size_t ret = 0;
342
1/2
✓ Branch 1 taken 1164 times.
✗ Branch 2 not taken.
1164 result_t result = gate_stream_write_block(this->impl_ptr, buffer, bufferlen, &ret);
343
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1164 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1164 GATEXX_CHECK_EXCEPTION(result);
344 1164 }
345 14 void Stream::print(int32_t num)
346 {
347 14 result_t result = gate_stream_print_int(this->impl_ptr, num);
348
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
14 GATEXX_CHECK_EXCEPTION(result);
349 13 }
350 9 void Stream::print(uint32_t num)
351 {
352 9 result_t result = gate_stream_print_uint(this->impl_ptr, num);
353
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 GATEXX_CHECK_EXCEPTION(result);
354 9 }
355 5 void Stream::print(int64_t num)
356 {
357 5 result_t result = gate_stream_print_int64(this->impl_ptr, num);
358
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 GATEXX_CHECK_EXCEPTION(result);
359 5 }
360 5 void Stream::print(uint64_t num)
361 {
362 5 result_t result = gate_stream_print_uint64(this->impl_ptr, num);
363
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 GATEXX_CHECK_EXCEPTION(result);
364 5 }
365 10 void Stream::print(real64_t num, unsigned intlen, unsigned decimallen, unsigned grouplen)
366 {
367 10 result_t result = gate_stream_print_real(this->impl_ptr, num, intlen, decimallen, grouplen);
368
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 GATEXX_CHECK_EXCEPTION(result);
369 10 }
370 void Stream::println(String const& str)
371 {
372 this->print(str.c_str(), str.length());
373 gate_stream_println_cstr(this->impl_ptr, NULL);
374 }
375 1007 void Stream::println(char const* str)
376 {
377 1007 this->print(str, gate_str_length(str));
378 1007 gate_stream_println_cstr(this->impl_ptr, NULL);
379 1007 }
380 5 void Stream::println(char const* buffer, size_t bufferlen)
381 {
382 5 this->print(buffer, bufferlen);
383 5 gate_stream_println_cstr(this->impl_ptr, NULL);
384 5 }
385
386 1 size_t Stream::scan(int32_t& num)
387 {
388 1 return gate_stream_scan_int(this->impl_ptr, &num);
389 }
390 1 size_t Stream::scan(uint32_t& num)
391 {
392 1 return gate_stream_scan_uint(this->impl_ptr, &num);
393 }
394 1 size_t Stream::scan(int64_t& num)
395 {
396 1 return gate_stream_scan_int64(this->impl_ptr, &num);
397 }
398 1 size_t Stream::scan(uint64_t& num)
399 {
400 1 return gate_stream_scan_uint64(this->impl_ptr, &num);
401 }
402 1 size_t Stream::scan(real64_t& num)
403 {
404 1 return gate_stream_scan_real(this->impl_ptr, &num);
405 }
406 1 size_t Stream::scan(String& text)
407 {
408 1 gate_string_t str = GATE_INIT_EMPTY;
409
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t ret = gate_stream_scan_string(this->impl_ptr, &str);
410 1 text = String::createFrom(str);
411 1 return ret;
412 }
413
414 1 size_t Stream::scanChar(char_8_t& chr8)
415 {
416 1 return gate_stream_scan_char8(this->impl_ptr, &chr8);
417 }
418 1 size_t Stream::scanChar(char_16_t& chr16)
419 {
420 1 return gate_stream_scan_char16(this->impl_ptr, &chr16);
421 }
422 1 size_t Stream::scanChar(char_32_t& chr32)
423 {
424 1 return gate_stream_scan_char32(this->impl_ptr, &chr32);
425 }
426
427 void Stream::read(StringBuilder& strbuilder)
428 {
429 char buffer[GATE_MAX_COPYBUFFER_LENGTH];
430 size_t received = this->read(buffer, sizeof(buffer));
431 strbuilder.append(buffer, received);
432 }
433
434 String Stream::readLine()
435 {
436 char buffer[GATE_MAX_COPYBUFFER_LENGTH];
437 size_t returned = 0;
438 result_t readLineResult = gate_stream_read_line(this->impl_ptr, buffer, sizeof(buffer), &returned);
439 GATEXX_CHECK_EXCEPTION(readLineResult);
440 return String(buffer, returned);
441 }
442
443 64 Stream& Stream::operator<<(String const& str)
444 {
445 64 this->print(str.c_str(), str.length());
446 64 return *this;
447 }
448 4 Stream& Stream::operator<<(gate_string_t const* str)
449 {
450
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (str != NULL)
451 {
452 4 this->print(str->str, str->length);
453 }
454 4 return *this;
455 }
456 80 Stream& Stream::operator<<(char const* str)
457 {
458 80 this->print(str, gate_str_length(str));
459 80 return *this;
460 }
461 4 Stream& Stream::operator<<(bool_t b)
462 {
463
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (b)
464 {
465 4 this->print("true", 4);
466 }
467 else
468 {
469 this->print("false", 5);
470 }
471 4 return *this;
472 }
473 Stream& Stream::operator<<(int8_t num)
474 {
475 this->print(int32_t(num));
476 return *this;
477 }
478 /*
479 Stream& Stream::operator<<(uint8_t num)
480 {
481 this->print(uint32_t(num));
482 return *this;
483 }
484 */
485 4 Stream& Stream::operator<<(int16_t num)
486 {
487 4 this->print(int32_t(num));
488 4 return *this;
489 }
490 4 Stream& Stream::operator<<(uint16_t num)
491 {
492 4 this->print(uint32_t(num));
493 4 return *this;
494 }
495 6 Stream& Stream::operator<<(int32_t num)
496 {
497 6 this->print(num);
498 5 return *this;
499 }
500 5 Stream& Stream::operator<<(uint32_t num)
501 {
502 5 this->print(num);
503 5 return *this;
504 }
505 5 Stream& Stream::operator<<(int64_t num)
506 {
507 5 this->print(num);
508 5 return *this;
509 }
510 5 Stream& Stream::operator<<(uint64_t num)
511 {
512 5 this->print(num);
513 5 return *this;
514 }
515 4 Stream& Stream::operator<<(real32_t num)
516 {
517 4 this->print(real64_t(num));
518 4 return *this;
519 }
520 5 Stream& Stream::operator<<(real64_t num)
521 {
522 5 this->print(num);
523 5 return *this;
524 }
525 /*
526 #if !defined(GATE_TYPE_NATIVE_UINT_INTEGRATED)
527 Stream& Stream::operator<<(unsigned int num)
528 {
529 this->print(static_cast<uint32_t>(num));
530 return *this;
531 }
532 #endif
533 #if !defined(GATE_TYPE_NATIVE_INT_INTEGRATED)
534 Stream& Stream::operator<<(int num)
535 {
536 this->print(static_cast<int32_t>(num));
537 return *this;
538 }
539 #endif
540 #if !defined(GATE_TYPE_NATIVE_ULONG_INTEGRATED)
541 Stream& Stream::operator<<(unsigned long num)
542 {
543 this->print(static_cast<uint64_t>(num));
544 return *this;
545 }
546 #endif
547 #if !defined(GATE_TYPE_NATIVE_LONG_INTEGRATED)
548 Stream& Stream::operator<<(long num)
549 {
550 this->print(static_cast<int64_t>(num));
551 return *this;
552 }
553 #endif
554 */
555
556 Stream& Stream::operator>>(StringBuilder& strbuilder)
557 {
558 this->read(strbuilder);
559 return *this;
560 }
561
562 1 Stream& Stream::operator>>(int32_t& num) { this->scan(num); return *this; }
563 1 Stream& Stream::operator>>(uint32_t& num) { this->scan(num); return *this; }
564 1 Stream& Stream::operator>>(int64_t& num) { this->scan(num); return *this; }
565 1 Stream& Stream::operator>>(uint64_t& num) { this->scan(num); return *this; }
566 1 Stream& Stream::operator>>(real64_t& num) { this->scan(num); return *this; }
567 1 Stream& Stream::operator>>(String& text) { this->scan(text); return *this; }
568
569
570 /////////////////////////////////
571 // NullStream implementation //
572 /////////////////////////////////
573
574 13 NullStream::NullStream() noexcept
575 13 : Stream(gate_nullstream())
576 {
577 13 }
578 NullStream::NullStream(NullStream const& src) noexcept
579 : Stream(gate_nullstream())
580 {
581 }
582 NullStream& NullStream::operator=(NullStream const& src) noexcept
583 {
584 (void)src;
585 return *this;
586 }
587 13 NullStream::~NullStream() noexcept
588 {
589 13 }
590
591
592
593 ////////////////////////////////
594 // MemStream implementation //
595 ////////////////////////////////
596
597 3 MemStream::MemStream(gate_memstream_t* implptr)
598 3 : Stream((gate_stream_t*)implptr)
599 {
600 3 this->memimpl = (gate_memstream_t*)this->impl_ptr;
601 3 }
602
603 83 MemStream::MemStream(size_t capacity)
604 83 : Stream((gate_stream_t*)gate_memstream_create(capacity))
605 {
606 83 this->memimpl = (gate_memstream_t*)this->impl_ptr;
607 83 }
608 2 MemStream::MemStream(MemStream const& src)
609 2 : Stream(src), memimpl(src.memimpl)
610 {
611 2 }
612 1 MemStream& MemStream::operator=(MemStream const& src)
613 {
614 1 MemStream that(src);
615 1 this->swap(that);
616 1 return *this;
617 }
618 88 MemStream::~MemStream() noexcept
619 {
620 88 }
621
622 10 gate_memstream_t* MemStream::c_impl() const noexcept
623 {
624 10 return this->memimpl;
625 }
626
627
628 3 void MemStream::swap(MemStream& that) noexcept
629 {
630 3 Stream::swap(that);
631 3 gate::swapRefs(this->memimpl, that.memimpl);
632 3 }
633
634 9 char const* MemStream::getData()
635 {
636 9 return gate_memstream_get_data(this->memimpl);
637 }
638 12 size_t MemStream::size()
639 {
640 12 return gate_memstream_size(this->memimpl);
641 }
642 1 void MemStream::reserve(size_t space)
643 {
644 1 result_t result = gate_memstream_reserve(this->memimpl, space);
645
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_ERROR(result);
646 1 }
647 1 void MemStream::fill(char fillitem, size_t count)
648 {
649 1 result_t result = gate_memstream_fill(this->memimpl, fillitem, count);
650
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_ERROR(result);
651 1 }
652 1 size_t MemStream::discard(size_t bytecount)
653 {
654 1 return gate_memstream_discard(this->memimpl, bytecount);
655 }
656 1 size_t MemStream::discardBack(size_t bytecount)
657 {
658 1 return gate_memstream_discard_back(this->memimpl, bytecount);
659 }
660
661
662 ///////////////////////
663 // StaticMemStream //
664 ///////////////////////
665
666 3 StaticMemStream::StaticMemStream(void* ptrData, size_t dataLength, size_t dataLengthUsed)
667 3 : MemStream(gate_memstream_create_static(ptrData, dataLength, dataLengthUsed))
668 {
669 3 }
670 1 StaticMemStream::StaticMemStream(StaticMemStream const& src)
671 1 : MemStream(src)
672 {
673 1 }
674 1 StaticMemStream& StaticMemStream::operator=(StaticMemStream const& src)
675 {
676 1 MemStream::operator=(src);
677 1 return *this;
678 }
679 4 StaticMemStream::~StaticMemStream() noexcept
680 {
681 4 }
682
683
684
685 //////////////////////
686 // LocalMemStream //
687 //////////////////////
688
689
690 1 LocalMemStream::LocalMemStream(void* ptrWritableData, gate_size_t dataLength)
691 1 : Stream((gate_stream_t*)&memimpl)
692 {
693
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_memstream_create_static_unmanaged(&this->memimpl, ptrWritableData, dataLength, 0);
694 1 }
695 5 LocalMemStream::LocalMemStream(void const* ptrReadOnlyData, gate_size_t dataLength)
696 5 : Stream((gate_stream_t*)&memimpl)
697 {
698
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 gate_memstream_create_static_unmanaged_readonly(&this->memimpl, ptrReadOnlyData, dataLength, dataLength);
699 5 }
700 6 LocalMemStream::~LocalMemStream() noexcept
701 {
702 6 }
703
704 1 char const* LocalMemStream::getData()
705 {
706 1 return gate_memstream_get_data(&this->memimpl);
707 }
708 1 size_t LocalMemStream::size()
709 {
710 1 return gate_memstream_size(&this->memimpl);
711 }
712 2 size_t LocalMemStream::discard(size_t bytecount)
713 {
714 2 return gate_memstream_discard(&this->memimpl, bytecount);
715 }
716 2 size_t LocalMemStream::discardBack(size_t bytecount)
717 {
718 2 return gate_memstream_discard_back(&this->memimpl, bytecount);
719 }
720 1 void LocalMemStream::reserve(size_t space)
721 {
722 1 gate_result_t result = gate_memstream_reserve(&this->memimpl, space);
723
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 GATEXX_CHECK_ERROR(result);
724 }
725 2 void LocalMemStream::fill(char fillitem, size_t count)
726 {
727 2 gate_result_t result = gate_memstream_fill(&this->memimpl, fillitem, count);
728
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 GATEXX_CHECK_ERROR(result);
729 1 }
730
731
732
733 ////////////////////////////////////
734 // SyncMemStream implementation //
735 ////////////////////////////////////
736
737 2 static gate_stream_t* initSyncMemStream(size_t prealloc, uint32_t timeoutms)
738 {
739 2 gate_stream_t* ret = NULL;
740
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 gate_result_t result = gate_syncmemstream_create(prealloc, timeoutms, &ret);
741
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2 GATEXX_CHECK_ERROR(result);
742 2 return ret;
743 }
744
745 2 SyncMemStream::SyncMemStream(size_t prealloc, uint32_t timeoutms)
746 2 : Stream(initSyncMemStream(prealloc, timeoutms))
747 {
748 2 }
749
750 1 SyncMemStream::SyncMemStream(SyncMemStream const& src)
751 1 : Stream(src)
752 {
753 1 }
754
755 1 SyncMemStream& SyncMemStream::operator=(SyncMemStream const& src)
756 {
757
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (this != &src)
758 {
759 1 Stream::operator=(src);
760 }
761 1 return *this;
762 }
763
764 3 SyncMemStream::~SyncMemStream() noexcept
765 {
766 3 }
767
768
769
770
771 ///////////////////////////////////
772 // StringStream implementation //
773 ///////////////////////////////////
774
775 56 StringStream::StringStream(size_t capacity)
776 56 : Stream((gate_stream_t*)gate_stringstream_create(capacity))
777 {
778 56 this->builderimpl = (gate_stringstream_t*)this->impl_ptr;
779 56 }
780 2 StringStream::StringStream(StringStream const& src)
781 2 : Stream((gate_stream_t*)gate_stringstream_create(0))
782 {
783 2 this->builderimpl = (gate_stringstream_t*)this->impl_ptr;
784
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 size_t const src_len = gate_stringstream_size(src.builderimpl);
785
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if(src_len > 0)
786 {
787
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 this->write(gate_stringstream_get_data(src.builderimpl), src_len);
788 }
789 2 }
790 31 StringStream::StringStream(String const& text)
791 31 : Stream((gate_stream_t*)gate_stringstream_create(0))
792 {
793 31 this->builderimpl = (gate_stringstream_t*)this->impl_ptr;
794 31 size_t written = 0;
795
1/2
✓ Branch 3 taken 31 times.
✗ Branch 4 not taken.
31 result_t result = gate_stream_write_block(this->impl_ptr, text.c_str(), text.length(), &written);
796
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
31 GATEXX_CHECK_ERROR(result);
797 31 }
798
799 1 StringStream& StringStream::operator=(StringStream const& src)
800 {
801
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 StringStream that(src);
802 1 this->swap(that);
803 2 return *this;
804 }
805 267 StringStream::~StringStream()
806 {
807 89 this->builderimpl = NULL;
808 89 }
809
810 2 void StringStream::swap(StringStream& that) noexcept
811 {
812 2 Stream::swap(that);
813 2 gate::swapRefs(this->builderimpl, that.builderimpl);
814 2 }
815
816 33 String StringStream::toString()
817 {
818 gate_string_t str;
819
1/2
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
33 result_t result = gate_stringstream_to_string(this->builderimpl, &str);
820
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
33 GATEXX_CHECK_ERROR(result);
821 66 return String::createFrom(str);
822 }
823
824 16 String StringStream::toView()
825 {
826 gate_string_t str;
827
1/2
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
16 result_t result = gate_stringstream_get_current_view(this->builderimpl, &str);
828
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
16 GATEXX_CHECK_ERROR(result);
829 32 return String::createFrom(str);
830 }
831
832
833
834 enumint_t const ResourceStream::Resource_Default = GATE_STREAM_RESOURCE_DEFAULT;
835 enumint_t const ResourceStream::Resource_Input = GATE_STREAM_RESOURCE_INPUT;
836 enumint_t const ResourceStream::Resource_Output = GATE_STREAM_RESOURCE_OUTPUT;
837 enumint_t const ResourceStream::Resource_Error = GATE_STREAM_RESOURCE_ERROR;
838
839 30 ResourceStream::ResourceStream(gate_resourcestream_t* stream)
840 30 : Stream((gate_stream_t*)stream)
841 {
842 30 }
843 1 ResourceStream::ResourceStream(ResourceStream const& src)
844 1 : Stream(src)
845 {
846 1 }
847
848 31 ResourceStream::~ResourceStream() noexcept
849 {
850 31 }
851 2 uintptr_t ResourceStream::getResource(enumint_t resourceType)
852 {
853 2 uintptr_t ret = 0;
854 2 gate_resourcestream_t* resstream = (gate_resourcestream_t*)this->impl_ptr;
855
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 result_t result = gate_stream_get_resource(resstream, resourceType, &ret);
856
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2 GATEXX_CHECK_EXCEPTION(result);
857 2 return ret;
858 }
859
860 gate_resourcestream_t* ResourceStream::c_impl() const noexcept
861 {
862 return (gate_resourcestream_t*)Stream::c_impl();
863 }
864
865
866
867
868 enumint_t const ControlStream::Seek_Begin = GATE_STREAM_SEEK_BEGIN;
869 enumint_t const ControlStream::Seek_End = GATE_STREAM_SEEK_END;
870 enumint_t const ControlStream::Seek_Current = GATE_STREAM_SEEK_CURRENT;
871
872 enumint_t const ControlStream::Close_Default = GATE_STREAM_CLOSE_DEFAULT;
873 enumint_t const ControlStream::Close_Input = GATE_STREAM_CLOSE_INPUT;
874 enumint_t const ControlStream::Close_Output = GATE_STREAM_CLOSE_OUTPUT;
875 enumint_t const ControlStream::Close_Error = GATE_STREAM_CLOSE_ERROR;
876
877 30 ControlStream::ControlStream(gate_controlstream_t* stream)
878 30 : ResourceStream((gate_resourcestream_t*)stream)
879 {
880 30 }
881 1 ControlStream::ControlStream(ControlStream const& src)
882 1 : ResourceStream(src)
883 {
884 1 }
885
886
887 31 ControlStream::~ControlStream() noexcept
888 {
889 31 }
890
891 5 bool ControlStream::canRead()
892 {
893 5 gate_bool_t ret = false;
894
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 result_t result = gate_stream_can_read(((gate_controlstream_t*)this->impl_ptr), &ret);
895
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
5 GATEXX_CHECK_EXCEPTION(result);
896 5 return ret;
897 }
898 5 bool ControlStream::canWrite()
899 {
900 5 gate_bool_t ret = false;
901
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 result_t result = gate_stream_can_write(((gate_controlstream_t*)this->impl_ptr), &ret);
902
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
5 GATEXX_CHECK_EXCEPTION(result);
903 5 return ret;
904 }
905 5 int64_t ControlStream::getSize()
906 {
907 5 int64_t ret = 0;
908
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 result_t result = gate_stream_get_size(((gate_controlstream_t*)this->impl_ptr), &ret);
909
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
5 GATEXX_CHECK_EXCEPTION(result);
910 5 return ret;
911 }
912 5 int64_t ControlStream::getAvailable()
913 {
914 5 int64_t ret = 0;
915
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 result_t result = gate_stream_get_available(((gate_controlstream_t*)this->impl_ptr), &ret);
916
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
5 GATEXX_CHECK_EXCEPTION(result);
917 5 return ret;
918 }
919 11 int64_t ControlStream::seek(int64_t position, enumint_t origin)
920 {
921 11 int64_t ret = 0;
922
1/2
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
11 result_t result = gate_stream_seek(((gate_controlstream_t*)this->impl_ptr), position, origin, &ret);
923
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
11 GATEXX_CHECK_EXCEPTION(result);
924 11 return ret;
925 }
926 2 void ControlStream::reset()
927 {
928 2 result_t result = gate_stream_reset(((gate_controlstream_t*)this->impl_ptr));
929
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 GATEXX_CHECK_EXCEPTION(result);
930 2 }
931 4 void ControlStream::close(enumint_t closeType)
932 {
933 4 result_t result = gate_stream_close(((gate_controlstream_t*)this->impl_ptr), closeType);
934
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
4 GATEXX_CHECK_EXCEPTION(result);
935 3 }
936
937 4 gate_controlstream_t* ControlStream::c_impl() const noexcept
938 {
939 4 return (gate_controlstream_t*)Stream::c_impl();
940 }
941
942
943 1 static gate_controlstream_t* constructMemViewStream(void const* ptrData, size_t dataLength, size_t offset, gate_object_t* ptr_container)
944 {
945 1 gate_controlstream_t* ptr = gate_memstream_create_view(ptrData, dataLength, offset, ptr_container);
946
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (ptr == NULL)
947 {
948 GATEXX_RAISE_ERROR(GATE_RESULT_OUTOFMEMORY);
949 }
950 1 return ptr;
951 }
952
953 1 MemViewStream::MemViewStream(void const* ptrData, size_t dataLength, size_t offset)
954 1 : ControlStream(constructMemViewStream(ptrData, dataLength, offset, NULL))
955 {
956
957 1 }
958 MemViewStream::MemViewStream(void const* ptrData, size_t dataLength, size_t offset, Object& container)
959 : ControlStream(constructMemViewStream(ptrData, dataLength, offset, container.c_impl()))
960 {
961 }
962
963 MemViewStream::MemViewStream(MemViewStream const& src)
964 : ControlStream(src)
965 {
966 }
967 MemViewStream& MemViewStream::operator=(MemViewStream const& src)
968 {
969 ControlStream::operator=(src);
970 return *this;
971 }
972 1 MemViewStream::~MemViewStream() noexcept
973 {
974 1 }
975
976
977
978 7 static gate_controlstream_t* constructMemFileStream(size_t prealloc)
979 {
980 7 gate_controlstream_t* ptr = gate_memfilestream_create(prealloc);
981
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 if (ptr == NULL)
982 {
983 GATEXX_RAISE_ERROR(GATE_RESULT_OUTOFMEMORY);
984 }
985 7 return ptr;
986 }
987 4 static gate_controlstream_t* constructSharedMemFileStream(gate_controlstream_t* memfile)
988 {
989 4 gate_controlstream_t* ptr = gate_memfilestream_share(memfile);
990
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (ptr == NULL)
991 {
992 GATEXX_RAISE_ERROR(GATE_RESULT_OUTOFMEMORY);
993 }
994 4 return ptr;
995 }
996
997 7 MemFileStream::MemFileStream(gate_size_t prealloc)
998 7 : ControlStream(constructMemFileStream(prealloc))
999 {
1000 7 }
1001 4 MemFileStream::MemFileStream(gate_controlstream_t* ptr_stream)
1002 4 : ControlStream(constructSharedMemFileStream(ptr_stream))
1003 {
1004
1005 4 }
1006 MemFileStream::MemFileStream(MemFileStream const& src)
1007 : ControlStream(src)
1008 {
1009 }
1010 MemFileStream& MemFileStream::operator=(MemFileStream const& src)
1011 {
1012 ControlStream::operator=(src);
1013 return *this;
1014 }
1015 11 MemFileStream::~MemFileStream() noexcept
1016 {
1017 11 }
1018
1019 4 MemFileStream MemFileStream::share()
1020 {
1021 4 gate_controlstream_t* ctrlstream = reinterpret_cast<gate_controlstream_t*>(this->c_impl());
1022 4 MemFileStream ret(ctrlstream);
1023 4 return ret;
1024 }
1025
1026
1027 } // end of namespace gate
1028