Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
#include <Function.h>
Public Types | |
using | functor_t = std::function< R(const Context &, Args...)> |
using | children_t = std::tuple< std::shared_ptr< Node< Args > >... > |
Public Member Functions | |
Function (const std::string &repr_, std::function< R(const Context &, Args...)> functor, const std::shared_ptr< Node< Args > >... args) | |
std::string | repr () const final |
R | eval (const Context &context, const Arguments &args) const final |
void | visit (Visitor &visitor) const final |
![]() | |
Node () | |
virtual | ~Node ()=default |
R | eval (const Context &context, Args... args) const |
R | eval (Args... args) const |
![]() | |
NodeBase (const std::type_index &type_index) | |
virtual | ~NodeBase ()=default |
const std::type_index & | type () const |
Private Attributes | |
std::string | m_repr |
functor_t | m_functor |
children_t | m_children |
Additional Inherited Members | |
![]() | |
R | eval_helper (const Context &context, Arguments &arguments) const |
R | eval_helper (const Context &context, Arguments &arguments, A0 v0, AN... an) const |
Template class for unary operators
R | Operator return type |
T | Operator parameter type |
Definition at line 38 of file Function.h.
using Pyston::Function< R, Args >::children_t = std::tuple<std::shared_ptr<Node<Args> >...> |
Definition at line 41 of file Function.h.
using Pyston::Function< R, Args >::functor_t = std::function<R(const Context&, Args...)> |
Definition at line 40 of file Function.h.
|
inline |
Constructor
node | Value to which the operator will be applied |
functor | Implements the operator |
repr | Human readable representation of the functor (i.e. +, -, abs, exp, ...) |
Definition at line 52 of file Function.h.
|
finalvirtual |
Evaluate the computing tree
In principle one could avoid to pass any values here, and assign directly the final value to the placeholders that were used to create this tree. However, this would cause the placeholders not to be thread-safe, and a tree would have to be either cloned, either protected by a mutex. Passing the values as an argument allows making the full tree immutable once built, and fully thread safe.
Implements Pyston::Node< R >.
|
inlinefinalvirtual |
Implements Pyston::NodeBase.
Definition at line 59 of file Function.h.
References Pyston::Function< R, Args >::m_repr.
|
finalvirtual |
Entry point for the visitor
Implements Pyston::NodeBase.
|
private |
Definition at line 76 of file Function.h.
|
private |
Definition at line 75 of file Function.h.
|
private |
Definition at line 74 of file Function.h.
Referenced by Pyston::Function< R, Args >::repr().