Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Private Member Functions | List of all members
Pyston::ExpressionTreeBuilder Class Reference

#include <ExpressionTreeBuilder.h>

Classes

struct  buildHelper
 
struct  buildHelper< R(Args...)>
 
struct  buildHelper< R(const std::vector< T > &)>
 

Public Member Functions

template<typename Signature , typename... BuildParams>
ExpressionTree< Signature > build (const boost::python::object &pyfunc, BuildParams &&... build_params) const
 
template<typename Signature >
void registerFunction (const std::string &repr, std::function< Signature > functor)
 

Static Private Member Functions

template<typename R , typename... Args>
static ExpressionTree< R(Args...)> compiledOrWrapped (const boost::python::object &pyfunc, const boost::python::list &placeholders)
 

Detailed Description

Builds an expression tree from a Python function, given its signature. If it is not possible to do so (for instance, due to the use of branching conditional on some placeholder), it will wrap the Python function in a compatible manner

Definition at line 43 of file ExpressionTreeBuilder.h.

Member Function Documentation

◆ build()

template<typename Signature , typename... BuildParams>
ExpressionTree< Signature > Pyston::ExpressionTreeBuilder::build ( const boost::python::object &  pyfunc,
BuildParams &&...  build_params 
) const
inline

Build an expression tree, or wrap the Python function in a compatible manner

Template Parameters
SignatureFunction signature (i.e. double(double,double))
Parameters
pyfuncPython object pointing to a callable. Its signature must match the template.
build_paramsRequired build parameters: either prototypes for AttributeSet, if any is passed along, or the number of elements for functions with variable number of parameters
Returns
A pair, where the first value is a boolean set to true if an expression tree could be built, false otherwise. The second value is the wrapping functor.

Definition at line 59 of file ExpressionTreeBuilder.h.

◆ compiledOrWrapped()

template<typename R , typename... Args>
static ExpressionTree< R(Args...)> Pyston::ExpressionTreeBuilder::compiledOrWrapped ( const boost::python::object &  pyfunc,
const boost::python::list &  placeholders 
)
staticprivate

Common to buildHelper specializations

◆ registerFunction()

template<typename Signature >
void Pyston::ExpressionTreeBuilder::registerFunction ( const std::string repr,
std::function< Signature >  functor 
)

Register a function

Template Parameters
SignatureFunction signature
Parameters
reprFunction name
Note
The return and parameter types are deduced from the Signature

Referenced by Example::mainMethod().


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