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::rule_signature< ShapeRule, TypeRule, Parameters > Class Template Referencefinal

Operation signature made of a shape rule and a typing rule. More...

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

Inheritance diagram for rexlib::rule_signature< ShapeRule, TypeRule, Parameters >:
rexlib::operation_signature

Public Types

using parameters_type = Parameters
 

Public Member Functions

template<typename... Args, typename = typename std::enable_if< std::is_constructible<Parameters, Args...>::value >::type>
 rule_signature (Args &&... args)
 Construct the signature by constructing its parameters.
 
const Parameters & get_parameters () const noexcept
 Get the parameters of the operation instance.
 
void check_parameters (const operation_descriptor &descriptor) const
 Check the parameters against the rules.
 
void deduce (const operation_descriptor &descriptor, span< operand_specification > canonical_outputs, span< const operand_specification > inputs) const override
 Compute the output operands the inputs call for.
 
void accept (const operation_descriptor &descriptor, span< const operand_specification > user_outputs, span< const operand_specification > inputs) const override
 Decide whether output operands supplied in advance are admissible.
 
operation_arity get_arity () const noexcept override
 Get the number of output and input operands.
 
- Public Member Functions inherited from rexlib::operation_signature
 operation_signature (const operation_signature &other)=delete
 
 operation_signature (operation_signature &&other)=delete
 
operation_signature & operator= (const operation_signature &other)=delete
 
operation_signature & operator= (operation_signature &&other)=delete
 

Detailed Description

template<typename ShapeRule, typename TypeRule, typename Parameters>
class rexlib::rule_signature< ShapeRule, TypeRule, Parameters >

Operation signature made of a shape rule and a typing rule.

Owns the parameters of an operation instance and reads from them, through the accessors the rules name, whatever the rules depend on. The shape rule decides the shapes of the operands and the typing rule their data types, each without the other.

Template Parameters
ShapeRuleThe operand_shape_rule.
TypeRuleThe operand_type_rule.
ParametersThe parameter type of the operation, no_parameters for an operation without any.
See also
shared_rule_signature

Constructor & Destructor Documentation

◆ rule_signature()

template<typename... Args, typename = typename std::enable_if< std::is_constructible<Parameters, Args...>::value >::type>
rexlib::rule_signature< ShapeRule, TypeRule, Parameters >::rule_signature ( Args &&...  args)
explicit

Construct the signature by constructing its parameters.

Template Parameters
ArgsConstructor argument types of the parameters.
Parameters
argsForwarded to the parameters.

Member Function Documentation

◆ accept()

Decide whether output operands supplied in advance are admissible.

Parameters
descriptorDescription of the operation, used to name the operation and its operands when reporting a rejection.
user_outputsThe output operands supplied in advance.
inputsThe input operands.
Exceptions
std::invalid_argumentWhen an output is not admissible.
std::out_of_rangeWhen the signature names an axis beyond the rank of the operands.

Implements rexlib::operation_signature.

◆ check_parameters()

Check the parameters against the rules.

Checks what does not depend on the operands, such as how many axes are named, so that an operation can reject its parameters when it is built rather than when it is first executed.

Parameters
descriptorDescription of the operation, used to name it when reporting a rejection.
Exceptions
std::invalid_argumentWhen a parameter is not admissible.

◆ deduce()

void rexlib::rule_signature< ShapeRule, TypeRule, Parameters >::deduce ( const operation_descriptor &  descriptor,
span< operand_specification >  canonical_outputs,
span< const operand_specification >  inputs 
) const
overridevirtual

Compute the output operands the inputs call for.

A data type the inputs do not determine is left as numerical_type::unknown, for an output supplied in advance to fix.

Parameters
descriptorDescription of the operation, used to name the operation and its operands when reporting a rejection.
canonical_outputsOutput buffer, sized to the operation's output arity.
inputsThe input operands.
Exceptions
std::invalid_argumentWhen the inputs are not admissible.
std::out_of_rangeWhen the signature names an axis beyond the rank of the operands.

Implements rexlib::operation_signature.

◆ get_arity()

operation_arity rexlib::rule_signature< ShapeRule, TypeRule, Parameters >::get_arity ( ) const
overridevirtualnoexcept

Get the number of output and input operands.

Returns
operation_arity The operand counts deduce and accept take.

Implements rexlib::operation_signature.

◆ get_parameters()

Get the parameters of the operation instance.

Returns
const Parameters& The parameters.

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