Type-erased single-element read.
Implementations copy the native element at coords into out if type matches their native type, otherwise no-op. out points to a caller-owned buffer of exactly sizeof(native type) bytes.
Implements MayaFlux::Kakshya::NDDataContainer.
Definition at line 1071 of file TextureContainer.cpp.
1075{
1076 if (coords.empty() ||
m_data.empty())
1077 return;
1078
1079 const size_t layer = (
m_data.size() > 1) ?
static_cast<size_t>(coords[0]) : 0;
1080 if (layer >=
m_data.size() || coords.size() < (
m_data.size() > 1 ? 4U : 3U))
1081 return;
1082
1083 const size_t co = (
m_data.size() > 1) ? 1 : 0;
1084 const size_t idx = (coords[co] *
m_width + coords[co + 1]) *
m_channels + coords[co + 2];
1085
1087 std::visit([&](const auto& vec) {
1088 using T =
typename std::decay_t<
decltype(vec)>::value_type;
1089 if (type != typeid(T) || idx >= vec.size())
1090 return;
1091 *
static_cast<T*
>(out) = vec[idx];
1092 },
1094 });
1095}
Memory::SeqlockArray m_slot_locks
std::vector< DataVariant > m_data
bool seqlock_read_void(const Seqlock &lock, uint32_t max_attempts, Fn &&fn)
Invoke a void read functor under a Seqlock with a bounded retry count.