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 | Friends | List of all members
rexlib::operation_descriptor Class Reference

Immutable static description of an operation type. More...

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

Public Member Functions

 operation_descriptor (const char *component, const char *name, span< const char *const > output_operand_names, span< const char *const > input_operand_names) noexcept
 Construct a descriptor.
 
 operation_descriptor (const operation_descriptor &other)=default
 
 operation_descriptor (operation_descriptor &&other) noexcept=default
 
operation_descriptor & operator= (const operation_descriptor &other)=default
 
operation_descriptor & operator= (operation_descriptor &&other) noexcept=default
 
const char * get_component () const noexcept
 Get the component owning the operation.
 
const char * get_name () const noexcept
 Get the name of the operation.
 
span< const char *const > get_output_operand_names () const noexcept
 Get the names of the output operands.
 
span< const char *const > get_input_operand_names () const noexcept
 Get the names of the input operands.
 
const char * get_operand_name (std::size_t index, bool output_operand) const noexcept
 Get the name of one operand.
 

Friends

std::ostream & operator<< (std::ostream &os, const operation_descriptor &descriptor)
 Write the qualified name of an operation.
 

Detailed Description

Immutable static description of an operation type.

Holds everything that is the same for every instance of a given operation: the component it belongs to, its name, and the name of each of its operands.

Nothing here is owned. Every string and every name list must have static storage duration, which the declaration macros guarantee.

See also
basic_operation

Constructor & Destructor Documentation

◆ operation_descriptor()

rexlib::operation_descriptor::operation_descriptor ( const char *  component,
const char *  name,
span< const char *const >  output_operand_names,
span< const char *const >  input_operand_names 
)
noexcept

Construct a descriptor.

Parameters
componentName of the component owning the operation, such as "rexlib.ops". Used to qualify the operation in diagnostics and to keep names from different components apart.
nameName of the operation, such as "add".
output_operand_namesNames of the output operands, in signature order.
input_operand_namesNames of the input operands, in signature order.

Member Function Documentation

◆ get_component()

const char * rexlib::operation_descriptor::get_component ( ) const
noexcept

Get the component owning the operation.

Returns
const char* The component name.

◆ get_input_operand_names()

span< const char *const > rexlib::operation_descriptor::get_input_operand_names ( ) const
noexcept

Get the names of the input operands.

Returns
span<const char* const> The names, in signature order.

◆ get_name()

const char * rexlib::operation_descriptor::get_name ( ) const
noexcept

Get the name of the operation.

Returns
const char* The name.

◆ get_operand_name()

const char * rexlib::operation_descriptor::get_operand_name ( std::size_t  index,
bool  output_operand 
) const
noexcept

Get the name of one operand.

Parameters
indexIndex of the operand.
output_operandWhether the operand is an output.
Returns
const char* The name, or null when the index is out of range. Building a diagnostic must not be able to fail, so callers are expected to tolerate a missing name rather than assert on it.

◆ get_output_operand_names()

span< const char *const > rexlib::operation_descriptor::get_output_operand_names ( ) const
noexcept

Get the names of the output operands.

Returns
span<const char* const> The names, in signature order.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const operation_descriptor &  descriptor 
)
friend

Write the qualified name of an operation.

The component and the name are joined with a dot, as in "rexlib.ops.add".

Parameters
osThe stream where the descriptor is written.
descriptorThe descriptor to be written.
Returns
std::ostream& The stream.

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