Stxxl  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
stxxl::block_manager Class Reference

Block manager class. More...

#include <mng.h>

Collaboration diagram for stxxl::block_manager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

template<class DiskAssignFunctor , class BIDIteratorClass >
void new_blocks (const DiskAssignFunctor &functor, BIDIteratorClass bidbegin, BIDIteratorClass bidend, unsigned_type offset=0)
 Allocates new blocks.
template<class BlockType , class DiskAssignFunctor , class BIDIteratorClass >
void new_blocks (const unsigned_type nblocks, const DiskAssignFunctor &functor, BIDIteratorClass out, unsigned_type offset=0)
template<typename DiskAssignFunctor , unsigned BLK_SIZE>
void new_block (const DiskAssignFunctor &functor, BID< BLK_SIZE > &bid, unsigned_type offset=0)
template<class BIDIteratorClass >
void delete_blocks (const BIDIteratorClass &bidbegin, const BIDIteratorClass &bidend)
 Deallocates blocks.
template<unsigned BLK_SIZE>
void delete_block (const BID< BLK_SIZE > &bid)
 Deallocates a block.
 ~block_manager ()
unsigned long long current_allocated () const
unsigned long long max_allocated () const
template<class BIDType , class DiskAssignFunctor , class OutputIterator >
void new_blocks_int (const unsigned_type nblocks, const DiskAssignFunctor &functor, unsigned_type offset, OutputIterator out)

Protected Member Functions

template<class BIDType , class DiskAssignFunctor , class BIDIteratorClass >
void new_blocks_int (const unsigned_type nblocks, const DiskAssignFunctor &functor, unsigned_type offset, BIDIteratorClass out)

Private Member Functions

 block_manager ()

Private Attributes

DiskAllocator ** disk_allocators
file ** disk_files
unsigned ndisks
unsigned long long m_totalalloc
unsigned long long m_maxalloc

Detailed Description

Block manager class.

Manages allocation and deallocation of blocks in multiple/single disk setting

Remarks:
is a singleton
Examples:
mng/test_buf_streams.cpp, mng/test_mng.cpp, mng/test_pool_pair.cpp, and mng/test_read_write_pool.cpp.

Definition at line 59 of file mng.h.


Constructor & Destructor Documentation

Definition at line 40 of file mng.cpp.


Member Function Documentation

unsigned long long stxxl::block_manager::current_allocated ( ) const [inline]

Definition at line 153 of file mng.h.

unsigned long long stxxl::block_manager::max_allocated ( ) const [inline]

Definition at line 158 of file mng.h.

template<typename DiskAssignFunctor , unsigned BLK_SIZE>
void stxxl::block_manager::new_block ( const DiskAssignFunctor &  functor,
BID< BLK_SIZE > &  bid,
unsigned_type  offset = 0 
) [inline]

Allocates a new block according to the strategy given by functor and stores the block identifier to bid. Allocation will be lined up with previous partial allocations of offset blocks.

Parameters:
functorobject of model of allocation_strategy concept
bidBID to store the block identifier
offsetadvance for functor to line up partial allocations
Examples:
mng/test_pool_pair.cpp, and mng/test_read_write_pool.cpp.

Definition at line 133 of file mng.h.

Referenced by stxxl::ksort(), stxxl::ksort_local::ksort_blocks(), main(), stxxl::sort(), and stxxl::sort_local::sort_blocks().

template<class DiskAssignFunctor , class BIDIteratorClass >
void stxxl::block_manager::new_blocks ( const DiskAssignFunctor &  functor,
BIDIteratorClass  bidbegin,
BIDIteratorClass  bidend,
unsigned_type  offset = 0 
) [inline]
template<class BlockType , class DiskAssignFunctor , class BIDIteratorClass >
void stxxl::block_manager::new_blocks ( const unsigned_type  nblocks,
const DiskAssignFunctor &  functor,
BIDIteratorClass  out,
unsigned_type  offset = 0 
) [inline]

Allocates new blocks according to the strategy given by functor and stores block identifiers to the output iterator out Allocation will be lined up with previous partial allocations of offset blocks.

Parameters:
nblocksthe number of blocks to allocate
functorobject of model of allocation_strategy concept
outiterator object of OutputIterator concept
offsetadvance for functor to line up partial allocations

The BlockType template parameter defines the type of block to allocate

Definition at line 114 of file mng.h.

template<class BIDType , class DiskAssignFunctor , class BIDIteratorClass >
void stxxl::block_manager::new_blocks_int ( const unsigned_type  nblocks,
const DiskAssignFunctor &  functor,
unsigned_type  offset,
BIDIteratorClass  out 
) [protected]

Member Data Documentation

Definition at line 63 of file mng.h.

Definition at line 64 of file mng.h.

unsigned long long stxxl::block_manager::m_maxalloc [private]

Definition at line 69 of file mng.h.

unsigned long long stxxl::block_manager::m_totalalloc [private]

Definition at line 69 of file mng.h.

unsigned stxxl::block_manager::ndisks [private]

Definition at line 66 of file mng.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines