Nebula
|
#include <arrayallocator.h>
The ArrayAllocator provides a variadic list of types which is to be contained in the allocator and fetching each value by providing the index into the list of types, which means the members are nameless.
Note that this is not a container for multiple arrays, but a object allocator that uses multiple arrays to store their variables parallelly, and should be treated as such.
There are two versions of this type, an unsafe and a safe one. Both are implemented in the same way.
The thread safe allocator requires the Get-methods to be within an Enter/Leave lockstep phase.
Public Member Functions | |
ArrayAllocator () | |
constructor | |
ArrayAllocator (ArrayAllocator< TYPES... > &&rhs) | |
move constructor | |
ArrayAllocator (const ArrayAllocator< TYPES... > &rhs) | |
copy constructor | |
~ArrayAllocator () | |
destructor | |
void | operator= (const ArrayAllocator< TYPES... > &rhs) |
assign operator | |
void | operator= (ArrayAllocator< TYPES... > &&rhs) |
move operator | |
uint32_t | Alloc () |
allocate a new resource | |
void | EraseIndex (const uint32_t id) |
Erase element for each. | |
void | EraseIndexSwap (const uint32_t id) |
Erase element for each. | |
void | EraseRange (const uint32_t start, const uint32_t end) |
erase range | |
template<int MEMBER> | |
tuple_array_t< MEMBER, TYPES... > & | Get (const uint32_t index) |
get single item from resource | |
template<int MEMBER> | |
const tuple_array_t< MEMBER, TYPES... > & | ConstGet (const uint32_t index) const |
same as 32 bit get, but const | |
template<int MEMBER> | |
void | Set (const uint32_t index, const tuple_array_t< MEMBER, TYPES... > &type) |
set single item | |
template<int MEMBER> | |
const Util::Array< tuple_array_t< MEMBER, TYPES... > > & | GetArray () const |
get array const reference | |
template<int MEMBER> | |
Util::Array< tuple_array_t< MEMBER, TYPES... > > & | GetArray () |
get array | |
void | Set (const uint32_t index, TYPES...) |
set for each in tuple | |
const uint32_t | Size () const |
get number of used indices | |
void | Reserve (uint32_t size) |
grow capacity of arrays to size | |
void | SetSize (uint32_t size) |
set size of arrays to param size | |
void | Clear () |
clear entire allocator and start from scratch. | |
void | UpdateSize () |
Any reserve and direct array access might mess with the size. | |
Protected Attributes | |
uint32_t | size |
std::tuple< Util::Array< TYPES >... > | objects |
|
inline |
constructor
|
inline |
move constructor
|
inline |
copy constructor
|
inline |
destructor
|
inline |
allocate a new resource
|
inline |
clear entire allocator and start from scratch.
|
inline |
same as 32 bit get, but const
|
inline |
Erase element for each.
|
inline |
Erase element for each.
|
inline |
erase range
|
inline |
get single item from resource
|
inline |
get array
|
inline |
get array const reference
|
inline |
move operator
|
inline |
assign operator
|
inline |
grow capacity of arrays to size
|
inline |
set single item
void Util::ArrayAllocator< TYPES >::Set | ( | const uint32_t | index, |
TYPES... | values ) |
set for each in tuple
|
inline |
set size of arrays to param size
|
inline |
get number of used indices
void Util::ArrayAllocator< TYPES >::UpdateSize | ( | ) |
Any reserve and direct array access might mess with the size.
This will update the size to reflect the first member array size in objects.
|
protected |
|
protected |