B-Trees
B-tree implementation in C++ to index documents based on numerical id's and title strings.
Public Attributes | List of all members
Block< T, BlockSize > Union Template Reference

Union for reading and writing blocks containing serialized data. More...

#include <Block.hpp>

Public Attributes

char padding [BlockSize]
 Byte array used to guarantee that the instance will have at least BLOCK_SIZE bytes. More...
 
var
 Member used to access the wrapped value. More...
 

Detailed Description

template<typename T, unsigned int BlockSize = BLOCK_SIZE>
union Block< T, BlockSize >

Union for reading and writing blocks containing serialized data.

Wraps a T-type value within a block-sized memory space. T must be a POD (Plain Old Data type).

The condition sizeof(T) <= BLOCK_SIZE must be satisfied. Otherwise, the stored value will be bigger than the block size and reading and writing will be compromised.

This union is used to guarantee that written data in the files will always individually occupy exactly one block in size. The remaining unused bytes will have undefined values in the file.

After using Block instances to write a file, use Block again when reading the file.

Template Parameters
TType of the data to be stored within the block

Member Data Documentation

template<typename T, unsigned int BlockSize = BLOCK_SIZE>
char Block< T, BlockSize >::padding[BlockSize]

Byte array used to guarantee that the instance will have at least BLOCK_SIZE bytes.

template<typename T, unsigned int BlockSize = BLOCK_SIZE>
T Block< T, BlockSize >::var

Member used to access the wrapped value.


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