GEGELATI

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Instructions::LambdaInstruction< First, Rest > Class Template Reference

Template instruction for simplifying the creation of an Instruction from a c++ lambda function. More...

`#include <lambdaInstruction.h>`

Inheritance diagram for Instructions::LambdaInstruction< First, Rest >:

## Public Member Functions
| LambdaInstruction (std::function< double(First, Rest...)> function, const std::string &printTemplate="")
| Constructor of the class LambdaInstruction to create a printable Instruction.
| LambdaInstruction ()=delete
| delete the default constructor.
virtual bool | checkOperandTypes (const std::vector< Data::UntypedSharedPtr > &arguments) const override
| Inherited from Instruction.
virtual double | execute (const std::vector< Data::UntypedSharedPtr > &args) const override
| Inherited from Instruction.
Public Member Functions inherited from Instructions::Instruction
virtual bool | isPrintable () const
| function saying if an Instruction can be printed in a C file during the code gen.
virtual const std::string & | getPrintTemplate () const
| This function return the printTemplate of the line of code used to represent the instruction.
virtual std::string | getPrintablePrimitiveOperandType (const uint64_t &opIdx) const
| Retrieve the primitive data type of the operand.
virtual | ~Instruction ()=default
| Default virtual destructor for polyphormism.
const std::vector< std::reference_wrapper< const std::type_info > > & | getOperandTypes () const
| Get the list of operand types needed by the Instruction.
unsigned int | getNbOperands () const
| Get the number of operands required to execute the Instruction.

## Protected Attributes
const std::function< double(const First, const Rest...)> | func
| Function executed for this Instruction.
Protected Attributes inherited from Instructions::Instruction
std::string | printTemplate
std::vector< std::reference_wrapper< const std::type_info > > | operandTypes
| List of the types of the operands needed to execute the instruction.

## Additional Inherited Members
Protected Member Functions inherited from Instructions::Instruction
| Instruction (std::string printTemplate)
| Protected constructor to force the class abstract nature.

## Detailed Description

template<typename First, typename... Rest>
class Instructions::LambdaInstruction< First, Rest >

Template instruction for simplifying the creation of an Instruction from a c++ lambda function.

Template parameters First and Rest can be any primitive type, class or const c-style 1D and 2D array.

Each template parameter corresponds to an argument of the function given to the LambdaInstruction constructor, specifying its type.

## Constructor & Destructor Documentation

## ◆ LambdaInstruction()

template<typename First , typename... Rest>

Instructions::LambdaInstruction< First, Rest >::LambdaInstruction | ( | std::function< double(First, Rest...)> | function,
|  | const std::string & | printTemplate = "" )
| inline

Constructor of the class LambdaInstruction to create a printable Instruction.

Parameters

  [in] | printTemplate | std::string use at the generation. Check Instructions::Instruction for more details.
  [in] | function | the c++ std::function that will be executed for this Instruction. Check the constructor with only the function as parameter for more details.

## Member Function Documentation

## ◆ checkOperandTypes()

template<typename First , typename... Rest>

virtual bool Instructions::LambdaInstruction< First, Rest >::checkOperandTypes | ( | const std::vector< Data::UntypedSharedPtr > & | arguments | ) | const
| inline override virtual

Inherited from Instruction.

Reimplemented from Instructions::Instruction.

## ◆ execute()

template<typename First , typename... Rest>

virtual double Instructions::LambdaInstruction< First, Rest >::execute | ( | const std::vector< Data::UntypedSharedPtr > & | args | ) | const
| inline override virtual

Inherited from Instruction.

Implements Instructions::Instruction.

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

- D:/a/gegelati/gegelati/gegelatilib/include/instructions/lambdaInstruction.h