Neuralyzer::Transforms::V2::RangeReductionRegistry
Neuralyzer::Transforms::V2::RangeReductionRegistry
Registry for range reduction operations. More…
#include <RangeReductionRegistry.hpp>
Public Functions
| Name | |
|---|---|
| RangeReductionRegistry() =default | |
| RangeReductionRegistry(RangeReductionRegistry const & ) =delete | |
| RangeReductionRegistry & | operator=(RangeReductionRegistry const & ) =delete |
| RangeReductionRegistry(RangeReductionRegistry && ) =default | |
| RangeReductionRegistry & | operator=(RangeReductionRegistry && ) =default |
| template <typename Element ,typename Scalar ,typename Params > void |
registerReduction(std::string const & name, std::function< Scalar(std::span< Element const >, Params const &)> func, RangeReductionMetadata metadata ={}) Register a range reduction. |
| template <typename Element ,typename Scalar > void |
registerStatelessReduction(std::string const & name, std::function< Scalar(std::span< Element const >)> func, RangeReductionMetadata metadata ={}) Register a stateless reduction (no parameters). |
| template <typename Element ,typename Scalar ,typename Params > std::shared_ptr< TypedRangeReduction< Element, Scalar, Params > > |
getReduction(std::string const & name) const Get a typed reduction by name. |
| template <typename Element ,typename Scalar ,typename Params > Scalar |
execute(std::string const & name, std::span< Element const > input, Params const & params) const Execute a reduction with full type safety. |
| std::vector< std::string > | getReductionNames() const Get all registered reduction names. |
| template <typename Element > std::vector< std::string > |
getReductionsForInputType() const Get reductions for a specific input element type. |
| std::vector< std::string > | getReductionsForInputType(std::type_index input_type) const Get reductions for a specific input type (type-erased). |
| template <typename Scalar > std::vector< std::string > |
getReductionsForOutputType() const Get reductions that produce a specific output type. |
| RangeReductionMetadata const * | getMetadata(std::string const & name) const Get metadata for a reduction. |
| std::unordered_map< std::string, RangeReductionMetadata > const & | getAllMetadata() const Get all metadata entries. |
| bool | hasReduction(std::string const & name) const Check if a reduction is registered. |
| template <typename Element > bool |
hasReductionForType(std::string const & name) const Check if a reduction exists for the given input type. |
| template <typename Element ,typename Scalar ,typename Params > std::unique_ptr< IRangeReductionParamExecutor > |
createParamExecutor(std::string const & name, Params params) const Create a parameter executor with captured parameters. |
| std::unique_ptr< IRangeReductionParamExecutor > | createParamExecutorFromJson(std::string const & name, std::string const & json_params) const Deserialize parameters from JSON and create executor. |
| std::any | deserializeParameters(std::string const & reduction_name, std::string const & json_str) const Deserialize parameters from JSON string. |
| std::any | executeErased(std::string const & name, std::type_index input_type, std::any const & input_range, std::any const & params) const Execute reduction with type-erased input and parameters. |
| RangeReductionRegistry & | instance() Get global singleton instance. |
Detailed Description
class Neuralyzer::Transforms::V2::RangeReductionRegistry;Registry for range reduction operations.
Provides registration, discovery, and execution of range reductions. Follows the singleton pattern like ElementRegistry.
Public Functions Documentation
function RangeReductionRegistry
RangeReductionRegistry() =defaultfunction RangeReductionRegistry
RangeReductionRegistry(
RangeReductionRegistry const &
) =deletefunction operator=
RangeReductionRegistry & operator=(
RangeReductionRegistry const &
) =deletefunction RangeReductionRegistry
RangeReductionRegistry(
RangeReductionRegistry &&
) =defaultfunction operator=
RangeReductionRegistry & operator=(
RangeReductionRegistry &&
) =defaultfunction registerReduction
template <typename Element ,
typename Scalar ,
typename Params >
inline void registerReduction(
std::string const & name,
std::function< Scalar(std::span< Element const >, Params const &)> func,
RangeReductionMetadata metadata ={}
)Register a range reduction.
Parameters:
- name Unique reduction name
- func Reduction function: (span
, Params const&) -> Scalar - metadata Optional metadata for UI/discovery
Template Parameters:
- Element Input element type (e.g., EventWithId)
- Scalar Output scalar type (e.g., float)
- Params Parameter type (use NoReductionParams for stateless)
function registerStatelessReduction
template <typename Element ,
typename Scalar >
inline void registerStatelessReduction(
std::string const & name,
std::function< Scalar(std::span< Element const >)> func,
RangeReductionMetadata metadata ={}
)Register a stateless reduction (no parameters).
function getReduction
template <typename Element ,
typename Scalar ,
typename Params >
inline std::shared_ptr< TypedRangeReduction< Element, Scalar, Params > > getReduction(
std::string const & name
) constGet a typed reduction by name.
Return: Shared pointer to reduction, or nullptr if not found
function execute
template <typename Element ,
typename Scalar ,
typename Params >
inline Scalar execute(
std::string const & name,
std::span< Element const > input,
Params const & params
) constExecute a reduction with full type safety.
Exceptions:
- std::runtime_error if reduction not found or type mismatch
function getReductionNames
inline std::vector< std::string > getReductionNames() constGet all registered reduction names.
function getReductionsForInputType
template <typename Element >
inline std::vector< std::string > getReductionsForInputType() constGet reductions for a specific input element type.
function getReductionsForInputType
inline std::vector< std::string > getReductionsForInputType(
std::type_index input_type
) constGet reductions for a specific input type (type-erased).
function getReductionsForOutputType
template <typename Scalar >
inline std::vector< std::string > getReductionsForOutputType() constGet reductions that produce a specific output type.
function getMetadata
inline RangeReductionMetadata const * getMetadata(
std::string const & name
) constGet metadata for a reduction.
Return: Pointer to metadata, or nullptr if not found
function getAllMetadata
inline std::unordered_map< std::string, RangeReductionMetadata > const & getAllMetadata() constGet all metadata entries.
function hasReduction
inline bool hasReduction(
std::string const & name
) constCheck if a reduction is registered.
function hasReductionForType
template <typename Element >
inline bool hasReductionForType(
std::string const & name
) constCheck if a reduction exists for the given input type.
function createParamExecutor
template <typename Element ,
typename Scalar ,
typename Params >
inline std::unique_ptr< IRangeReductionParamExecutor > createParamExecutor(
std::string const & name,
Params params
) constCreate a parameter executor with captured parameters.
Parameters:
- name Reduction name to look up
- params Parameters to capture
Return: Unique pointer to executor, or nullptr if reduction not found
This is used by the pipeline to execute reductions without knowing the parameter type at runtime.
function createParamExecutorFromJson
inline std::unique_ptr< IRangeReductionParamExecutor > createParamExecutorFromJson(
std::string const & name,
std::string const & json_params
) constDeserialize parameters from JSON and create executor.
Parameters:
- name Reduction name
- json_params JSON string containing parameters
Exceptions:
- rfl::Error if JSON parsing fails
Return: Unique pointer to executor, or nullptr if not found
function deserializeParameters
inline std::any deserializeParameters(
std::string const & reduction_name,
std::string const & json_str
) constDeserialize parameters from JSON string.
Parameters:
- reduction_name Name of the reduction
- json_str JSON string containing parameters
Return: std::any containing typed parameters, or empty std::any on failure
Looks up the reduction’s parameter type and uses the registered deserializer.
function executeErased
inline std::any executeErased(
std::string const & name,
std::type_index input_type,
std::any const & input_range,
std::any const & params
) constExecute reduction with type-erased input and parameters.
Parameters:
- name Reduction name
- input_type Type of input elements
- input_range std::any containing std::span
- params std::any containing parameters
Exceptions:
- std::runtime_error if reduction not found
Return: std::any containing scalar result
function instance
static inline RangeReductionRegistry & instance()Get global singleton instance.
Updated on 2026-11-13 at 20:25:41 +0000