![]() |
Gaia-ECS v1.0.0
A simple and powerful entity component system
|
View policy for accessing and storing data in the SoA way. Good for SIMD processing. More...
#include <data_layout_policy.h>
Classes | |
| class | accessor |
| Proxy used to read or assign one complete SoA value. More... | |
Public Types | |
| using | TTuple = decltype(meta::struct_to_tuple(std::declval< ValueType >())) |
| Tuple representation of the reflected value fields. | |
| using | TargetCastType = uint8_t * |
| Pointer type used to address SoA storage. | |
| template<size_t Item> | |
| using | value_type = typename std::tuple_element< Item, TTuple >::type |
| Type of a reflected field. | |
| template<size_t Item> | |
| using | const_value_type = typename std::add_const< value_type< Item > >::type |
| Const-qualified type of a reflected field. | |
Static Public Member Functions | |
| GAIA_NODISCARD static constexpr uint32_t | get_min_byte_size (uintptr_t addr, size_t cnt) noexcept |
| Calculates the bytes required for an SoA value range. | |
| template<typename Allocator > | |
| static GAIA_NODISCARD uint8_t * | alloc (size_t cnt) noexcept |
| Allocates an SoA value range. | |
| template<typename Allocator > | |
| static void | free (void *pData, size_t cap, size_t cnt) noexcept |
| Releases an instrumented SoA value range. | |
| static void | mem_add_block (void *pData, size_t cap, size_t count) |
| Registers a newly allocated SoA range with the memory sanitizer. | |
| static void | mem_del_block (void *pData, size_t cap, size_t count) |
| Unregisters an SoA range from the memory sanitizer. | |
| static void | mem_push_block (void *pData, size_t cap, size_t count, size_t n) |
| Makes newly appended SoA values addressable by the memory sanitizer. | |
| static void | mem_pop_block (void *pData, size_t cap, size_t count, size_t n) |
| Poisons removed SoA values for the memory sanitizer. | |
| GAIA_NODISCARD static constexpr ValueType | get (std::span< const uint8_t > s, size_t idx) noexcept |
| Reconstructs a value from its SoA fields. | |
| template<size_t Item> | |
| GAIA_NODISCARD static constexpr auto | get (std::span< const uint8_t > s, size_t idx=0) noexcept |
| Returns a read-only span over one SoA field. | |
| GAIA_NODISCARD static constexpr auto | set (std::span< uint8_t > s, size_t idx) noexcept |
| Returns a mutable proxy for one complete value. | |
| template<size_t Item> | |
| GAIA_NODISCARD static constexpr auto | set (std::span< uint8_t > s, size_t idx=0) noexcept |
| Returns a mutable span over one SoA field. | |
Static Public Attributes | |
| static constexpr DataLayout | Layout = data_layout_properties<TDataLayout, ValueType>::Layout |
| Physical layout. | |
| static constexpr size_t | Alignment = data_layout_properties<TDataLayout, ValueType>::Alignment |
| Required byte alignment. | |
| static constexpr size_t | TTupleItems = std::tuple_size<TTuple>::value |
| Number of reflected fields. | |
View policy for accessing and storing data in the SoA way. Good for SIMD processing.
struct Foo { int x; int y; int z; }; using fooViewPolicy = data_view_policy<DataLayout::SoA, Foo>;
Memory organized as: xxxx yyyy zzzz
| using gaia::mem::data_view_policy_soa< TDataLayout, ValueType >::const_value_type = typename std::add_const<value_type<Item> >::type |
Const-qualified type of a reflected field.
| Item | Field index. |
| using gaia::mem::data_view_policy_soa< TDataLayout, ValueType >::value_type = typename std::tuple_element<Item, TTuple>::type |
Type of a reflected field.
| Item | Field index. |
|
inlinestaticnoexcept |
Allocates an SoA value range.
| Allocator | Allocator adaptor type. |
| cnt | Number of values. |
|
inlinestaticnoexcept |
Releases an instrumented SoA value range.
| Allocator | Allocator adaptor type. |
| pData | Allocated buffer, or null. |
| cap | Buffer capacity in values. |
| cnt | Number of live values. |
|
inlinestaticconstexprnoexcept |
Reconstructs a value from its SoA fields.
| s | Backing byte span. Its size is the value capacity. |
| idx | Value index. |
|
inlinestaticconstexprnoexcept |
Returns a read-only span over one SoA field.
| Item | Field index. |
| s | Backing byte span. Its size is the value capacity. |
| idx | First value index. |
|
inlinestaticconstexprnoexcept |
Calculates the bytes required for an SoA value range.
| addr | Starting address used for alignment calculations. |
| cnt | Number of values. |
|
inlinestatic |
Registers a newly allocated SoA range with the memory sanitizer.
| pData | Backing buffer. |
| cap | Buffer capacity in values. |
| count | Number of live values. |
|
inlinestatic |
Unregisters an SoA range from the memory sanitizer.
| pData | Backing buffer. |
| cap | Buffer capacity in values. |
| count | Number of live values. |
|
inlinestatic |
Poisons removed SoA values for the memory sanitizer.
| pData | Backing buffer. |
| cap | Buffer capacity in values. |
| count | Current number of live values. |
| n | Number of values being removed. |
|
inlinestatic |
Makes newly appended SoA values addressable by the memory sanitizer.
| pData | Backing buffer. |
| cap | Buffer capacity in values. |
| count | Current number of live values. |
| n | Number of values being appended. |
|
inlinestaticconstexprnoexcept |
Returns a mutable proxy for one complete value.
| s | Backing byte span. Its size is the value capacity. |
| idx | Value index. |
|
inlinestaticconstexprnoexcept |
Returns a mutable span over one SoA field.
| Item | Field index. |
| s | Backing byte span. Its size is the value capacity. |
| idx | First value index. |