interpreter.hh
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 // Copyright 2011, Florent Lamiraux, CNRS.
3 
4 #ifndef DYNAMIC_GRAPH_PYTHON_INTERPRETER_H
5 #define DYNAMIC_GRAPH_PYTHON_INTERPRETER_H
6 
7 #undef _POSIX_C_SOURCE
8 #undef _XOPEN_SOURCE
10 #include "dynamic-graph/python/deprecated.hh"
11 
14 
15 namespace dynamicgraph {
16 namespace python {
22 class DYNAMIC_GRAPH_PYTHON_DLLAPI Interpreter {
23  public:
24  Interpreter();
25  ~Interpreter();
29  DYNAMIC_GRAPH_PYTHON_DEPRECATED std::string python(const std::string& command);
30 
33  void python(const std::string& command, std::string& result, std::string& out, std::string& err);
34 
37  void runPythonFile(std::string filename);
38  void runPythonFile(std::string filename, std::string& err);
39  void runMain(void);
40 
43  std::string processStream(std::istream& stream, std::ostream& os);
44 
46  PyObject* globals();
47 
48  private:
50  PyThreadState* _pyState;
52  PyObject* globals_;
54  PyObject* locals_;
55  PyObject* mainmod_;
56 };
57 } // namespace python
58 } // namespace dynamicgraph
59 #endif // DYNAMIC_GRAPH_PYTHON_INTERPRETER_H
Definition: interpreter.hh:22
Definition: convert-dg-to-py.hh:7