Public Member Functions | Private Attributes | List of all members
dynamicgraph::python::Interpreter Class Reference

#include <interpreter.hh>

Public Member Functions

PyObject * globals ()
 Return a pointer to the dictionary of global variables. More...
 
 Interpreter ()
 
std::string processStream (std::istream &stream, std::ostream &os)
 Process input stream to send relevant blocks to python. More...
 
std::string python (const std::string &command)
 Method to start python interperter. More...
 
void python (const std::string &command, std::string &result, std::string &out, std::string &err)
 Method to start python interperter. More...
 
void runMain (void)
 
void runPythonFile (std::string filename)
 Method to exectue a python script. More...
 
void runPythonFile (std::string filename, std::string &err)
 
 ~Interpreter ()
 

Private Attributes

PyThreadState * _pyState
 The Python thread state. More...
 
PyObject * globals_
 Pointer to the dictionary of global variables. More...
 
PyObject * mainmod_
 

Detailed Description

This class implements a basis python interpreter.

String sent to method python are interpreted by an onboard python interpreter.

Definition at line 21 of file interpreter.hh.

Constructor & Destructor Documentation

◆ Interpreter()

dynamicgraph::python::Interpreter::Interpreter ( )

Definition at line 69 of file interpreter.cc.

◆ ~Interpreter()

dynamicgraph::python::Interpreter::~Interpreter ( )

Definition at line 98 of file interpreter.cc.

Member Function Documentation

◆ globals()

PyObject * dynamicgraph::python::Interpreter::globals ( )

Return a pointer to the dictionary of global variables.

Definition at line 207 of file interpreter.cc.

◆ processStream()

std::string dynamicgraph::python::Interpreter::processStream ( std::istream &  stream,
std::ostream &  os 
)

Process input stream to send relevant blocks to python.

Parameters
streaminput stream

Definition at line 248 of file interpreter.cc.

◆ python() [1/2]

std::string dynamicgraph::python::Interpreter::python ( const std::string &  command)

Method to start python interperter.

Parameters
commandstring to execute Method deprecated, you SHOULD handle error messages.

Definition at line 138 of file interpreter.cc.

◆ python() [2/2]

void dynamicgraph::python::Interpreter::python ( const std::string &  command,
std::string &  result,
std::string &  out,
std::string &  err 
)

Method to start python interperter.

Parameters
commandstring to execute, result, stdout, stderr strings

Definition at line 144 of file interpreter.cc.

◆ runMain()

void dynamicgraph::python::Interpreter::runMain ( void  )

Definition at line 236 of file interpreter.cc.

◆ runPythonFile() [1/2]

void dynamicgraph::python::Interpreter::runPythonFile ( std::string  filename)

Method to exectue a python script.

Parameters
filenamethe filename

Definition at line 209 of file interpreter.cc.

◆ runPythonFile() [2/2]

void dynamicgraph::python::Interpreter::runPythonFile ( std::string  filename,
std::string &  err 
)

Definition at line 214 of file interpreter.cc.

Member Data Documentation

◆ _pyState

PyThreadState* dynamicgraph::python::Interpreter::_pyState
private

The Python thread state.

Definition at line 51 of file interpreter.hh.

◆ globals_

PyObject* dynamicgraph::python::Interpreter::globals_
private

Pointer to the dictionary of global variables.

Definition at line 53 of file interpreter.hh.

◆ mainmod_

PyObject* dynamicgraph::python::Interpreter::mainmod_
private

Definition at line 54 of file interpreter.hh.


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


dynamic-graph-python
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Oct 27 2023 02:16:37