Lumiera  0.pre.03
»edit your freedom«
hetero-data.hpp File Reference

Go to the source code of this file.

Description

Maintain a chained sequence of heterogeneous data blocks without allocation.

This building block for low-level memory management allows to build up a collection of entirely arbitrary data placed into existing and possibly distributed storage. The safety of storage and lifetime must be ensured by other means, since data access proceeds without further bound checks. However, a type-safe compile-time overlay of accessor marker types is provided, allowing to integrate such a storage layout into an overall memory safe arrangement.

A usage scenario would be gradually to build up an assortment of data elements directly in local automatic storage within an elaborate recursive call stack unfolding recursively. Notably the accessor marker types can be assembled independently from the provision of actual storage, as the connection between accessor and actual storage address is established late, on actual data access. Obviously, data access in such an arrangement requires traversal in several steps, which, on the other hand, can be justified by a good cache locality of recently used stack frames, thereby avoiding heap allocations altogether.

Usage

Warning
it is essential to understand where actual storage resides! A HeteroData chain is built-up gradually, starting with a front-block
  • the front-block is usually placed at an anchor location and populated with data
  • retrieve a chain constructor type from the type of the front-block, i.e HeteroData<D1,D2,...>::Chain<D21,...>
  • use this chain constructor to create a follow-up data block elsewhere
  • need to link this data block explicitly into the front
  • get accessor types from the chain constructor
  • use these to work with individual data elements through the front-block.

Definition in file hetero-data.hpp.

#include "lib/error.hpp"
#include "lib/nocopy.hpp"
#include "lib/meta/typelist.hpp"
#include "lib/meta/typelist-manip.hpp"
#include "lib/meta/typelist-util.hpp"
#include "lib/meta/typeseq-util.hpp"
#include <utility>
#include <tuple>

Classes

struct  HeteroData< meta::Node< StorageFrame< seg, DATA... >, TAIL > >::Accessor< slot >
 Accessor-functor to get at the data residing within some tuple element Using the enclosing typed scope to ensure safe storage access. More...
 
struct  HeteroData< meta::Node< StorageFrame< seg, DATA... >, TAIL > >::Chain< VALS >
 Constructor-functor to build an extra data segment, which can then be linked to the chain. More...
 
class  HeteroData< DATA >
 A setup with chained data tuples residing in distributed storage. More...
 
class  HeteroData< DATA >
 A setup with chained data tuples residing in distributed storage. More...
 
class  HeteroData< meta::Node< StorageFrame< seg, DATA... >, TAIL > >
 
class  HeteroData< meta::NullType >
 
struct  StorageFrame< seg, DATA >
 individual storage frame in a chain, holding a data tuple More...
 
struct  StorageLoc
 linked list of StorageFrame elements More...
 
struct  tuple_element< I, lib::HeteroData< DATA... > >
 expose the type of the I-th element of a HeteroData chain More...
 
struct  tuple_element< I, lib::HeteroData< lib::meta::NullType > >
 
struct  tuple_element< I, lib::StorageFrame< seg, DATA... > >
 delegate to the type access of a StorageFrame's underlying tuple More...
 
struct  tuple_size< lib::HeteroData< DATA... > >
 determine compile-time fixed size of a HeteroData More...
 
struct  tuple_size< lib::StorageFrame< seg, DATA... > >
 determine compile-time fixed size of a StorageFrame More...
 

Functions

StorageLoc *& checkedTraversal (size_t segments, StorageLoc *last)
 

Namespaces

 lib
 Implementation namespace for support and library code.