Alexandria 2.31.4
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Pyston::FunctionFactory< R(Args...)> Class Template Reference

#include <Function.h>

Collaboration diagram for Pyston::FunctionFactory< R(Args...)>:

Public Member Functions

 FunctionFactory (const std::string &repr, std::function< R(const Context &, Args...)> functor)
std::shared_ptr< Node< R > > operator() (const std::shared_ptr< Node< Args > > &... nodes) const

Protected Attributes

std::string m_repr
std::function< R(const Context &, Args...)> m_functor

Detailed Description

template<typename R, typename... Args>
class Pyston::FunctionFactory< R(Args...)>

Specialization for functions that receive a context

Template Parameters
RType corresponding to the created new Node
TType corresponding to the received Node

Definition at line 91 of file Function.h.

Constructor & Destructor Documentation

◆ FunctionFactory()

template<typename R, typename... Args>
Pyston::FunctionFactory< R(Args...)>::FunctionFactory ( const std::string & repr,
std::function< R(const Context &, Args...)> functor )
inline

Constructor

Parameters
functorThe functor that will be passed down to the created UnaryOperator nodes
reprHuman readable representation of the operator

Definition at line 100 of file Function.h.

References m_functor, and m_repr.

Member Function Documentation

◆ operator()()

template<typename R, typename... Args>
std::shared_ptr< Node< R > > Pyston::FunctionFactory< R(Args...)>::operator() ( const std::shared_ptr< Node< Args > > &... nodes) const
inline

Callable that creates the Node

This is what gets called from Python when an operator is used. For instance -a will trigger a call factory(a). Unlike the BinaryOperatorFactory, this will not be called is a is not of type Node, since there would be no reason to!

Definition at line 110 of file Function.h.

References m_functor, m_repr, and std::make_shared().

Here is the call graph for this function:

Member Data Documentation

◆ m_functor

template<typename R, typename... Args>
std::function<R(const Context&, Args...)> Pyston::FunctionFactory< R(Args...)>::m_functor
protected

Definition at line 116 of file Function.h.

Referenced by FunctionFactory(), and operator()().

◆ m_repr

template<typename R, typename... Args>
std::string Pyston::FunctionFactory< R(Args...)>::m_repr
protected

Definition at line 115 of file Function.h.

Referenced by FunctionFactory(), and operator()().


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