MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::FunctionalOperation< InputType, OutputType > Class Template Reference

Wraps a single callable as a ComputeOperation, for a wild or one-off idea that does not warrant a hand-written class. More...

#include <FunctionalOperation.hpp>

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

Public Types

using Fn = std::function< output_type(const input_type &)>
 
using input_type = Datum< InputType >
 
using output_type = Datum< OutputType >
 
- Public Types inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
using input_type = Datum< InputType >
 
using output_type = Datum< OutputType >
 

Public Member Functions

 FunctionalOperation (Fn fn)
 
 FunctionalOperation (std::shared_ptr< GpuExecutionContext< InputType, OutputType > > gpu_backend)
 Construct GPU-only: dispatches entirely via gpu_backend, no callable, no CPU fallback.
 
std::map< std::string, std::any > get_all_parameters () const override
 Retrieves all parameters and their values.
 
OperationType get_operation_type () const override
 Returns the category of this operation for grammar and registry discovery.
 
std::any get_parameter (const std::string &name) const override
 Retrieves a parameter's current value.
 
void set_parameter (const std::string &name, std::any value) override
 Sets a named parameter that configures the operation's behavior.
 
- Public Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
void add_dependency (std::shared_ptr< ComputeOperation > dep)
 
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.
 
OutputType apply_to_data (const InputType &data)
 Convenience overload that extracts just the data from result.
 
 ComputeOperation ()
 Constructor with data type validation warnings.
 
output_type execute (const input_type &input)
 OpUnit interface - operations can act as units in dependency graphs.
 
virtual const std::shared_ptr< Kakshya::SignalSourceContainer > & get_container_for_regions () const
 
const auto & get_dependencies () const
 
const ExecutionContext & get_last_execution_context () const
 
virtual std::string get_name () const
 Get operation name for debugging/introspection.
 
bool has_gpu_backend () const
 
output_type operator() (const InputType &data)
 Convenience overload for direct data processing (backward compatibility)
 
virtual void set_container_for_regions (const std::shared_ptr< Kakshya::SignalSourceContainer > &container)
 
void set_gpu_backend (std::shared_ptr< GpuExecutionContext< InputType, OutputType > > backend)
 Attach a GPU execution backend.
 
void set_last_execution_context (const ExecutionContext &ctx)
 
void set_post_execution_hook (const OperationHookCallback &hook)
 
void set_pre_execution_hook (const OperationHookCallback &hook)
 
void set_reconstruction_callback (const ReconstructionCallback &callback)
 
virtual bool validate_input (const input_type &) const
 Validates if the input data meets the operation's requirements.
 
virtual ~ComputeOperation ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Protected Member Functions

output_type operation_function (const input_type &input) override
 Executes the computational transformation on the input data.
 
- Protected Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
output_type apply_hooks (const input_type &input, const ExecutionContext &context)
 
virtual std::future< output_type > apply_operation_async (const input_type &input)
 Optional async 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.
 
virtual output_type apply_operation_internal (const input_type &input, const ExecutionContext &context)
 Internal execution method - ComputeMatrix can access this.
 
virtual output_type apply_operation_parallel (const input_type &input, const ExecutionContext &ctx)
 Optional parallel-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 Attributes

Fn m_fn
 
std::unordered_map< std::string, std::any > m_parameters
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType >
std::shared_ptr< Kakshya::SignalSourceContainer > m_container
 
std::shared_ptr< GpuExecutionContext< InputType, OutputType > > m_gpu_backend
 
ExecutionContext m_last_execution_context
 

Detailed Description

template<ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = InputType>
class MayaFlux::Yantra::FunctionalOperation< InputType, OutputType >

Wraps a single callable as a ComputeOperation, for a wild or one-off idea that does not warrant a hand-written class.

Satisfies ComputeOperation's four pure virtuals with the smallest possible surface: operation_function delegates to the supplied function; set_parameter/get_parameter store into a plain map (no type-specific defaults, since a generic wrapper has none to offer); get_operation_type always returns OperationType::CUSTOM, since a callable supplied at construction time carries no inherent verb category. Fully interchangeable with any hand-written ComputeOperation<InputType, OutputType> subclass everywhere ComputeMatrix, GPU backend attachment, and dependency graphs are concerned: none of that machinery keys off get_operation_type().

Template Parameters
InputTypeComputeData type accepted.
OutputTypeComputeData type produced. Defaults to InputType.

Definition at line 28 of file FunctionalOperation.hpp.


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