STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::block_manager Class Reference

Detailed Description

Block manager class.

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

Remarks
is a singleton

Definition at line 61 of file block_manager.h.

+ Inheritance diagram for stxxl::block_manager:
+ Collaboration diagram for stxxl::block_manager:

Public Member Functions

 ~block_manager ()
 
template<unsigned BLK_SIZE>
void delete_block (const BID< BLK_SIZE > &bid)
 Deallocates a block. More...
 
template<class BIDIteratorClass >
void delete_blocks (const BIDIteratorClass &bidbegin, const BIDIteratorClass &bidend)
 Deallocates blocks. More...
 
uint64 get_current_allocation () const
 return currently allocated bytes More...
 
uint64 get_free_bytes () const
 Return total number of free disk allocations. More...
 
uint64 get_maximum_allocation () const
 return maximum number of bytes allocated during program run. More...
 
uint64 get_total_allocation () const
 return total requested allocation in bytes More...
 
uint64 get_total_bytes () const
 return total number of bytes available in all disks More...
 
template<typename DiskAssignFunctor , unsigned BLK_SIZE>
void new_block (const DiskAssignFunctor &functor, BID< BLK_SIZE > &bid, unsigned_type offset=0)
 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. More...
 
template<class DiskAssignFunctor , class BIDIteratorClass >
void new_blocks (const DiskAssignFunctor &functor, BIDIteratorClass bidbegin, BIDIteratorClass bidend, unsigned_type offset=0)
 Allocates new blocks. More...
 
template<class BlockType , class DiskAssignFunctor , class BIDIteratorClass >
void new_blocks (const unsigned_type nblocks, const DiskAssignFunctor &functor, BIDIteratorClass out, unsigned_type offset=0)
 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. More...
 
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

disk_allocator ** disk_allocators
 
file ** disk_files
 
uint64 m_current_allocation
 currently allocated bytes More...
 
uint64 m_maximum_allocation
 maximum number of bytes allocated during program run. More...
 
uint64 m_total_allocation
 total requested allocation in bytes More...
 
size_t ndisks
 

Additional Inherited Members

- Static Public Member Functions inherited from stxxl::singleton< block_manager >
static instance_pointer get_instance ()
 

Constructor & Destructor Documentation

stxxl::block_manager::~block_manager ( )

Definition at line 89 of file block_manager.cpp.

References STXXL_VERBOSE1.

Member Function Documentation

uint64 stxxl::block_manager::get_current_allocation ( ) const
inline

return currently allocated bytes

Definition at line 176 of file block_manager.h.

uint64 stxxl::block_manager::get_free_bytes ( ) const

Return total number of free disk allocations.

Definition at line 112 of file block_manager.cpp.

References total.

uint64 stxxl::block_manager::get_maximum_allocation ( ) const
inline

return maximum number of bytes allocated during program run.

Definition at line 180 of file block_manager.h.

uint64 stxxl::block_manager::get_total_allocation ( ) const
inline

return total requested allocation in bytes

Definition at line 172 of file block_manager.h.

uint64 stxxl::block_manager::get_total_bytes ( ) const

return total number of bytes available in all disks

Definition at line 102 of file block_manager.cpp.

References total.

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

Definition at line 150 of file block_manager.h.

Referenced by stxxl::ksort(), stxxl::ksort_local::ksort_blocks(), 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

Allocates new blocks.

Allocates new blocks according to the strategy given by functor and stores block identifiers to the range [ bidbegin, bidend) Allocation will be lined up with previous partial allocations of offset blocks.

Parameters
functorobject of model of allocation_strategy concept
bidbeginbidirectional BID iterator object
bidendbidirectional BID iterator object
offsetadvance for functor to line up partial allocations

Definition at line 109 of file block_manager.h.

Referenced by stxxl::hash_map::buffered_writer< BlockType, BidContainer >::append(), stxxl::priority_queue_local::ext_merger< BlockType, CompareType, Arity, AllocStr >::append_merger(), stxxl::stream::basic_runs_creator< Input, CompareType, BlockSize, AllocStr >::compute_result(), stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::compute_result(), stxxl::ppq_local::external_array< ValueType, BlockSize, AllocStrategy >::external_array(), stxxl::stream::runs_creator< from_sorted_sequences< ValueType >, CompareType, BlockSize, AllocStr >::finish(), stxxl::hash_map::buffered_writer< BlockType, BidContainer >::flush(), stxxl::ksort_local::ksort_blocks(), stxxl::stream::basic_runs_merger< RunsType, CompareType, AllocStr >::merge_recursively(), stxxl::stable_ksort_local::bid_sequence< BIDType, AllocStrategy >::operator[](), stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::push(), stxxl::stream::runs_creator< from_sorted_sequences< ValueType >, CompareType, BlockSize, AllocStr >::push(), and stxxl::sort_local::sort_blocks().

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 131 of file block_manager.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

disk_allocator** stxxl::block_manager::disk_allocators
private

Definition at line 65 of file block_manager.h.

file** stxxl::block_manager::disk_files
private

Definition at line 66 of file block_manager.h.

uint64 stxxl::block_manager::m_current_allocation
private

currently allocated bytes

Definition at line 76 of file block_manager.h.

uint64 stxxl::block_manager::m_maximum_allocation
private

maximum number of bytes allocated during program run.

Definition at line 79 of file block_manager.h.

uint64 stxxl::block_manager::m_total_allocation
private

total requested allocation in bytes

Definition at line 73 of file block_manager.h.

size_t stxxl::block_manager::ndisks
private

Definition at line 68 of file block_manager.h.


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