Sponge
CS144's user-space TCP library
byte_stream.cc
Go to the documentation of this file.
1 #include "byte_stream.hh"
2 
3 // Dummy implementation of a flow-controlled in-memory byte stream.
4 
5 // For Lab 0, please replace with a real implementation that passes the
6 // automated checks run by `make check_lab0`.
7 
8 // You will need to add private members to the class declaration in `byte_stream.hh`
9 
10 template <typename... Targs>
11 void DUMMY_CODE(Targs &&... /* unused */) {}
12 
13 using namespace std;
14 
15 ByteStream::ByteStream(const size_t capacity) { DUMMY_CODE(capacity); }
16 
17 size_t ByteStream::write(const string &data) {
18  DUMMY_CODE(data);
19  return {};
20 }
21 
23 string ByteStream::peek_output(const size_t len) const {
24  DUMMY_CODE(len);
25  return {};
26 }
27 
29 void ByteStream::pop_output(const size_t len) { DUMMY_CODE(len); }
30 
35  DUMMY_CODE(len);
36  return {};
37 }
38 
40 
41 bool ByteStream::input_ended() const { return {}; }
42 
43 size_t ByteStream::buffer_size() const { return {}; }
44 
45 bool ByteStream::buffer_empty() const { return {}; }
46 
47 bool ByteStream::eof() const { return false; }
48 
49 size_t ByteStream::bytes_written() const { return {}; }
50 
51 size_t ByteStream::bytes_read() const { return {}; }
52 
53 size_t ByteStream::remaining_capacity() const { return {}; }
ByteStream::bytes_written
size_t bytes_written() const
Total number of bytes written.
Definition: byte_stream.cc:49
std::string
ByteStream::eof
bool eof() const
Definition: byte_stream.cc:47
len
constexpr size_t len
Definition: tcp_benchmark.cc:12
ByteStream::pop_output
void pop_output(const size_t len)
Remove bytes from the buffer.
Definition: byte_stream.cc:29
ByteStream::end_input
void end_input()
Signal that the byte stream has reached its ending.
Definition: byte_stream.cc:39
ByteStream::buffer_size
size_t buffer_size() const
Definition: byte_stream.cc:43
byte_stream.hh
ByteStream::read
std::string read(const size_t len)
Definition: byte_stream.cc:34
ByteStream::peek_output
std::string peek_output(const size_t len) const
Definition: byte_stream.cc:23
DUMMY_CODE
void DUMMY_CODE(Targs &&...)
Definition: byte_stream.cc:11
ByteStream::bytes_read
size_t bytes_read() const
Total number of bytes popped.
Definition: byte_stream.cc:51
ByteStream::ByteStream
ByteStream(const size_t capacity)
Construct a stream with room for capacity bytes.
Definition: byte_stream.cc:15
ByteStream::write
size_t write(const std::string &data)
Definition: byte_stream.cc:17
std
ByteStream::buffer_empty
bool buffer_empty() const
Definition: byte_stream.cc:45
ByteStream::remaining_capacity
size_t remaining_capacity() const
Definition: byte_stream.cc:53
ByteStream::input_ended
bool input_ended() const
Definition: byte_stream.cc:41