MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ set_value_impl()

void MayaFlux::Kakshya::TextureContainer::set_value_impl ( const std::vector< uint64_t > &  coords,
const void *  in,
const std::type_info &  type 
)
overrideprotectedvirtual

Type-erased single-element write.

Implementations copy from in into their storage at coords if type matches their native type, otherwise no-op. in points to a caller-owned buffer of exactly sizeof(native type) bytes.

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 1097 of file TextureContainer.cpp.

1101{
1102 if (coords.empty() || m_data.empty())
1103 return;
1104
1105 const size_t layer = (m_data.size() > 1) ? static_cast<size_t>(coords[0]) : 0;
1106 if (layer >= m_data.size() || coords.size() < (m_data.size() > 1 ? 4U : 3U))
1107 return;
1108
1109 const size_t co = (m_data.size() > 1) ? 1 : 0;
1110 const size_t idx = (coords[co] * m_width + coords[co + 1]) * m_channels + coords[co + 2];
1111
1112 Memory::SeqlockWriteGuard g(m_slot_locks[layer]);
1113 std::visit([&](auto& vec) {
1114 using T = typename std::decay_t<decltype(vec)>::value_type;
1115 if (type != typeid(T) || idx >= vec.size())
1116 return;
1117 vec[idx] = *static_cast<const T*>(in);
1118 },
1119 m_data[layer]);
1120}