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

◆ append_to_existing()

template<typename T >
void MayaFlux::Kakshya::DataInsertion::append_to_existing ( std::vector< T >  new_data)
inlineprivate

Append scalar data to existing storage.

Definition at line 316 of file DataInsertion.hpp.

317 {
318 std::visit([&](auto& existing_vec) {
319 using ExistingType = typename std::decay_t<decltype(existing_vec)>::value_type;
320
321 if constexpr (std::is_same_v<ExistingType, T>) {
322 existing_vec.insert(existing_vec.end(),
323 new_data.begin(),
324 new_data.end());
325 } else if constexpr (std::is_arithmetic_v<ExistingType> && std::is_arithmetic_v<T>) {
326 for (const auto& val : new_data) {
327 existing_vec.push_back(static_cast<ExistingType>(val));
328 }
329 } else {
330 error<std::invalid_argument>(
333 std::source_location::current(),
334 "Cannot append: incompatible types in variant (existing: {}, new: {})",
335 typeid(ExistingType).name(),
336 typeid(T).name());
337 }
338 },
339 m_variant);
340
341 if (!m_dimensions.empty()) {
342 m_dimensions[0].size = std::visit(
343 [](const auto& vec) { return static_cast<uint64_t>(vec.size()); },
344 m_variant);
345 }
346 }
std::vector< DataDimension > & m_dimensions
@ Runtime
General runtime operations (default fallback)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.