24#ifndef JAU_SYNCBUFFER_HPP_
25#define JAU_SYNCBUFFER_HPP_
68 virtual const
void*
data() const noexcept = 0;
88 .append(
", count ").append(std::to_string(
elementCount()))
89 .append(
" x ").append(std::to_string(
elementSize())).append(
"]");
96 return reinterpret_cast<const int8_t*
>(
data());
105 return reinterpret_cast<const int32_t*
>(
data());
124 std::enable_if_t<std::is_floating_point_v<Value_type>,
bool> =
true>
137 const void*
data() const noexcept
override {
return floats(); }
138 size_t elementSize() const noexcept
override {
return sizeof(float); }
146 std::enable_if_t<std::is_floating_point_v<Value_type>,
bool> =
true>
161 const void*
data() const noexcept
override {
return floats(); }
162 size_t elementSize() const noexcept
override {
return sizeof(float); }
static const jau::type_info & f32()
Class template jau::function is a general-purpose static-polymorphic function wrapper.
static const jau::type_info & i32()
static const jau::type_info & i8()
Basic 4x4 value_type matrix implementation using fields for intensive use-cases (host operations).
constexpr const_iterator cbegin() const noexcept
Convenient tuple of a sync_action_t and data buffer.
virtual const jau::type_info & valueSignature() const noexcept=0
Returns type signature of implementing class's stored value type.
virtual sync_action_t & action() noexcept=0
Return the defined sync_action_t.
virtual ~SyncBuffer() noexcept=default
const int32_t * data_i32() const
Return the underlying data buffer as int32_t if valueSignature() matches, otherwise throw.
std::string toString() const
SyncBuffer & sync() noexcept
Synchronizes the underlying data before usage.
const float32_t * data_f32() const
Return the underlying data buffer as float32_t if valueSignature() matches, otherwise throw.
const int8_t * data_i8() const
Return the underlying data buffer as int8_t if valueSignature() matches, otherwise throw.
virtual const void * data() const noexcept=0
Return the underlying data buffer as bytes.
virtual size_t elementSize() const noexcept=0
Returns element size in bytes.
size_t byteSize() const noexcept
virtual size_t elementCount() const noexcept=0
Returns element count, total byte size = elementSize() * elementCount()
SyncBuffer interface with multiple underlying Matrix4.
size_t elementSize() const noexcept override
Returns element size in bytes.
const value_type * floats() const noexcept
virtual size_t matrixCount() const noexcept=0
const void * data() const noexcept override
Return the underlying data buffer as bytes.
virtual const Mat4 * matrices() const noexcept=0
Return the underlying Mat4 pointer, used to synchronize via action() to the buffer().
Matrix4< value_type, std::is_floating_point_v< value_type > > Mat4
size_t elementCount() const noexcept override
Returns element count, total byte size = elementSize() * elementCount()
const jau::type_info & valueSignature() const noexcept override
Returns type signature of implementing class's stored value type.
SyncBuffer interface with a single underlying Matrix4.
Matrix4< value_type, std::is_floating_point_v< value_type > > Mat4
size_t elementCount() const noexcept override
Returns element count, total byte size = elementSize() * elementCount()
virtual const Mat4 & matrix() const noexcept=0
Return the underlying Mat4, used to synchronize via action() to the buffer().
const value_type * floats() const noexcept
const void * data() const noexcept override
Return the underlying data buffer as bytes.
const jau::type_info & valueSignature() const noexcept override
Returns type signature of implementing class's stored value type.
size_t elementSize() const noexcept override
Returns element size in bytes.
Generic type information using either Runtime type information (RTTI) or Compile time type informatio...
const jau::type_info & static_ctti() noexcept
Returns a static global reference of make_ctti<T>(true) w/ identity instance.
constexpr std::string_view name(const Bool v) noexcept
SyncMatrices4< float > SyncMats4f
jau::function< void()> sync_action_t
Specific data synchronization action implemented by the data provider to update the buffer with the u...
void(* sync_action_fptr)()
Plain function pointer type matching sync_action_t.
SyncMatrix4< float > SyncMat4f
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.