Template Class MemoryVector

Inheritance Relationships

Base Type

Class Documentation

template<typename T>
class MemoryVector : public flamegpu::detail::GenericMemoryVector

Storage class for host copies of variable buffers

Template Parameters:

T – The base-type of the data in the vector

Public Functions

inline explicit MemoryVector(unsigned int _elements = 1)

Memory vector is an array of variables

Parameters:

_elements – the length of the array within a variable, most variables will be 1 (a lone variable)

inline virtual ~MemoryVector()

Default destructor

inline virtual const std::type_index &getType() const override

Returns the type index of the base type of an element.

inline virtual unsigned int getElements() const override

Returns the number of elements in a variable This is likely to be 1 unless the variable is an array variable

See also

getTypeSize()

inline virtual size_t getTypeSize() const override

Returns the size (in bytes) of a base type of an element of the MemoryVector e.g. = type size = variable size / elements

See also

getElements()

inline virtual size_t getVariableSize() const override

Returns the size (in bytes) of a single element of the MemoryVector. e.g. variable size = type size * elements

See also

getElements()

See also

getTypeSize()

inline virtual void *getDataPtr() override

Returns a pointer to the front of the internal buffer

Note

If the vector is resized the pointer will become invalid

inline virtual const void *getReadOnlyDataPtr() const override

Returns a const pointer to the front of the internal buffer

Note

If the vector is resized the pointer will become invalid

inline virtual MemoryVector<T> *clone() const override

Returns a copy of the vector with the same contents

inline virtual void resize(unsigned int s) override

Resize the buffer to hold s items

Parameters:

s – The size of the buffer (in terms of items, not bytes)

Protected Attributes

const unsigned int elements

Number of elements per variable (1 if not an array variable) Multiplies with size to allocate enough memory

std::vector<T> vec

Vector which manages data storage

const std::type_index type

Type info about the vector base type typeid(T)

const size_t type_size

Size of the base type of a variable e.g. not accounting for the number of elements in the variable sizeof(T)