MayaFlux 0.3.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 304 of file DataInsertion.hpp.

305 {
306 std::visit([&](auto& existing_vec) {
307 using ExistingType = typename std::decay_t<decltype(existing_vec)>::value_type;
308
309 if constexpr (std::is_same_v<ExistingType, T>) {
310 existing_vec.insert(existing_vec.end(),
311 new_data.begin(),
312 new_data.end());
313 } else if constexpr (std::is_arithmetic_v<ExistingType> && std::is_arithmetic_v<T>) {
314 for (const auto& val : new_data) {
315 existing_vec.push_back(static_cast<ExistingType>(val));
316 }
317 } else {
318 error<std::invalid_argument>(
321 std::source_location::current(),
322 "Cannot append: incompatible types in variant (existing: {}, new: {})",
323 typeid(ExistingType).name(),
324 typeid(T).name());
325 }
326 },
327 m_variant);
328
329 if (!m_dimensions.empty()) {
330 m_dimensions[0].size = std::visit(
331 [](const auto& vec) { return static_cast<uint64_t>(vec.size()); },
332 m_variant);
333 }
334 }
std::vector< DataDimension > & m_dimensions
@ Runtime
General runtime operations (default fallback)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.