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

◆ sort_copy()

template<ComputeData InputType = Kakshya::DataVariant, ComputeData OutputType = InputType>
output_type MayaFlux::Yantra::StandardSorter< InputType, OutputType >::sort_copy ( const input_type input)
inlineprivate

Copy-based sorting (preserves input)

Definition at line 146 of file StandardSorter.hpp.

147 {
148 try {
149 std::vector<std::vector<double>> working_buffer;
150 auto [working_spans, structure_info] = OperationHelper::setup_operation_buffer(
151 const_cast<input_type&>(input), working_buffer);
152
153 sort_channels_inplace(working_spans, this->get_direction(), m_algorithm);
154
155 output_type result = this->convert_result(working_buffer, structure_info);
156 result.metadata = input.metadata;
157 result.container = input.container;
158 result.metadata["sort_type"] = "copy";
159
160 return result;
161
162 } catch (const std::exception& e) {
163 output_type error_result;
164 error_result.metadata = input.metadata;
165 error_result.container = input.container;
166 error_result.metadata["error"] = std::string("Sorting failed: ") + e.what();
167 return error_result;
168 }
169 }
output_type convert_result(std::vector< std::vector< double > > &result_data, DataStructureInfo &metadata)
Convert processed double data back to OutputType using metadata and optional callback.
static auto setup_operation_buffer(T &input, std::vector< std::vector< double > > &working_buffer)
Setup operation buffer from IO or ComputeData type.
typename base_type::input_type input_type
typename base_type::output_type output_type
SortingDirection get_direction() const
void sort_channels_inplace(std::vector< std::span< double > > &channels, SortingDirection direction, SortingAlgorithm algorithm)
Sort multiple channels (spans) in-place.
std::unordered_map< std::string, std::any > metadata
Associated metadata.
Definition DataIO.hpp:28

References MayaFlux::Yantra::sort_channels_inplace().

+ Here is the call graph for this function: