Stxxl  1.3.2
Public Types | Public Member Functions | Static Public Member Functions | List of all members
typed_block< RawSize_, T_, NRef_, InfoType_ > Class Template Reference

Block containing elements of fixed length. More...

#include <typed_block.h>

Inheritance diagram for typed_block< RawSize_, T_, NRef_, InfoType_ >:
Inheritance graph
[legend]
Collaboration diagram for typed_block< RawSize_, T_, NRef_, InfoType_ >:
Collaboration graph
[legend]

Public Types

enum  constants { raw_size = RawSize_, size = Base::size, has_only_data = (raw_size == (size * sizeof(value_type))) }
 
typedef T_ value_type
 
typedef value_type & reference
 
typedef const value_type & const_reference
 
typedef value_type * pointer
 
typedef pointer iterator
 
typedef const value_type * const_pointer
 
typedef const_pointer const_iterator
 
typedef BID< raw_sizebid_type
 
- Public Types inherited from block_w_info< T_, RawSize_, NRef_, InfoType_ >
typedef InfoType_ info_type
 Type of per block information element. More...
 
- Public Types inherited from block_w_bids< T_,((RawSize_-sizeof(BID< RawSize_ >)*NBids_-sizeof(InfoType_))/sizeof(T_)), RawSize_, NBids_ >
enum  
 
typedef BID< raw_size > bid_type
 
- Public Types inherited from element_block< T_, Size_ >
enum  
 
typedef T_ type
 
typedef T_ value_type
 
typedef T_ & reference
 
typedef const T_ & const_reference
 
typedef type * pointer
 
typedef pointer iterator
 
typedef const type * const_iterator
 

Public Member Functions

request_ptr write (const bid_type &bid, completion_handler on_cmpl=default_completion_handler())
 Writes block to the disk(s) ! More...
 
request_ptr read (const bid_type &bid, completion_handler on_cmpl=default_completion_handler())
 Reads block from the disk(s) ! More...
 
- Public Member Functions inherited from block_w_bids< T_,((RawSize_-sizeof(BID< RawSize_ >)*NBids_-sizeof(InfoType_))/sizeof(T_)), RawSize_, NBids_ >
bid_typeoperator() (int i)
 An operator to access bid references. More...
 
- Public Member Functions inherited from element_block< T_, Size_ >
reference operator[] (int i)
 An operator to access elements in the block. More...
 
iterator begin ()
 Returns iterator pointing to the first element. More...
 
const_iterator begin () const
 Returns const_iterator pointing to the first element. More...
 
const_iterator cbegin () const
 Returns const_iterator pointing to the first element. More...
 
iterator end ()
 Returns iterator pointing to the end element. More...
 
const_iterator end () const
 Returns const_iterator pointing to the end element. More...
 
const_iterator cend () const
 Returns const_iterator pointing to the end element. More...
 

Static Public Member Functions

static void * operator new (size_t bytes)
 
static void * operator new[] (size_t bytes)
 
static void * operator new (size_t, void *ptr)
 
static void operator delete (void *ptr)
 
static void operator delete[] (void *ptr)
 
static void operator delete (void *, void *)
 

Additional Inherited Members

- Public Attributes inherited from block_w_info< T_, RawSize_, NRef_, InfoType_ >
info_type info
 Per block information element. More...
 
- Public Attributes inherited from block_w_bids< T_,((RawSize_-sizeof(BID< RawSize_ >)*NBids_-sizeof(InfoType_))/sizeof(T_)), RawSize_, NBids_ >
bid_type ref [nbids]
 Array of BID references. More...
 
- Public Attributes inherited from element_block< T_, Size_ >
T_ elem [size]
 Array of elements of type T. More...
 

Detailed Description

template<unsigned RawSize_, class T_, unsigned NRef_ = 0, class InfoType_ = void>
class typed_block< RawSize_, T_, NRef_, InfoType_ >

Block containing elements of fixed length.

Template Parameters
RawSize_size of block in bytes
T_type of block's records
NRef_number of block references (BIDs) that can be stored in the block (default is 0)
InfoType_type of per block information (default is no information - void)

The data array of type T_ is contained in the parent class stxxl::element_block, see related information there. The BID array of references is contained in the parent class stxxl::block_w_bids, see related information there. The "per block information" is contained in the parent class stxxl::block_w_info, see related information there.

Warning
If RawSize_ > 2MB object(s) of this type can not be allocated on the stack (as a function variable for example), because Linux POSIX library limits the stack size for the main thread to (2MB - system page size)

Member Enumeration Documentation

template<unsigned RawSize_, class T_ , unsigned NRef_ = 0, class InfoType_ = void>
enum typed_block::constants
Enumerator
raw_size 

size of block in bytes

size 

number of elements in block

has_only_data 

no meta info, bids or (non-empty) fillers included in the block, allows value_type array addressing across block boundaries

Member Function Documentation

template<unsigned RawSize_, class T_ , unsigned NRef_ = 0, class InfoType_ = void>
request_ptr typed_block< RawSize_, T_, NRef_, InfoType_ >::read ( const bid_type bid,
completion_handler  on_cmpl = default_completion_handler() 
)
inline

Reads block from the disk(s) !

Parameters
bidblock identifier, points the file(disk) and position !
on_cmplcompletion handler !
Returns
pointer_ptr object to track status I/O operation after the call

References file::aread(), BID< SIZE >::offset, typed_block< RawSize_, T_, NRef_, InfoType_ >::raw_size, and BID< SIZE >::storage.

template<unsigned RawSize_, class T_ , unsigned NRef_ = 0, class InfoType_ = void>
request_ptr typed_block< RawSize_, T_, NRef_, InfoType_ >::write ( const bid_type bid,
completion_handler  on_cmpl = default_completion_handler() 
)
inline

Writes block to the disk(s) !

Parameters
bidblock identifier, points the file(disk) and position !
on_cmplcompletion handler !
Returns
pointer_ptr object to track status I/O operation after the call

References file::awrite(), BID< SIZE >::offset, typed_block< RawSize_, T_, NRef_, InfoType_ >::raw_size, and BID< SIZE >::storage.


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