Struct VariableBuffer

Struct Documentation

struct VariableBuffer

This represents a raw buffer

Public Functions

inline VariableBuffer(const std::type_index &_type, const size_t _type_size, const void *const _default_value, const size_t _elements = 1, void *_data = nullptr, void *_data_swap = nullptr)
inline VariableBuffer(const VariableBuffer &other)

Copy constructor

inline ~VariableBuffer()

Destructor

inline void swap(VariableBuffer *other)

Swaps the buffers pointed to by the two VariableBuffers This is used when performing a state transition to an empty statelist The two buffers must point to the same variable

Public Members

void *data

Pointer to the device buffer of data

void *data_condition

Pointer to an offset within data, this should be tied to the number of disabled agents

void *data_swap

Pointer to a spare device buffer used when scattering

const std::type_index type

The type of the variable

const size_t type_size

The size of the variable’s type (e.g. sizeof(T))

const size_t elements

Is the variable array type

const void *const default_value

Pointer to the default value of the variable The length of the allocation is equal to elements * type_size

Note

The memory pointed to by this pointer is allocated and free’d by the instance