Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
Pyston::PythonCall< T > Class Template Reference

#include <PythonCall.h>

Inheritance diagram for Pyston::PythonCall< T >:
Inheritance graph
[legend]
Collaboration diagram for Pyston::PythonCall< T >:
Collaboration graph
[legend]

Classes

struct  to_python_visitor
 

Public Member Functions

 PythonCall (boost::python::object callable)
 
std::string repr () const override
 
void visit (Visitor &visitor) const override
 
eval (const Context &context, const Arguments &arguments) const override
 
- Public Member Functions inherited from Pyston::Node< T >
 Node ()
 
virtual ~Node ()=default
 
template<typename... Args>
eval (const Context &context, Args... args) const
 
template<typename... Args>
eval (Args... args) const
 
- Public Member Functions inherited from Pyston::NodeBase
 NodeBase (const std::type_index &type_index)
 
virtual ~NodeBase ()=default
 
const std::type_indextype () const
 

Private Attributes

boost::python::object m_callable
 

Additional Inherited Members

- Protected Member Functions inherited from Pyston::Node< T >
eval_helper (const Context &context, Arguments &arguments) const
 
template<typename A0 , typename... AN>
eval_helper (const Context &context, Arguments &arguments, A0 v0, AN... an) const
 

Detailed Description

template<typename T>
class Pyston::PythonCall< T >

A PythonCall node hides a call to a wrapped Python function when the tree can not be evaluated

Definition at line 36 of file PythonCall.h.

Constructor & Destructor Documentation

◆ PythonCall()

template<typename T >
Pyston::PythonCall< T >::PythonCall ( boost::python::object  callable)
inlineexplicit

Definition at line 38 of file PythonCall.h.

Member Function Documentation

◆ eval()

template<typename T >
T Pyston::PythonCall< T >::eval ( const Context ,
const Arguments  
) const
inlineoverridevirtual

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.

Returns
Result of the evaluation

Implements Pyston::Node< T >.

Definition at line 49 of file PythonCall.h.

References Pyston::PythonCall< T >::m_callable, and Pyston::sharedContext.

◆ repr()

template<typename T >
std::string Pyston::PythonCall< T >::repr ( ) const
inlineoverridevirtual
Returns
A human readable representation of the node
Note
It should not include the representation of the children, if any. That's what visitors are for.

Implements Pyston::NodeBase.

Definition at line 40 of file PythonCall.h.

◆ visit()

template<typename T >
void Pyston::PythonCall< T >::visit ( Visitor ) const
inlineoverridevirtual

Entry point for the visitor

Implements Pyston::NodeBase.

Definition at line 44 of file PythonCall.h.

References Pyston::Visitor::enter(), and Pyston::Visitor::exit().

Here is the call graph for this function:

Member Data Documentation

◆ m_callable

template<typename T >
boost::python::object Pyston::PythonCall< T >::m_callable
private

Definition at line 75 of file PythonCall.h.

Referenced by Pyston::PythonCall< T >::eval().


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