Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
Public Member Functions | Protected Attributes | List of all members
arrow::BufferBuilder Class Reference

A class for incrementally building a contiguous chunk of in-memory data. More...

#include <arrow/buffer.h>

Inheritance diagram for arrow::BufferBuilder:
arrow::TypedBufferBuilder< T > arrow::TypedBufferBuilder< int32_t > arrow::TypedBufferBuilder< uint8_t >

Public Member Functions

 BufferBuilder (MemoryPool *pool ARROW_MEMORY_POOL_DEFAULT)
 
Status Resize (const int64_t elements, bool shrink_to_fit=true)
 Resizes the buffer to the nearest multiple of 64 bytes. More...
 
Status Reserve (const int64_t size)
 Ensure that builder can accommodate the additional number of bytes without the need to perform allocations. More...
 
Status Append (const void *data, int64_t length)
 
template<size_t NBYTES>
Status Append (const std::array< uint8_t, NBYTES > &data)
 
Status Advance (const int64_t length)
 
void UnsafeAppend (const void *data, int64_t length)
 
Status Finish (std::shared_ptr< Buffer > *out, bool shrink_to_fit=true)
 
void Reset ()
 
int64_t capacity () const
 
int64_t length () const
 
const uint8_t * data () const
 

Protected Attributes

std::shared_ptr< ResizableBufferbuffer_
 
MemoryPoolpool_
 
uint8_t * data_
 
int64_t capacity_
 
int64_t size_
 

Detailed Description

A class for incrementally building a contiguous chunk of in-memory data.

Constructor & Destructor Documentation

◆ BufferBuilder()

arrow::BufferBuilder::BufferBuilder ( MemoryPool *pool  ARROW_MEMORY_POOL_DEFAULT)
inlineexplicit

Member Function Documentation

◆ Advance()

Status arrow::BufferBuilder::Advance ( const int64_t  length)
inline

◆ Append() [1/2]

Status arrow::BufferBuilder::Append ( const void *  data,
int64_t  length 
)
inline

◆ Append() [2/2]

template<size_t NBYTES>
Status arrow::BufferBuilder::Append ( const std::array< uint8_t, NBYTES > &  data)
inline

◆ capacity()

int64_t arrow::BufferBuilder::capacity ( ) const
inline

◆ data()

const uint8_t* arrow::BufferBuilder::data ( ) const
inline

◆ Finish()

Status arrow::BufferBuilder::Finish ( std::shared_ptr< Buffer > *  out,
bool  shrink_to_fit = true 
)
inline

◆ length()

int64_t arrow::BufferBuilder::length ( ) const
inline

◆ Reserve()

Status arrow::BufferBuilder::Reserve ( const int64_t  size)
inline

Ensure that builder can accommodate the additional number of bytes without the need to perform allocations.

Parameters
sizenumber of additional bytes to make space for
Returns
Status

◆ Reset()

void arrow::BufferBuilder::Reset ( )
inline

◆ Resize()

Status arrow::BufferBuilder::Resize ( const int64_t  elements,
bool  shrink_to_fit = true 
)
inline

Resizes the buffer to the nearest multiple of 64 bytes.

Parameters
elementsthe new capacity of the of the builder. Will be rounded up to a multiple of 64 bytes for padding
shrink_to_fitif new capacity smaller than existing size, reallocate internal buffer. Set to false to avoid reallocations when shrinking the builder
Returns
Status

◆ UnsafeAppend()

void arrow::BufferBuilder::UnsafeAppend ( const void *  data,
int64_t  length 
)
inline

Member Data Documentation

◆ buffer_

std::shared_ptr<ResizableBuffer> arrow::BufferBuilder::buffer_
protected

◆ capacity_

int64_t arrow::BufferBuilder::capacity_
protected

◆ data_

uint8_t* arrow::BufferBuilder::data_
protected

◆ pool_

MemoryPool* arrow::BufferBuilder::pool_
protected

◆ size_

int64_t arrow::BufferBuilder::size_
protected

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