Spicy
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
hilti::rt::stream::detail::Chunk Class Reference

#include <stream.h>

Public Types

using Array = std::pair< Size, std::array< Byte, SmallBufferSize > >
 
using Vector = std::vector< Byte >
 

Public Member Functions

 Chunk (Offset o, std::array< Byte, SmallBufferSize > d, Size n)
 
 Chunk (Offset o, Vector &&d)
 
 Chunk (Offset o, const View &d)
 
 Chunk (Offset o, const std::string &s)
 
template<int N>
 Chunk (Offset o, std::array< Byte, N > d)
 
 Chunk (Offset o, const char *d, Size n)
 
 Chunk (Offset o, size_t len)
 
 Chunk (const Chunk &other)
 
 Chunk (Chunk &&other) noexcept
 
Chunkoperator= (const Chunk &other)=delete
 
Chunkoperator= (Chunk &&other) noexcept
 
Offset offset () const
 
Offset endOffset () const
 
bool isGap () const
 
bool inRange (Offset offset) const
 
const Byte * data () const
 
const Byte * data (Offset offset) const
 
const Byte * endData () const
 
Size size () const
 
bool isLast () const
 
const Chunknext () const
 
auto last () const
 
auto last ()
 
void debugPrint (std::ostream &out) const
 

Static Public Attributes

static const int SmallBufferSize = 32
 

Protected Member Functions

void trim (Offset o)
 
void setOffset (Offset o)
 
void setChain (const Chain *chain)
 
Chunknext ()
 
void setNext (std::unique_ptr< Chunk > next)
 
void clearNext ()
 

Friends

class Chain
 

Detailed Description

Represents one block of continuous data inside a stream instance. A stream's Chain links multiple of these chunks to represent all of its content.

A chunk internally employs small-buffer optimization for very small amounts of data, storing it directly inside the instance instead of using heap-allocated memory.

All public methods of Chunk are constant. Modifications can be done only be through the owning Chain (so that we can track changes there).


The documentation for this class was generated from the following files: