core::vertex_stream_t class

vertex_stream_t contains a type erased "stream" of memory with basic facilities to protect it from incorrect casts.

stream should be used in scenarios where something could contain various, but functionaly similar arrays of float. see core::data::geometry_t for an example of this.

types

typedefs

using type = details::memory_stream_type_e
the supported internal types of the stream.
publicpublic

member-functions

get<…>
returns the type safe variant of the stream as a reference.
public noexcept
get<…>
returns the type safe variant of the stream as a reference.
const public noexcept
size
returns the size of the stream (in unique element count).
const public noexcept
bytesize
returns the total size of the memory stream in bytes.
const public noexcept
data
returns the pointer to the head of the memory stream.
public noexcept
data
returns the constant pointer to the head of the memory stream.
const public noexcept

Function documentation

template<type Type>
auto& core::vertex_stream_t::get() noexcept

Brief

returns the type safe variant of the stream as a reference.

Details

if the stream is of the correct type, it will return a valid vector, otherwise an assert is raised

template<type Type>
const auto& core::vertex_stream_t::get() const noexcept

Brief

returns the type safe variant of the stream as a reference.

Details

if the stream is of the correct type, it will return a valid vector, otherwise an assert is raised

size_t core::vertex_stream_t::size() const noexcept

Brief

returns the size of the stream (in unique element count).

Details

depending on the contained type, one "element" is bigger/smaller. This method returns the size of one element. for example if the stream contains vec2 data, one element is equal to 2 floats, and so the size() would be 2 if there were 4 floats present. similarly if the stream contained vec3 data, one element would be equivalent to 3 floats, and so a size() of 4 would be equal to 12 floats.

Returns the element count.

size_t core::vertex_stream_t::bytesize() const noexcept

Brief

returns the total size of the memory stream in bytes.

Returns the total size of the memory stream in bytes.

void* core::vertex_stream_t::data() noexcept

Brief

returns the pointer to the head of the memory stream.

Returns the pointer to the head of the memory stream.

const void* core::vertex_stream_t::data() const noexcept

Brief

returns the constant pointer to the head of the memory stream.

Returns the constant pointer to the head of the memory stream.