Traits for different layouts.
Layout Trait needs to have defined static functions:
size_t get_scalar_alignment(const ValueType type, [[optional(define only if you have using context_type)]] context_type& ctx);
size_t get_vec_alignment(const ValueType type, const size_t length, [[optional(define only if you have using context_type)]] context_type& ctx);
size_t get_array_alignment(const size_t elemBaseAlignment, [[optional(define only if you have using context_type)]] context_type& ctx);
size_t get_struct_alignment([[optional(define only if you have using context_type)]] context_type& ctx);
There are also optional functions:
- To make action before variable is added:
void before_add(size_t& currentOffset, [[optional(define only if you have using context_type)]] context_type& ctx);
void before_add_scalar(size_t& currentOffset, [[optional(define only if you have using context_type)]] context_type& ctx);
void before_add_vec(size_t& currentOffset, [[optional(define only if you have using context_type)]] context_type& ctx);
void before_add_mat(size_t& currentOffset, [[optional(define only if you have using context_type)]] context_type& ctx);
void before_add_array(size_t& currentOffset, [[optional(define only if you have using context_type)]] context_type& ctx);
void before_add_struct(size_t& currentOffset, [[optional(define only if you have using context_type)]] context_type& ctx);
- To make some action after variable was added:
void after_add(size_t& currentOffset, const size_t size, const size_t alignment, [[optional(define only if you have using context_type)]] context_type& ctx);
void after_add_scalar(size_t& currentOffset, const size_t size, const size_t alignment, [[optional(define only if you have using context_type)]] context_type& ctx);
void after_add_vec(size_t& currentOffset, const size_t size, const size_t alignment, [[optional(define only if you have using context_type)]] context_type& ctx);
void after_add_mat(size_t& currentOffset, const size_t size, const size_t alignment, [[optional(define only if you have using context_type)]] context_type& ctx);
void after_add_array(size_t& currentOffset, const size_t size, const size_t alignment, [[optional(define only if you have using context_type)]] context_type& ctx);
void after_add_struct(size_t& currentOffset, const size_t size, const size_t alignment, [[optional(define only if you have using context_type)]] context_type& ctx);