Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
ExpressionTreeBuilder.h
Go to the documentation of this file.
1
19#ifndef PYSTON_EXPRESSIONTREEBUILDER_H
20#define PYSTON_EXPRESSIONTREEBUILDER_H
21
22#include <boost/python/list.hpp>
23#include <boost/python/object.hpp>
24#include <boost/python/object/add_to_namespace.hpp>
25#include <boost/python/tuple.hpp>
26#include <functional>
27#include <tuple>
28
29#include "Pyston/Exceptions.h"
31#include "Pyston/GIL.h"
34#include "Pyston/Helpers.h"
35
36namespace Pyston {
37
44public:
58 template <typename Signature, typename... BuildParams>
59 ExpressionTree<Signature> build(const boost::python::object& pyfunc, BuildParams&&... build_params) const {
60 return buildHelper<Signature>::build(pyfunc, std::forward<BuildParams>(build_params)...);
61 }
62
72 template <typename Signature>
74
75private:
79 template <typename Signature>
81
90 template <typename R, typename T>
91 struct buildHelper<R(const std::vector<T>&)> {
92 static ExpressionTree<R(const std::vector<T>&)> build(const boost::python::object&, size_t n);
93 };
94
98 template <typename R, typename... Args>
99 struct buildHelper<R(Args...)> {
100 template <typename... Prototypes>
101 static ExpressionTree<R(Args...)> build(const boost::python::object&, Prototypes&&...);
102 };
103
107 template <typename R, typename... Args>
108 static ExpressionTree<R(Args...)> compiledOrWrapped(const boost::python::object& pyfunc,
109 const boost::python::list& placeholders);
110};
111
112} // end of namespace Pyston
113
114#define PYSTON_EXPRESSIONTREEBUILDER_IMPL
116#undef PYSTON_EXPRESSIONTREEBUILDER_IMPL
117
118#endif // PYSTON_EXPRESSIONTREEBUILDER_H
ExpressionTree< Signature > build(const boost::python::object &pyfunc, BuildParams &&... build_params) const
static ExpressionTree< R(Args...)> compiledOrWrapped(const boost::python::object &pyfunc, const boost::python::list &placeholders)
void registerFunction(const std::string &repr, std::function< Signature > functor)
STL namespace.
static ExpressionTree< R(Args...)> build(const boost::python::object &, Prototypes &&...)
static ExpressionTree< R(const std::vector< T > &)> build(const boost::python::object &, size_t n)