codex
Loading...
Searching...
No Matches
codex::refl::SOA< T, S > Class Template Reference

Transparently stores T objects as contiguous arrays of each field. More...

#include <soa.hpp>

Inheritance diagram for codex::refl::SOA< T, S >:
Collaboration diagram for codex::refl::SOA< T, S >:

Public Types

template<std::size_t I>
using field_type
 (Value/decayed) type of field with index I.
 
template<std::size_t I>
using field_type
 (Value/decayed) type of field with index I.
 

Public Member Functions

std::size_t size (void) const
 
void push_back (T &&t={})
 
T operator[] (std::size_t i) const
 Indexed access to an element.
 
void set (std::size_t i, const T &t)
 Stores the value of each field of t.
 
void set (std::size_t i, T &&t)
 Stores the value of each field of t.
 
template<std::size_t I>
std::span< field_type< I > > field (void)
 Provides access to the contiguous storage of field I.
 
template<std::size_t I>
std::span< const field_type< I > > field (void) const
 
std::size_t size (void) const
 
void push_back (T &&t={})
 
T operator[] (std::size_t i) const
 Indexed access to an element.
 
void set (std::size_t i, const T &t)
 Stores the value of each field of t.
 
void set (std::size_t i, T &&t)
 Stores the value of each field of t.
 
template<std::size_t I>
std::span< field_type< I > > field (void)
 Provides access to the contiguous storage of field I.
 
template<std::size_t I>
std::span< const field_type< I > > field (void) const
 
template<std::size_t I>
auto field (void) -> std::span< field_type< I > >
 
template<std::size_t I>
auto field (void) const -> std::span< const field_type< I > >
 

Private Types

using base_type = detail::storage<T, S>
 
using base_type = detail::storage<T, S>
 

Detailed Description

template<typename T, typename S = detail::storage_descriptor>
class codex::refl::SOA< T, S >

Transparently stores T objects as contiguous arrays of each field.

The storage is a "transposition" of a T[]: a structure of arrays instead of an array of structures. This allows each field array to be processed sequentially (e.g. in SIMD fashion).

An interface similar to std::vector is also provided to add/set/remove elements of type T as if that were the actual storage. Access methods are also provided, although they return values that are manufactured on demand, not references as is the case for std::vector.

Member Typedef Documentation

◆ base_type [1/2]

template<typename T , typename S = detail::storage_descriptor>
using codex::refl::SOA< T, S >::base_type = detail::storage<T, S>
private

◆ base_type [2/2]

template<typename T , typename S = detail::storage_descriptor>
using codex::refl::SOA< T, S >::base_type = detail::storage<T, S>
private

◆ field_type [1/2]

template<typename T , typename S = detail::storage_descriptor>
template<std::size_t I>
using codex::refl::SOA< T, S >::field_type
Initial value:
std::decay_t<std::tuple_element_t<I, field_tuple_t<T>>>

(Value/decayed) type of field with index I.

◆ field_type [2/2]

template<typename T , typename S = detail::storage_descriptor>
template<std::size_t I>
using codex::refl::SOA< T, S >::field_type
Initial value:
std::decay_t<std::tuple_element_t<I, field_tuple_t<T>>>

(Value/decayed) type of field with index I.

Member Function Documentation

◆ field() [1/6]

template<typename T , typename S = detail::storage_descriptor>
template<std::size_t I>
std::span< field_type< I > > codex::refl::SOA< T, S >::field ( void )

Provides access to the contiguous storage of field I.

Here is the caller graph for this function:

◆ field() [2/6]

template<typename T , typename S = detail::storage_descriptor>
template<std::size_t I>
std::span< field_type< I > > codex::refl::SOA< T, S >::field ( void )

Provides access to the contiguous storage of field I.

◆ field() [3/6]

template<typename T , typename S >
template<std::size_t I>
auto codex::refl::SOA< T, S >::field ( void ) -> std::span<field_type<I>>

◆ field() [4/6]

template<typename T , typename S = detail::storage_descriptor>
template<std::size_t I>
std::span< const field_type< I > > codex::refl::SOA< T, S >::field ( void ) const

◆ field() [5/6]

template<typename T , typename S = detail::storage_descriptor>
template<std::size_t I>
std::span< const field_type< I > > codex::refl::SOA< T, S >::field ( void ) const

◆ field() [6/6]

template<typename T , typename S >
template<std::size_t I>
auto codex::refl::SOA< T, S >::field ( void ) const -> std::span<const field_type<I>>

◆ operator[]() [1/2]

template<typename T , typename S >
T codex::refl::SOA< T, S >::operator[] ( std::size_t i) const

Indexed access to an element.

The returned value (n.b.: not a reference) is manufactured from the values of each field gathered from the storage.

Here is the call graph for this function:

◆ operator[]() [2/2]

template<typename T , typename S = detail::storage_descriptor>
T codex::refl::SOA< T, S >::operator[] ( std::size_t i) const

Indexed access to an element.

The returned value (n.b.: not a reference) is manufactured from the values of each field gathered from the storage.

◆ push_back() [1/2]

template<typename T , typename S >
void codex::refl::SOA< T, S >::push_back ( T && t = {})
Here is the call graph for this function:

◆ push_back() [2/2]

template<typename T , typename S = detail::storage_descriptor>
void codex::refl::SOA< T, S >::push_back ( T && t = {})

◆ set() [1/4]

template<typename T , typename S >
void codex::refl::SOA< T, S >::set ( std::size_t i,
const T & t )

Stores the value of each field of t.

Here is the call graph for this function:

◆ set() [2/4]

template<typename T , typename S = detail::storage_descriptor>
void codex::refl::SOA< T, S >::set ( std::size_t i,
const T & t )

Stores the value of each field of t.

◆ set() [3/4]

template<typename T , typename S >
void codex::refl::SOA< T, S >::set ( std::size_t i,
T && t )

Stores the value of each field of t.

Here is the call graph for this function:

◆ set() [4/4]

template<typename T , typename S = detail::storage_descriptor>
void codex::refl::SOA< T, S >::set ( std::size_t i,
T && t )

Stores the value of each field of t.

◆ size() [1/2]

template<typename T , typename S = detail::storage_descriptor>
std::size_t codex::refl::SOA< T, S >::size ( void ) const
inline
Here is the call graph for this function:

◆ size() [2/2]

template<typename T , typename S = detail::storage_descriptor>
std::size_t codex::refl::SOA< T, S >::size ( void ) const
inline
Here is the call graph for this function:

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