cs144 lab0 lab1记录

这个叫什么?Write Up吗

lab0

lab0要做的事,实现buffer部分的功能,要自己写变量以及实现接口。

成员函数 write()向buffer内写数据,peek_out()  pop_out()  read()  函数从buffer内读数据,

buffer长度capacity,需要变量记录向buffer内一共写入和读取过多长的数据。

有些变量在后面的lab会用上,第一次写真不容易想,好些都是参照别人的博客写的。

 

lab1

// Construct a `StreamReassembler` that will store up to `capacity` bytes.
StreamReassembler(const size_t capacity);
// Receive a substring and write any newly contiguous bytes into the stream,
// while staying within the memory limits of the `capacity`. Bytes that would
// exceed the capacity are silently discarded.
//
// `data`: the substring
// `index` indicates the index (place in sequence) of the first byte in `data`
// `eof`: the last byte of this substring will be the last byte in the entire stream
void push_substring(const string &data, const uint64_t index, const bool eof);
// Access the reassembled ByteStream (your code from Lab 0)
ByteStream &stream_out();
// The number of bytes in the substrings stored but not yet reassembled
size_t unassembled_bytes() const;
// Is the internal state empty (other than the output stream)?
bool empty() const;
hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 » cs144 lab0 lab1记录