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 Member Functions | Static Public Member Functions | List of all members
rexlib::type_rule_resolution Class Reference

Resolved pivot values of a typing rule, or the reason it failed. More...

#include <rexlib/core/operation/type_rule/type_rule_resolution.hpp>

Public Member Functions

 type_rule_resolution () noexcept
 Construct a successful resolution with no pivot resolved yet.
 
type_rule_resolution fail (type_rule_status status, std::size_t operand_index, bool output_operand, numerical_type type) const noexcept
 Derive a failed resolution from this one.
 
type_rule_status get_status () const noexcept
 Get the outcome of the resolution.
 
 operator bool () const noexcept
 Check whether the resolution succeeded.
 
std::size_t get_pivot_count () const noexcept
 Get the number of resolved pivots.
 
numerical_type get_pivot (std::size_t index) const noexcept
 Get the value of a resolved pivot.
 
void set_pivot (std::size_t index, numerical_type type) noexcept
 Set the value of a pivot.
 
void set_pivot_count (std::size_t count) noexcept
 Set the number of pivots the resolution holds.
 
std::size_t get_operand_index () const noexcept
 Get the index of the operand a failure is attributed to.
 
bool is_output_operand () const noexcept
 Check whether the failing operand is an output.
 
numerical_type get_offending_type () const noexcept
 Get the type that caused the failure.
 

Static Public Member Functions

static type_rule_resolution failure (type_rule_status status, std::size_t operand_index, bool output_operand, numerical_type type) noexcept
 Construct a failed resolution.
 

Detailed Description

Resolved pivot values of a typing rule, or the reason it failed.

Allocation free and trivially copyable. A failure is reported as a status, not thrown.

See also
operand_type_rule

Member Function Documentation

◆ fail()

type_rule_resolution rexlib::type_rule_resolution::fail ( type_rule_status  status,
std::size_t  operand_index,
bool  output_operand,
numerical_type  type 
) const
noexcept

Derive a failed resolution from this one.

Unlike failure, the pivots resolved so far are preserved.

Parameters
statusThe reason of the failure. Must not be type_rule_status::ok.
operand_indexIndex of the operand the failure is attributed to.
output_operandWhether operand_index refers to an output operand.
typeThe offending type.
Returns
type_rule_resolution The failed resolution.

◆ failure()

static type_rule_resolution rexlib::type_rule_resolution::failure ( type_rule_status  status,
std::size_t  operand_index,
bool  output_operand,
numerical_type  type 
)
staticnoexcept

Construct a failed resolution.

Parameters
statusThe reason of the failure. Must not be type_rule_status::ok.
operand_indexIndex of the operand the failure is attributed to.
output_operandWhether operand_index refers to an output operand.
typeThe offending type.
Returns
type_rule_resolution The failed resolution.

◆ get_offending_type()

numerical_type rexlib::type_rule_resolution::get_offending_type ( ) const
noexcept

Get the type that caused the failure.

Returns
numerical_type The offending type.

◆ get_operand_index()

std::size_t rexlib::type_rule_resolution::get_operand_index ( ) const
noexcept

Get the index of the operand a failure is attributed to.

Returns
std::size_t The operand index.

◆ get_pivot()

numerical_type rexlib::type_rule_resolution::get_pivot ( std::size_t  index) const
noexcept

Get the value of a resolved pivot.

Parameters
indexIndex of the pivot. Must be less than the pivot count.
Returns
numerical_type The pivot value. May be numerical_type::unknown when the pivot is free and was not bound.

◆ get_pivot_count()

std::size_t rexlib::type_rule_resolution::get_pivot_count ( ) const
noexcept

Get the number of resolved pivots.

Returns
std::size_t The pivot count.

◆ get_status()

type_rule_status rexlib::type_rule_resolution::get_status ( ) const
noexcept

Get the outcome of the resolution.

Returns
type_rule_status The status.

◆ is_output_operand()

bool rexlib::type_rule_resolution::is_output_operand ( ) const
noexcept

Check whether the failing operand is an output.

Returns
true The operand is an output operand.
false The operand is an input operand.

◆ operator bool()

rexlib::type_rule_resolution::operator bool ( ) const
explicitnoexcept

Check whether the resolution succeeded.

Returns
true The rule resolved successfully.
false The rule could not be resolved.

◆ set_pivot()

void rexlib::type_rule_resolution::set_pivot ( std::size_t  index,
numerical_type  type 
)
noexcept

Set the value of a pivot.

Parameters
indexIndex of the pivot. Must be less than max_type_pivot_count.
typeThe pivot value.

◆ set_pivot_count()

void rexlib::type_rule_resolution::set_pivot_count ( std::size_t  count)
noexcept

Set the number of pivots the resolution holds.

Parameters
countThe pivot count. Must not exceed max_type_pivot_count.

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