Read-Write buffering
1. Using vectors as an internal implementation
2. Define the pre-interpolation area, the readable area, the post-interpolation area, with the dynamic integer subscript mark the position, where subscript satisfies 0<= readindex <= writeindex <= size ()
3. Define the size of the pre-insert at initialization, and the size of the back plug, such as Readindex = Writeindex = 8, size () = 1032 (8+1024)
4. The read and retrieve interfaces are provided, the former only reads and the latter reduces the readable area.
5. Question: What if the write area is not enough? 1. Dynamically allocate larger memory 2. Internal maneuvers
6. Question: What should I do if the front plug area becomes larger after continuous reading and writing? 1. When all the readable data is retrieve, the buffer is restored to the initial state 2. When allocating larger memory, change the front interpolation area to the initial size of 3. Internal maneuvers
,
Read-Write cushioning design performance