TPIE

11a2c2d
tpie::compressor_buffer Class Reference

A buffer for elements belonging to a specific stream block. More...

#include <tpie/compressed/buffer.h>

Public Member Functions

 compressor_buffer (memory_size_type capacity)
 
compressor_buffer_state::type get_state () const
 
void set_state (compressor_buffer_state::type to)
 
void transition_state (compressor_buffer_state::type from, compressor_buffer_state::type to)
 
bool is_busy ()
 
char * get ()
 Get pointer to buffer storage. More...
 
const char * get () const
 Get pointer to buffer storage. More...
 
memory_size_type size () const
 Get number of bytes used to store items. More...
 
memory_size_type capacity () const
 Get maximal byte size of buffer. More...
 
void set_size (memory_size_type size)
 Set number of bytes used to store items. More...
 
void set_capacity (memory_size_type capacity)
 Resize internal buffer, clearing all elements. More...
 
void reset ()
 Return buffer to a newly constructed state. More...
 
memory_size_type get_block_size ()
 
stream_size_type get_read_offset ()
 
void set_block_size (memory_size_type s)
 
void set_read_offset (stream_size_type s)
 

Detailed Description

A buffer for elements belonging to a specific stream block.

Definition at line 85 of file buffer.h.

Member Function Documentation

◆ capacity()

memory_size_type tpie::compressor_buffer::capacity ( ) const
inline

Get maximal byte size of buffer.

Definition at line 159 of file buffer.h.

159  {
160  return m_storage.size();
161  }

References tpie::array< T, Allocator >::size().

Referenced by set_capacity().

◆ get() [1/2]

char* tpie::compressor_buffer::get ( )
inline

Get pointer to buffer storage.

Definition at line 138 of file buffer.h.

138  {
139  return m_storage.get();
140  }

References tpie::array< T, Allocator >::get().

◆ get() [2/2]

const char* tpie::compressor_buffer::get ( ) const
inline

Get pointer to buffer storage.

Definition at line 145 of file buffer.h.

145  {
146  return m_storage.get();
147  }

References tpie::array< T, Allocator >::get().

◆ reset()

void tpie::compressor_buffer::reset ( )
inline

Return buffer to a newly constructed state.

Definition at line 181 of file buffer.h.

181  {
183  m_size = 0;
184  m_readOffset = 1111111111111111111ull;
185  m_blockSize = std::numeric_limits<memory_size_type>::max();
186  }

References tpie::compressor_buffer_state::dirty.

◆ set_capacity()

void tpie::compressor_buffer::set_capacity ( memory_size_type  capacity)
inline

Resize internal buffer, clearing all elements.

Definition at line 173 of file buffer.h.

173  {
174  m_storage.resize(capacity);
175  m_size = 0;
176  }

References capacity(), and tpie::array< T, Allocator >::resize().

◆ set_size()

void tpie::compressor_buffer::set_size ( memory_size_type  size)
inline

Set number of bytes used to store items.

Definition at line 166 of file buffer.h.

166  {
167  m_size = size;
168  }

References size().

◆ size()

memory_size_type tpie::compressor_buffer::size ( ) const
inline

Get number of bytes used to store items.

Definition at line 152 of file buffer.h.

152  {
153  return m_size;
154  }

Referenced by set_size().


The documentation for this class was generated from the following file:
tpie::compressor_buffer::capacity
memory_size_type capacity() const
Get maximal byte size of buffer.
Definition: buffer.h:159
tpie::compressor_buffer_state::dirty
@ dirty
The buffer is different from the contents on the disk.
Definition: buffer.h:69
tpie::compressor_buffer::size
memory_size_type size() const
Get number of bytes used to store items.
Definition: buffer.h:152
tpie::array::get
T * get()
Return a raw pointer to the array content.
Definition: array.h:536
tpie::array::resize
void resize(size_t size, const T &elm)
Change the size of the array.
Definition: array.h:490
tpie::array::size
size_type size() const
Return the size of the array.
Definition: array.h:531