ContiguousStream.hpp
Useful for streaming data to contiguous memory. Status: RELEASE.
-
class ContiguousBuffer : public std::streambuf
- #include <ContiguousStream.hpp>
Public Types
-
using const_iterator = vector<uninitialized_char>::const_iterator
Public Functions
-
inline ContiguousBuffer(const size_t init_size = 1024)
- Parameters:
init_size – num bytes to reserve initially
-
inline void Reset()
Reset stream pointers while retaining underlying memory allocation.
-
inline const char *GetData() const
Return a pointer to contiguous memory storing streamed data.
-
inline size_t GetSize() const
Number of bytes currently stored.
-
inline void Print(std::ostream &os = std::cout) const
Copy stored data into an ostream. Useful for degugging.
-
inline const_iterator cbegin() const
Begin iterator on stored data.
-
inline const_iterator cend() const
End iterator on stored data.
Private Functions
-
inline char *GetData()
-
inline size_t GetCapacity() const
return buffer’s capacity, in bytes
-
inline int_type overflow(int_type c) override
Private Members
-
vector<uninitialized_char> buffer
-
using const_iterator = vector<uninitialized_char>::const_iterator
-
class ContiguousStream : public std::ostream
- #include <ContiguousStream.hpp>
Public Types
-
using const_iterator = ContiguousBuffer::const_iterator
Public Functions
-
inline ContiguousStream(const size_t init_size = 1024)
-
inline void Reset()
Reset stream pointers while retaining underlying memory allocation.
-
inline const char *GetData() const
Return a pointer to contiguous memory storing streamed data.
-
inline size_t GetSize() const
Number of bytes currently stored.
-
inline void Print(std::ostream &os = std::cout) const
Copy stored data into an ostream. Useful for degugging.
-
inline const_iterator cbegin() const
Begin iterator on stored data.
-
inline const_iterator cend() const
End iterator on stored data.
Private Members
-
ContiguousBuffer buffer
-
using const_iterator = ContiguousBuffer::const_iterator