#include <ByteBuffer.hpp>
Public Member Functions | |
ByteBuffer (size_t size=0) throw (std::bad_alloc) | |
ByteBuffer (const ByteBuffer &buffer) throw (std::bad_alloc) | |
~ByteBuffer () | |
size_t | capacity () const |
void | clear () |
char * | data () |
const char * | data () const |
bool | empty () const |
void | free () |
ByteBuffer & | operator= (const ByteBuffer &buffer) throw (std::bad_alloc) |
bool | operator== (const ByteBuffer &buffer) const |
bool | operator!= (const ByteBuffer &buffer) const |
void | resize (size_t size) throw (std::bad_alloc) |
size_t | size () const |
Private Attributes | |
char * | data_ |
size_t | capacity_ |
size_t | size_ |
A class template of a concrete Value. This class represents raw byte buffer.
Created on Jun 22, 2008
Definition at line 23 of file ByteBuffer.hpp.
aitools::invertedindex::ByteBuffer::ByteBuffer | ( | size_t | size = 0 |
) | throw (std::bad_alloc) |
The explicit constructor. The byte buffer has a initial size of size
.
Definition at line 4 of file ByteBuffer.cpp.
aitools::invertedindex::ByteBuffer::ByteBuffer | ( | const ByteBuffer & | buffer | ) | throw (std::bad_alloc) |
The copy constructor.
Definition at line 16 of file ByteBuffer.cpp.
aitools::invertedindex::ByteBuffer::~ByteBuffer | ( | ) |
The destructor.
Definition at line 28 of file ByteBuffer.cpp.
size_t aitools::invertedindex::ByteBuffer::capacity | ( | ) | const |
Get the size of the allocated memory.
Definition at line 34 of file ByteBuffer.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
void aitools::invertedindex::ByteBuffer::clear | ( | ) |
Sets the internal buffer size to zero. Since the memory will not be deallocated, the capacity does not change.
Definition at line 40 of file ByteBuffer.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
const char * aitools::invertedindex::ByteBuffer::data | ( | ) | const |
Get read access to the allocated memory.
Definition at line 52 of file ByteBuffer.cpp.
char * aitools::invertedindex::ByteBuffer::data | ( | ) |
Get write access to the allocated memory.
Definition at line 46 of file ByteBuffer.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), aitools::invertedindex::PostlistBuilder::build(), aitools::invertedindex::ExternalMergeSort::merge(), aitools::invertedindex::Iterator::swap(), aitools::invertedindex::ExternalMergeSort::swap_out(), aitools::invertedindex::Triple< T1, T2, T3 >::to_bytes(), aitools::invertedindex::Single< T >::to_bytes(), aitools::invertedindex::Quadruple< T1, T2, T3, T4 >::to_bytes(), aitools::invertedindex::PairString< T >::to_bytes(), aitools::invertedindex::Iterator::value(), and aitools::invertedindex::Value::wrap().
bool aitools::invertedindex::ByteBuffer::empty | ( | ) | const |
Check if the buffer is empty.
Definition at line 58 of file ByteBuffer.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
void aitools::invertedindex::ByteBuffer::free | ( | ) |
Deallocate the entire buffer memory. The buffer has a size and capacity of 0 afterwards.
Definition at line 64 of file ByteBuffer.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
bool aitools::invertedindex::ByteBuffer::operator!= | ( | const ByteBuffer & | buffer | ) | const |
Definition at line 91 of file ByteBuffer.cpp.
ByteBuffer & aitools::invertedindex::ByteBuffer::operator= | ( | const ByteBuffer & | buffer | ) | throw (std::bad_alloc) |
The assignment operator with deep-copy behavior.
Definition at line 76 of file ByteBuffer.cpp.
bool aitools::invertedindex::ByteBuffer::operator== | ( | const ByteBuffer & | buffer | ) | const |
Definition at line 84 of file ByteBuffer.cpp.
void aitools::invertedindex::ByteBuffer::resize | ( | size_t | size | ) | throw (std::bad_alloc) |
Allocates <size> bytes of memory.
size | the new size of the byte buffer. |
Definition at line 97 of file ByteBuffer.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), aitools::invertedindex::ExternalMergeSort::merge(), aitools::invertedindex::Iterator::swap(), aitools::invertedindex::Triple< T1, T2, T3 >::to_bytes(), aitools::invertedindex::Single< T >::to_bytes(), aitools::invertedindex::Quadruple< T1, T2, T3, T4 >::to_bytes(), aitools::invertedindex::PairString< T >::to_bytes(), and write_postlist().
size_t aitools::invertedindex::ByteBuffer::size | ( | ) | const |
Get the size of the byte array.
Definition at line 113 of file ByteBuffer.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), aitools::invertedindex::ExternalMergeSort::swap_out(), and aitools::invertedindex::Value::wrap().
size_t aitools::invertedindex::ByteBuffer::capacity_ [private] |
Definition at line 105 of file ByteBuffer.hpp.
char* aitools::invertedindex::ByteBuffer::data_ [private] |
Definition at line 104 of file ByteBuffer.hpp.
size_t aitools::invertedindex::ByteBuffer::size_ [private] |
Definition at line 106 of file ByteBuffer.hpp.