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< DataVariant >.
Definition at line 804 of file VideoStreamContainer.cpp.
806{
808 return;
809
810 const uint64_t frame =
coords[0];
811 const uint64_t y =
coords[1];
812 const uint64_t x =
coords[2];
813 const uint64_t c =
coords[3];
814
816 return;
817
821 + c;
822
823 if (
type ==
typeid(
float)) {
825 static_cast<double>(*static_cast<const float*>(in)));
826 return;
827 }
828 if (
type ==
typeid(
double)) {
830 *static_cast<const double*>(in));
831 return;
832 }
834 if (
auto* v = std::get_if<std::vector<uint8_t>>(&
m_data[0]); v && idx < v->size())
835 (*v)[idx] = *static_cast<const uint8_t*>(in);
836 return;
837 }
839 if (
auto* v = std::get_if<std::vector<uint16_t>>(&
m_data[0]); v && idx < v->size())
840 (*v)[idx] = *static_cast<const uint16_t*>(in);
841 }
842}
std::vector< glm::ivec3 > coords
vk::PhysicalDeviceType type
std::optional< DataDimension::ValueRange > component_range() const
Value range declared on the component dimension, if any.
size_t get_frame_element_count() const
Elements in one frame: width * height * channels.
std::vector< DataVariant > m_data
uint32_t slot_for(uint64_t frame_index) const
size_t storage_element_size(ImageFormat format)
Byte width of the DataVariant element backing a given ImageFormat.
void write_normalized_at(DataVariant &v, ImageFormat format, const std::optional< DataDimension::ValueRange > &range, size_t elem_index, double value)
Write one element from a normalised double, with optional range remapping.
References component_range(), coords, get_frame_element_count(), m_channels, m_data, m_format, m_height, m_num_frames, m_ring_capacity, m_width, slot_for(), MayaFlux::Kakshya::storage_element_size(), type, and MayaFlux::Kakshya::write_normalized_at().