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

Immutable API for a chunk of bytes which may or may not be owned by the class instance. More...

#include <buffer.h>

Inheritance diagram for arrow::Buffer:
arrow::MutableBuffer arrow::py::NumPyBuffer arrow::py::PyBuffer arrow::io::MemoryMappedFile::MemoryMap arrow::ResizableBuffer arrow::PoolBuffer

Public Member Functions

 Buffer (const uint8_t *data, int64_t size)
 
virtual ~Buffer ()
 
 Buffer (const std::shared_ptr< Buffer > &parent, int64_t offset, int64_t size)
 An offset into data that is owned by another buffer, but we want to be able to retain a valid pointer to it even after other shared_ptr's to the parent buffer have been destroyed. More...
 
bool is_mutable () const
 
bool Equals (const Buffer &other, int64_t nbytes) const
 Return true if both buffers are the same size and contain the same bytes up to the number of compared bytes. More...
 
bool Equals (const Buffer &other) const
 
Status Copy (int64_t start, int64_t nbytes, MemoryPool *pool, std::shared_ptr< Buffer > *out) const
 Copy a section of the buffer into a new Buffer. More...
 
Status Copy (int64_t start, int64_t nbytes, std::shared_ptr< Buffer > *out) const
 Copy a section of the buffer using the default memory pool into a new Buffer. More...
 
int64_t capacity () const
 
const uint8_t * data () const
 
uint8_t * mutable_data ()
 
int64_t size () const
 
std::shared_ptr< Bufferparent () const
 

Protected Attributes

bool is_mutable_
 
const uint8_t * data_
 
uint8_t * mutable_data_
 
int64_t size_
 
int64_t capacity_
 
std::shared_ptr< Bufferparent_
 

Detailed Description

Immutable API for a chunk of bytes which may or may not be owned by the class instance.

Buffers have two related notions of length: size and capacity. Size is the number of bytes that might have valid data. Capacity is the number of bytes that where allocated for the buffer in total.

The following invariant is always true: Size < Capacity

Constructor & Destructor Documentation

arrow::Buffer::Buffer ( const uint8_t *  data,
int64_t  size 
)
inline
arrow::Buffer::~Buffer ( )
virtual
arrow::Buffer::Buffer ( const std::shared_ptr< Buffer > &  parent,
int64_t  offset,
int64_t  size 
)
inline

An offset into data that is owned by another buffer, but we want to be able to retain a valid pointer to it even after other shared_ptr's to the parent buffer have been destroyed.

This method makes no assertions about alignment or padding of the buffer but in general we expected buffers to be aligned and padded to 64 bytes. In the future we might add utility methods to help determine if a buffer satisfies this contract.

Member Function Documentation

int64_t arrow::Buffer::capacity ( ) const
inline
Status arrow::Buffer::Copy ( int64_t  start,
int64_t  nbytes,
MemoryPool pool,
std::shared_ptr< Buffer > *  out 
) const

Copy a section of the buffer into a new Buffer.

Status arrow::Buffer::Copy ( int64_t  start,
int64_t  nbytes,
std::shared_ptr< Buffer > *  out 
) const

Copy a section of the buffer using the default memory pool into a new Buffer.

const uint8_t* arrow::Buffer::data ( ) const
inline
bool arrow::Buffer::Equals ( const Buffer other,
int64_t  nbytes 
) const

Return true if both buffers are the same size and contain the same bytes up to the number of compared bytes.

bool arrow::Buffer::Equals ( const Buffer other) const
bool arrow::Buffer::is_mutable ( ) const
inline
uint8_t* arrow::Buffer::mutable_data ( )
inline
std::shared_ptr<Buffer> arrow::Buffer::parent ( ) const
inline
int64_t arrow::Buffer::size ( ) const
inline

Member Data Documentation

int64_t arrow::Buffer::capacity_
protected
const uint8_t* arrow::Buffer::data_
protected
bool arrow::Buffer::is_mutable_
protected
uint8_t* arrow::Buffer::mutable_data_
protected
std::shared_ptr<Buffer> arrow::Buffer::parent_
protected
int64_t arrow::Buffer::size_
protected

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