Thrill  0.1
typed_block< RawSize, Type, NRef, MetaInfoType > Class Template Reference

Detailed Description

template<size_t RawSize, typename Type, size_t NRef = 0, typename MetaInfoType = void>
class foxxll::typed_block< RawSize, Type, NRef, MetaInfoType >

Block containing elements of fixed length.

Template Parameters
RawSizesize of block in bytes
Typetype of block's records
NRefnumber of block references (BIDs) that can be stored in the block (default is 0)
MetaInfoTypetype of per block information (default is no information - void)

The data array of type Type is contained in the parent class foxxll::element_block, see related information there. The BID array of references is contained in the parent class foxxll::block_w_bids, see related information there. The "per block information" is contained in the parent class foxxll::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)

Definition at line 266 of file typed_block.hpp.

+ Inheritance diagram for typed_block< RawSize, Type, NRef, MetaInfoType >:
+ Collaboration diagram for typed_block< RawSize, Type, NRef, MetaInfoType >:

#include <typed_block.hpp>

Public Types

using bid_type = BID< raw_size >
 
using const_iterator = const_pointer
 
using const_pointer = const value_type *
 
using const_reference = const value_type &
 
using iterator = pointer
 
using pointer = value_type *
 
using reference = value_type &
 
using value_type = Type
 
- Public Types inherited from block_w_info< Type, RawSize, NRef, MetaInfoType >
using info_type = MetaInfoType
 Type of per block information element. More...
 
- Public Types inherited from block_w_bids< Type,((RawSize - sizeof(BID< RawSize >) *NBids - sizeof(MetaInfoType))/sizeof(Type)), RawSize, NBids >
using bid_type = BID< raw_size >
 
- Public Types inherited from element_block< Type, Size >
using const_iterator = const type *
 
using const_reference = const Type &
 
using iterator = pointer
 
using pointer = type *
 
using reference = Type &
 
using type = Type
 
using value_type = Type
 

Public Member Functions

 typed_block ()
 
 ~typed_block ()
 
request_ptr read (const bid_type &bid, completion_handler on_complete=completion_handler())
 Reads block from the disk(s). More...
 
request_ptr read (const BID< 0 > &bid, completion_handler on_complete=completion_handler())
 Reads block from the disk(s). More...
 
request_ptr write (const bid_type &bid, completion_handler on_complete=completion_handler())
 Writes block to the disk(s). More...
 
request_ptr write (const BID< 0 > &bid, completion_handler on_complete=completion_handler())
 Writes block to the disk(s). More...
 
- Public Member Functions inherited from add_filler< mng_local::block_w_info< Type, RawSize, NRef, MetaInfoType >, RawSize - sizeof(mng_local::block_w_info< Type, RawSize, NRef, MetaInfoType >)>
 add_filler ()
 
- Public Member Functions inherited from block_w_info< Type, RawSize, NRef, MetaInfoType >
 block_w_info ()
 
- Public Member Functions inherited from block_w_bids< Type,((RawSize - sizeof(BID< RawSize >) *NBids - sizeof(MetaInfoType))/sizeof(Type)), RawSize, NBids >
 block_w_bids ()
 
bid_typeoperator() (size_t i)
 An operator to access bid references. More...
 
- Public Member Functions inherited from element_block< Type, Size >
 element_block ()
 
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...
 
const_iterator cend () const
 Returns const_iterator pointing to the end 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...
 
reference operator[] (size_t i)
 An operator to access elements in the block. More...
 

Static Public Member Functions

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

Static Public Attributes

static constexpr bool has_only_data = (raw_size == (size * sizeof(value_type)))
 no meta info, bids or (non-empty) fillers included in the block, allows value_type array addressing across block boundaries More...
 
static constexpr size_t raw_size = RawSize
 size of block in bytes More...
 
static constexpr size_t size = Base::size
 number of elements in block More...
 
- Static Public Attributes inherited from block_w_bids< Type,((RawSize - sizeof(BID< RawSize >) *NBids - sizeof(MetaInfoType))/sizeof(Type)), RawSize, NBids >
static constexpr size_t kNBIDs
 
static constexpr size_t raw_size
 
- Static Public Attributes inherited from element_block< Type, Size >
static constexpr size_t size
 number of elements in the block More...
 

Private Types

using Base = mng_local::expand_struct< mng_local::block_w_info< Type, RawSize, NRef, MetaInfoType >, RawSize >
 

Static Private Attributes

static constexpr bool debug_block_life_cycle = false
 

Additional Inherited Members

- Public Attributes inherited from block_w_info< Type, RawSize, NRef, MetaInfoType >
info_type info
 Per block information element. More...
 
- Public Attributes inherited from block_w_bids< Type,((RawSize - sizeof(BID< RawSize >) *NBids - sizeof(MetaInfoType))/sizeof(Type)), RawSize, NBids >
bid_type ref [kNBIDs]
 Array of BID references. More...
 
- Public Attributes inherited from element_block< Type, Size >
value_type elem [kSize]
 Array of elements of type Type. More...
 

Member Typedef Documentation

◆ Base

using Base = mng_local::expand_struct<mng_local::block_w_info<Type, RawSize, NRef, MetaInfoType>, RawSize>
private

Definition at line 269 of file typed_block.hpp.

◆ bid_type

using bid_type = BID<raw_size>

Definition at line 286 of file typed_block.hpp.

◆ const_iterator

Definition at line 280 of file typed_block.hpp.

◆ const_pointer

using const_pointer = const value_type *

Definition at line 279 of file typed_block.hpp.

◆ const_reference

using const_reference = const value_type &

Definition at line 276 of file typed_block.hpp.

◆ iterator

using iterator = pointer

Definition at line 278 of file typed_block.hpp.

◆ pointer

using pointer = value_type *

Definition at line 277 of file typed_block.hpp.

◆ reference

using reference = value_type &

Definition at line 275 of file typed_block.hpp.

◆ value_type

using value_type = Type

Definition at line 274 of file typed_block.hpp.

Constructor & Destructor Documentation

◆ typed_block()

typed_block ( )
inline

Definition at line 288 of file typed_block.hpp.

References foxxll::BlockAlignment, and TLX_LOGC.

◆ ~typed_block()

~typed_block ( )
inline

Definition at line 421 of file typed_block.hpp.

References TLX_LOGC.

Member Function Documentation

◆ operator delete() [1/2]

static void operator delete ( void *  ptr)
inlinestatic

Definition at line 398 of file typed_block.hpp.

◆ operator delete() [2/2]

static void operator delete ( void *  ,
void *   
)
inlinestatic

Definition at line 408 of file typed_block.hpp.

◆ operator delete[]()

static void operator delete[] ( void *  ptr)
inlinestatic

Definition at line 403 of file typed_block.hpp.

◆ operator new() [1/2]

static void* operator new ( size_t  bytes)
inlinestatic

Definition at line 359 of file typed_block.hpp.

References bytes, and TLX_LOGC.

◆ operator new() [2/2]

static void* operator new ( size_t  ,
void *  ptr 
)
inlinestatic

Definition at line 393 of file typed_block.hpp.

◆ operator new[]()

static void* operator new[] ( size_t  bytes)
inlinestatic

Definition at line 376 of file typed_block.hpp.

References bytes, and TLX_LOGC.

◆ read() [1/2]

request_ptr read ( const bid_type bid,
completion_handler  on_complete = completion_handler() 
)
inline

Reads block from the disk(s).

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

Definition at line 321 of file typed_block.hpp.

References file::aread(), BID< Size >::offset, BID< Size >::storage, and TLX_LOGC.

Referenced by swappable_block< ValueType, BlockSize >::read_async().

◆ read() [2/2]

request_ptr read ( const BID< 0 > &  bid,
completion_handler  on_complete = completion_handler() 
)
inline

Reads block from the disk(s).

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

Definition at line 350 of file typed_block.hpp.

References file::aread(), BID< 0 >::offset, BID< 0 >::size, BID< 0 >::storage, and TLX_LOGC.

◆ write() [1/2]

request_ptr write ( const bid_type bid,
completion_handler  on_complete = completion_handler() 
)
inline

Writes block to the disk(s).

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

Definition at line 307 of file typed_block.hpp.

References file::awrite(), BID< Size >::offset, BID< Size >::storage, and TLX_LOGC.

Referenced by swappable_block< ValueType, BlockSize >::clean_async().

◆ write() [2/2]

request_ptr write ( const BID< 0 > &  bid,
completion_handler  on_complete = completion_handler() 
)
inline

Writes block to the disk(s).

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

Definition at line 335 of file typed_block.hpp.

References file::awrite(), BID< 0 >::offset, BID< 0 >::size, BID< 0 >::storage, and TLX_LOGC.

Member Data Documentation

◆ debug_block_life_cycle

constexpr bool debug_block_life_cycle = false
staticprivate

Definition at line 271 of file typed_block.hpp.

◆ has_only_data

constexpr bool has_only_data = (raw_size == (size * sizeof(value_type)))
static

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

Definition at line 284 of file typed_block.hpp.

◆ raw_size

constexpr size_t raw_size = RawSize
static

size of block in bytes

Definition at line 282 of file typed_block.hpp.

◆ size

constexpr size_t size = Base::size
static

number of elements in block

Definition at line 283 of file typed_block.hpp.


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