TPIE

2362a60
tpie::blocks::block_collection Class Reference

A class to manage writing and reading of block to disk. More...

#include <tpie/blocks/block_collection.h>

Public Member Functions

 block_collection (std::string fileName, memory_size_type blockSize, bool writeable)
 Create a block collection. More...
 
 block_collection (const block_collection &)=delete
 
block_handle get_free_block ()
 Allocates a new block. More...
 
void free_block (block_handle handle)
 frees a block More...
 
void read_block (block_handle handle, block &b)
 Reads the content of a block from disk. More...
 
void write_block (block_handle handle, const block &b)
 Writes the content of a block to disk. More...
 

Detailed Description

A class to manage writing and reading of block to disk.

Definition at line 39 of file block_collection.h.

Constructor & Destructor Documentation

tpie::blocks::block_collection::block_collection ( std::string  fileName,
memory_size_type  blockSize,
bool  writeable 
)

Create a block collection.

Parameters
fileNamethe file in which blocks are saved
blockSizethe size of the blocks
writeableindicates whether the collection is writeable

Member Function Documentation

void tpie::blocks::block_collection::free_block ( block_handle  handle)

frees a block

Parameters
handlethe handle of the block to be freed
block_handle tpie::blocks::block_collection::get_free_block ( )

Allocates a new block.

Returns
the handle of the new block
void tpie::blocks::block_collection::read_block ( block_handle  handle,
block b 
)

Reads the content of a block from disk.

Parameters
handlethe handle of the block to read
bthe block to store the content in
void tpie::blocks::block_collection::write_block ( block_handle  handle,
const block b 
)

Writes the content of a block to disk.

Parameters
handlethe handle of the block to write
bthe block type in which the content is stored

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