Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::BitWriter_8byte Class Reference

#include <bit-stream-utils.8byte.h>

Collaboration diagram for impala::BitWriter_8byte:

Public Member Functions

 BitWriter_8byte (uint8_t *buffer, int buffer_len)
 
void Clear ()
 
uint8_t * buffer () const
 
int buffer_len () const
 
int bytes_written () const
 
bool PutValue (uint64_t v, int num_bits)
 
template<typename T >
bool PutAligned (T v, int num_bits)
 Writes v to the next aligned byte. More...
 
bool PutVlqInt (int32_t v)
 
uint8_t * GetNextBytePtr (int num_bytes=1)
 

Private Attributes

uint64_tbuffer_
 
int max_bytes_
 
int offset_
 
int bit_offset_
 

Detailed Description

Utility class to write bit/byte streams. This class can write data to either be bit packed or byte aligned (and a single stream that has a mix of both). This class does not allocate memory.

Definition at line 30 of file bit-stream-utils.8byte.h.

Constructor & Destructor Documentation

impala::BitWriter_8byte::BitWriter_8byte ( uint8_t *  buffer,
int  buffer_len 
)
inline

buffer: buffer to write bits to. Buffer should be preallocated with 'buffer_len' bytes. 'buffer_len' must be a multiple of 8.

Definition at line 34 of file bit-stream-utils.8byte.h.

Member Function Documentation

uint8_t* impala::BitWriter_8byte::buffer ( ) const
inline

Definition at line 48 of file bit-stream-utils.8byte.h.

References buffer_.

int impala::BitWriter_8byte::buffer_len ( ) const
inline

Definition at line 49 of file bit-stream-utils.8byte.h.

References max_bytes_.

int impala::BitWriter_8byte::bytes_written ( ) const
inline

Definition at line 51 of file bit-stream-utils.8byte.h.

References bit_offset_, impala::BitUtil::Ceil(), and offset_.

Referenced by GetNextBytePtr().

void impala::BitWriter_8byte::Clear ( )
inline

Definition at line 42 of file bit-stream-utils.8byte.h.

References bit_offset_, buffer_, max_bytes_, and offset_.

uint8_t * impala::BitWriter_8byte::GetNextBytePtr ( int  num_bytes = 1)
inline

Get a pointer to the next aligned byte and advance the underlying buffer by num_bytes. Returns NULL if there was not enough space.

Definition at line 45 of file bit-stream-utils.8byte.inline.h.

References bit_offset_, buffer_, bytes_written(), max_bytes_, offset_, impala::BitUtil::RoundUpNumBytes(), and UNLIKELY.

Referenced by PutAligned().

template<typename T >
bool impala::BitWriter_8byte::PutAligned ( v,
int  num_bits 
)
inline

Writes v to the next aligned byte.

Definition at line 65 of file bit-stream-utils.8byte.inline.h.

References GetNextBytePtr(), and PutValue().

bool impala::BitWriter_8byte::PutValue ( uint64_t  v,
int  num_bits 
)
inline

Writes a value to the buffer. This is bit packed. Returns false if there was not enough space.

Definition at line 23 of file bit-stream-utils.8byte.inline.h.

References bit_offset_, buffer_, max_bytes_, offset_, and UNLIKELY.

Referenced by PutAligned(), and TestBitWriter8ByteEncode().

bool impala::BitWriter_8byte::PutVlqInt ( int32_t  v)
inline

Write a Vlq encoded int to the buffer. Returns false if there was not enough room. The value is written byte aligned. For more details on vlq: en.wikipedia.org/wiki/Variable-length_quantity

Definition at line 76 of file bit-stream-utils.8byte.inline.h.

Member Data Documentation

int impala::BitWriter_8byte::bit_offset_
private

Definition at line 78 of file bit-stream-utils.8byte.h.

Referenced by bytes_written(), Clear(), GetNextBytePtr(), and PutValue().

uint64_t* impala::BitWriter_8byte::buffer_
private

Definition at line 75 of file bit-stream-utils.8byte.h.

Referenced by buffer(), Clear(), GetNextBytePtr(), and PutValue().

int impala::BitWriter_8byte::max_bytes_
private

Definition at line 76 of file bit-stream-utils.8byte.h.

Referenced by buffer_len(), Clear(), GetNextBytePtr(), and PutValue().

int impala::BitWriter_8byte::offset_
private

Definition at line 77 of file bit-stream-utils.8byte.h.

Referenced by bytes_written(), Clear(), GetNextBytePtr(), and PutValue().


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