forked from vikshanker/sponge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbyte_stream.cc
53 lines (35 loc) · 1.49 KB
/
byte_stream.cc
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
#include "byte_stream.hh"
// Dummy implementation of a flow-controlled in-memory byte stream.
// For Lab 0, please replace with a real implementation that passes the
// automated checks run by `make check_lab0`.
// You will need to add private members to the class declaration in `byte_stream.hh`
template <typename... Targs>
void DUMMY_CODE(Targs &&... /* unused */) {}
using namespace std;
ByteStream::ByteStream(const size_t capacity) { DUMMY_CODE(capacity); }
size_t ByteStream::write(const string &data) {
DUMMY_CODE(data);
return {};
}
//! \param[in] len bytes will be copied from the output side of the buffer
string ByteStream::peek_output(const size_t len) const {
DUMMY_CODE(len);
return {};
}
//! \param[in] len bytes will be removed from the output side of the buffer
void ByteStream::pop_output(const size_t len) { DUMMY_CODE(len); }
//! Read (i.e., copy and then pop) the next "len" bytes of the stream
//! \param[in] len bytes will be popped and returned
//! \returns a string
std::string ByteStream::read(const size_t len) {
DUMMY_CODE(len);
return {};
}
void ByteStream::end_input() {}
bool ByteStream::input_ended() const { return {}; }
size_t ByteStream::buffer_size() const { return {}; }
bool ByteStream::buffer_empty() const { return {}; }
bool ByteStream::eof() const { return false; }
size_t ByteStream::bytes_written() const { return {}; }
size_t ByteStream::bytes_read() const { return {}; }
size_t ByteStream::remaining_capacity() const { return {}; }