Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
interpreter< CONF > Struct Template Reference

Python interpreter with BBM module imported. More...

#include <bbm_python_interpreter.h>

Public Member Functions

 interpreter (void)
 Constructor: initializes BBM python interface.
 
 ~interpreter (void)
 Destructor releases scope and python interpreter appropriately.
 
template<typename RET_TYPE >
RET_TYPE capture (const std::string &prog) const
 Execute Python code within the BBM environment.
 
void execute (const std::string &prog) const
 Execute Python code within the BBM environment.
 

Private Attributes

dl_handle_t _python
 
py::object _scope
 

Detailed Description

template<typename CONF>
requires concepts::config<CONF>
struct bbm::python::interpreter< CONF >

Python interpreter with BBM module imported.

Template Parameters
CONF= configuration of the BBM environment to use

Constructor & Destructor Documentation

◆ interpreter()

interpreter ( void  )
inline

Constructor: initializes BBM python interface.

◆ ~interpreter()

~interpreter ( void  )
inline

Destructor releases scope and python interpreter appropriately.

Member Function Documentation

◆ capture()

RET_TYPE capture ( const std::string &  prog) const
inline

Execute Python code within the BBM environment.

Template Parameters
RET_TYPE= type of the return type (need explicit casting)
Parameters
prog= string of python code to execute.
Returns
object of type RET_TYPE

Usage Example:

auto ptr = i.capture<BsdfPtr>("Lambertian()");
Python interpreter with BBM module imported.
Definition: bbm_python_interpreter.h:31
RET_TYPE capture(const std::string &prog) const
Execute Python code within the BBM environment.
Definition: bbm_python_interpreter.h:71

Returns a BsdfPtr objects to a Lambertian bsdf.

◆ execute()

void execute ( const std::string &  prog) const
inline

Execute Python code within the BBM environment.

Parameters
prog= string of python code to execute.

Usage Example:

i.execute<floatRGB>("print(str(Lambertian()))");
Definition: backbone.h:53
void execute(const std::string &prog) const
Execute Python code within the BBM environment.
Definition: bbm_python_interpreter.h:91

Prints the default Lambertian bsdf.

Member Data Documentation

◆ _python

dl_handle_t _python
private

◆ _scope

py::object _scope
private

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