rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
rexlib::parametric_operation< Derived, Traits > Class Template Reference

CRTP base for operations whose signature depends on parameters. More...

#include <rexlib/core/operation/parametric_operation.hpp>

Inheritance diagram for rexlib::parametric_operation< Derived, Traits >:
rexlib::basic_operation< Derived, Traits > rexlib::operation

Public Types

using parameters_type = typename Traits::parameters_type
 
using signature_type = rule_signature< shape_rule_type, type_rule_type, parameters_type >
 
- Public Types inherited from rexlib::basic_operation< Derived, Traits >
using traits_type = Traits
 
using shape_rule_type = typename Traits::shape_rule_type
 
using type_rule_type = typename Traits::type_rule_type
 

Public Member Functions

template<typename... Args, typename = typename std::enable_if< std::is_constructible<parameters_type, Args...>::value >::type>
 parametric_operation (Args &&... args)
 Construct the operation by constructing its parameters.
 
const parameters_type & get_parameters () const noexcept
 Get the parameters of the operation.
 
const operation_signature & get_signature () const noexcept override
 Get the signature deciding the shape and data type of the operands of this operation.
 
- Public Member Functions inherited from rexlib::basic_operation< Derived, Traits >
const operation_descriptor & get_descriptor () const noexcept override
 Get the description of this operation.
 
operation_id get_id () const noexcept override
 Get the identifier of Derived.
 
- Public Member Functions inherited from rexlib::operation
 operation (const operation &other)=delete
 
 operation (operation &&other)=delete
 
operation & operator= (const operation &other)=delete
 
operation & operator= (operation &&other)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from rexlib::basic_operation< Derived, Traits >
static const operation_descriptor & get_static_descriptor () noexcept
 Get the description shared by every instance.
 
- Static Public Attributes inherited from rexlib::basic_operation< Derived, Traits >
static REXLIB_CONST_CONSTEXPR std::size_t output_operand_count
 
static REXLIB_CONST_CONSTEXPR std::size_t input_operand_count
 

Detailed Description

template<typename Derived, typename Traits>
class rexlib::parametric_operation< Derived, Traits >

CRTP base for operations whose signature depends on parameters.

Owns a rule_signature holding the parameters of the operation and forwards every constructor argument to them, so an operation whose signature reads its parameters, such as a reduction over a set of axes, needs no body of its own. The parameters are checked against the rules on construction.

Only parameters the signature reads are covered. An operation carrying a value its signature does not read declares that value itself, as fill_operation does.

The signature is not copyable, so the operation is not either.

Template Parameters
DerivedThe concrete operation type.
TraitsThe static description. In addition to what basic_operation requires, it must provide using parameters_type = ... naming the type of the parameters, and its rules must read them.
See also
basic_operation
trivial_operation
rule_signature

Constructor & Destructor Documentation

◆ parametric_operation()

template<typename... Args, typename = typename std::enable_if< std::is_constructible<parameters_type, Args...>::value >::type>
rexlib::parametric_operation< Derived, Traits >::parametric_operation ( Args &&...  args)
explicit

Construct the operation by constructing its parameters.

Constrained on the parameters being constructible from args, so that a wrong argument list is reported as no matching constructor rather than as an error inside the parameters, and so that this constructor does not take part in copy initialization.

Template Parameters
ArgsConstructor argument types of the parameters.
Parameters
argsForwarded to the parameters.
Exceptions
std::invalid_argumentWhen the rules do not admit the parameters.

Member Function Documentation

◆ get_parameters()

const parameters_type & rexlib::parametric_operation< Derived, Traits >::get_parameters ( ) const
noexcept

Get the parameters of the operation.

How a program builder reads them back. A builder is instantiated on the operation type, so it recovers the operation with operation_cast and never has to downcast the erased signature.

Returns
const parameters_type& The parameters.

◆ get_signature()

const operation_signature & rexlib::parametric_operation< Derived, Traits >::get_signature ( ) const
overridevirtualnoexcept

Get the signature deciding the shape and data type of the operands of this operation.

Returns
const operation_signature& The signature.

Implements rexlib::operation.


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