|
LibQuicR
|
Shared, segmented byte storage with a flattened bidirectional iterator. More...
#include <data_storage.h>
Public Types | |
| using | iterator = Iterator< typename BufferType::iterator, typename SliceType::element_type::iterator > |
| Mutable flattened byte iterator type. More... | |
| using | const_iterator = Iterator< typename BufferType::const_iterator, typename SliceType::element_type::const_iterator > |
| Read-only flattened byte iterator type. More... | |
Public Member Functions | |
| bool | Empty () const noexcept |
| const SliceType & | First () const noexcept |
| const SliceType & | Last () const noexcept |
| const SliceType | GetLast () const noexcept |
| void | Push (std::span< const uint8_t > bytes) |
| Copies bytes into a new owned slice at the back. More... | |
| void | Push (SliceType slice) |
| Appends a shared slice without copying its bytes. More... | |
| std::size_t | size () const noexcept |
| std::size_t | EraseFront (std::size_t len) noexcept |
Removes complete slices from the front whose cumulative size does not exceed len. More... | |
| iterator | begin () noexcept |
| iterator | end () noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cbegin () const noexcept |
| const_iterator | cend () const noexcept |
Static Public Member Functions | |
| static std::shared_ptr< DataStorage > | Create () noexcept |
| static std::shared_ptr< DataStorage > | Create (SliceType slice) noexcept |
Protected Types | |
| using | SliceType = std::shared_ptr< std::vector< uint8_t, Allocator > > |
| Shared ownership of one contiguous byte slice. More... | |
| using | BufferType = std::deque< SliceType > |
| Sequence of shared slices. More... | |
Protected Member Functions | |
| DataStorage ()=default | |
Constructs empty storage; use Create() from callers. More... | |
| DataStorage (SliceType slice) | |
| Constructs storage containing one shared slice. More... | |
Shared, segmented byte storage with a flattened bidirectional iterator.
| Allocator | Allocator used by each owned byte-vector slice. |
The container and its iterators are not thread-safe. Slices are shared, so retained SliceType instances can outlive their membership in the storage.
|
protected |
Sequence of shared slices.
| using quicr::DataStorage< Allocator >::const_iterator = Iterator<typename BufferType::const_iterator, typename SliceType::element_type::const_iterator> |
Read-only flattened byte iterator type.
| using quicr::DataStorage< Allocator >::iterator = Iterator<typename BufferType::iterator, typename SliceType::element_type::iterator> |
Mutable flattened byte iterator type.
|
protected |
Shared ownership of one contiguous byte slice.
|
protecteddefault |
Constructs empty storage; use Create() from callers.
|
inlineprotected |
Constructs storage containing one shared slice.
| slice | Slice to retain. |
slice is non-null and nonempty before any flattened iteration or first/last access.
|
inlinenoexcept |
end() when there are no slices.
|
inlinenoexcept |
end() when there are no slices.
|
inlinenoexcept |
cend() when there are no slices.
|
inlinenoexcept |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
| slice | Initial shared slice. |
slice is non-null and nonempty before iteration or first/last access.
|
inlinenoexcept |
true if there are no slices; zero-length slices still make this false.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Removes complete slices from the front whose cumulative size does not exceed len.
| len | Maximum byte count considered for removal. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Appends a shared slice without copying its bytes.
| slice | Slice whose ownership is moved into the storage. |
slice is non-null and nonempty before flattened iteration.
|
inline |
Copies bytes into a new owned slice at the back.
| bytes | Source view, valid for the duration of the call. |
| Any | allocation exception. |
|
inlinenoexcept |