MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::UniversalTransformer< InputType, OutputType > Class Template Referenceabstract

Template-flexible transformer base with instance-defined I/O types. More...

#include <UniversalTransformer.hpp>

+ Inheritance diagram for MayaFlux::Yantra::UniversalTransformer< InputType, OutputType >:
+ Collaboration diagram for MayaFlux::Yantra::UniversalTransformer< InputType, OutputType >:

Public Types

using input_type = IO< InputType >
 
using output_type = IO< OutputType >
 
using base_type = ComputeOperation< InputType, OutputType >
 
- Public Types inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
using input_type = IO< InputType >
 
using output_type = IO< OutputType >
 

Public Member Functions

virtual ~UniversalTransformer ()=default
 Virtual destructor for proper inheritance cleanup.
 
virtual TransformationType get_transformation_type () const =0
 Gets the transformation type category for this transformer.
 
std::string get_name () const override
 Gets human-readable name for this transformer.
 
void set_parameter (const std::string &name, std::any value) override
 Type-safe parameter management with transformation-specific defaults.
 
std::any get_parameter (const std::string &name) const override
 Gets a parameter value by name.
 
std::map< std::string, std::any > get_all_parameters () const override
 Gets all parameters as a map.
 
void set_strategy (TransformationStrategy strategy)
 Sets the transformation strategy.
 
TransformationStrategy get_strategy () const
 Gets the current transformation strategy.
 
void set_quality (TransformationQuality quality)
 Sets the transformation quality level.
 
TransformationQuality get_quality () const
 Gets the current transformation quality level.
 
void set_scope (TransformationScope scope)
 Sets the transformation scope.
 
TransformationScope get_scope () const
 Gets the current transformation scope.
 
void set_intensity (double intensity)
 Set transformation intensity (0.0 = no transformation, 1.0 = full transformation)
 
double get_intensity () const
 Gets the current transformation intensity.
 
void add_transformation_key (const TransformationKey &key)
 Add transformation key for multi-dimensional transformations.
 
void clear_transformation_keys ()
 Clear all transformation keys.
 
const std::vector< TransformationKey > & get_transformation_keys () const
 Get all transformation keys.
 
template<ComputeData T>
void set_custom_function (std::function< T(const T &)> func)
 Set a custom transformation function for mathematical transformations.
 
virtual bool is_in_place () const
 Indicates whether the transformation modifies the input data directly.
 
virtual double get_transformation_progress () const
 Reports the current progress of a long-running transformation.
 
virtual double estimate_computational_cost () const
 Estimates the computational cost of the transformation.
 
- Public Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
 ComputeOperation ()
 Constructor with data type validation warnings.
 
virtual ~ComputeOperation ()=default
 Virtual destructor for proper cleanup of derived classes.
 
output_type apply_operation (const input_type &input)
 Public synchronous execution interface.
 
output_type apply_operation_with_dependencies (const input_type &input)
 Applies the operation with dependencies resolved.
 
output_type operator() (const InputType &data)
 Convenience overload for direct data processing (backward compatibility)
 
OutputType apply_to_data (const InputType &data)
 Convenience overload that extracts just the data from result.
 
output_type execute (const input_type &input)
 OpUnit interface - operations can act as units in dependency graphs.
 
void add_dependency (std::shared_ptr< ComputeOperation > dep)
 
const auto & get_dependencies () const
 
virtual void set_container_for_regions (const std::shared_ptr< Kakshya::SignalSourceContainer > &container)
 
virtual const std::shared_ptr< Kakshya::SignalSourceContainer > & get_container_for_regions () const
 
void set_last_execution_context (const ExecutionContext &ctx)
 
const ExecutionContextget_last_execution_context () const
 
void set_pre_execution_hook (const OpererationHookCallback &hook)
 
void set_post_execution_hook (const OpererationHookCallback &hook)
 
void set_reconstruction_callback (const ReconstructionCallback &callback)
 

Protected Member Functions

output_type operation_function (const input_type &input) override
 Core operation implementation - called by ComputeOperation interface.
 
virtual output_type transform_implementation (input_type &input)=0
 Pure virtual transformation implementation - derived classes implement this.
 
virtual std::string get_transformer_name () const
 Get transformer-specific name (derived classes override this)
 
virtual void set_transformation_parameter (const std::string &name, std::any value)
 Transformation-specific parameter handling (override for custom parameters)
 
virtual std::any get_transformation_parameter (const std::string &name) const
 Gets a transformation-specific parameter value.
 
virtual std::map< std::string, std::any > get_transformation_parameters () const
 Gets all transformation-specific parameters.
 
virtual output_type apply_scope_and_quality_processing (const output_type &result)
 Apply scope and quality filtering to the transformation result.
 
std::vector< double > extract_transformation_parameters (const input_type &input) const
 Helper method to apply transformation keys to extract parameters.
 
bool validate_input (const input_type &input) const override
 Basic input validation that derived classes can override.
 
- Protected Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
virtual output_type apply_operation_internal (const input_type &input, const ExecutionContext &context)
 Internal execution method - ComputeMatrix can access this.
 
virtual std::future< output_typeapply_operation_async (const input_type &input)
 Optional async implementation - default delegates to operation_function.
 
virtual output_type apply_operation_parallel (const input_type &input, const ExecutionContext &ctx)
 Optional parallel-aware implementation - default delegates to operation_function.
 
virtual output_type apply_operation_chained (const input_type &input, const ExecutionContext &ctx)
 Optional chain-aware implementation - default delegates to operation_function.
 
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.
 

Private Member Functions

output_type create_safe_output (const input_type &input) const
 Creates a safe fallback output when input validation fails.
 
bool validate_multi_channel_data (const std::vector< std::span< double > > &channels) const
 Validates multi-channel numeric data for NaN/Infinity values.
 

Private Attributes

TransformationStrategy m_strategy = TransformationStrategy::BUFFERED
 Core transformation configuration.
 
TransformationQuality m_quality = TransformationQuality::STANDARD
 Current quality level.
 
TransformationScope m_scope = TransformationScope::FULL_DATA
 Current processing scope.
 
double m_intensity = 1.0
 Transformation intensity (0.0-2.0)
 
std::vector< TransformationKeym_transformation_keys
 Multi-dimensional transformation keys.
 
std::function< std::any(const std::any &)> m_custom_function
 Custom transformation function for mathematical operations.
 
std::map< std::string, std::any > m_parameters
 Generic parameter storage for transformer-specific settings.
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
std::shared_ptr< Kakshya::SignalSourceContainerm_container
 
ExecutionContext m_last_execution_context
 

Detailed Description

template<ComputeData InputType = Kakshya::DataVariant, ComputeData OutputType = InputType>
class MayaFlux::Yantra::UniversalTransformer< InputType, OutputType >

Template-flexible transformer base with instance-defined I/O types.

Template Parameters
InputTypeInput data type (defaults to Kakshya::DataVariant)
OutputTypeOutput data type (defaults to InputType)

The UniversalTransformer provides a clean, concept-based foundation for all transformation operations. I/O types are defined at instantiation time, providing maximum flexibility while maintaining type safety through C++20 concepts.

Unlike traditional transformers that only handle simple signal processing, this embraces the digital paradigm with multi-modal transformation, cross-domain operations, and computational approaches that go beyond analog metaphors.

Supported Transformation Types

  • Temporal: Time-domain operations (reverse, stretch, delay, fade)
  • Spectral: Frequency-domain operations (pitch shift, filtering, enhancement)
  • Mathematical: Pure mathematical operations (gain, polynomial, trigonometric)
  • Convolution: Convolution-based operations (filtering, correlation, deconvolution)
  • Cross-modal: Operations that translate between different data modalities
  • Generative: AI/ML-driven transformations and procedural generation

Usage Patterns

// Basic mathematical transformation
auto math_transformer = std::make_unique<MathematicalTransformer<>>();
math_transformer->set_parameter("operation", "gain");
math_transformer->set_parameter("gain_factor", 2.0);
// Spectral processing with custom quality
auto spectral_transformer = std::make_unique<SpectralTransformer<>>();
spectral_transformer->set_quality(TransformationQuality::HIGH_QUALITY);
spectral_transformer->set_strategy(TransformationStrategy::BUFFERED);
@ HIGH_QUALITY
High-quality transformation, may be slower.
@ BUFFERED
Create transformed copy (preserves input)

Definition at line 197 of file UniversalTransformer.hpp.


The documentation for this class was generated from the following file: