-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.hpp
More file actions
62 lines (48 loc) · 1.59 KB
/
Copy pathdebug.hpp
File metadata and controls
62 lines (48 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* File: /lib/impl/stream/debug.hpp
*
* This file is a part of cpplib project which is distributed under MIT License.
* See file LICENSE for full license details.
*
* Copyright (c) 2020-present Nikita Zuev (V.Slavski!) <[email protected]>
*/
#ifndef CPPLIB__lib__impl__stream__debug__hpp
#define CPPLIB__lib__impl__stream__debug__hpp
#include <limits>
#include "../../../lib/types.hpp"
#include "../../../lib/data/stream.hpp"
// DECLARATION lib::stream::impl::debug
namespace lib::stream::impl {
class debug final
: public data::rwstream_t
{
public:
debug();
debug( data::rwstream_t * stream, usize min_rw, usize max_rw );
virtual ~debug() = default;
void reset();
void reset( data::rwstream_t * stream, usize min_rw, usize max_rw );
void shuffle();
// IMPLEMENTATION lib::data::rstream_t
data::result_t read( const data::buffer_t & buffer ) override;
data::result_t peek( const data::buffer_t & buffer ) override;
bool read_flush() override;
data::result_t read_size() override;
::std::error_condition read_error() const override;
// IMPLEMENTATION lib::data::wstream_t
data::result_t write( const data::cbuffer_t & buffer ) override;
bool write_flush() override;
data::result_t write_size() override;
::std::error_condition write_error() const override;
// IMPLEMENTATION lib::data::rwstream_t
bool flush() override;
data::result_t size() override;
::std::error_condition error() const override;
private:
data::rwstream_t * stream;
usize min_rw;
usize max_rw;
usize next_read;
usize next_write;
};
} // namespace lib::stream::impl
#endif // CPPLIB__lib__impl__stream__debug__hpp