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
11 #include "dynamic-graph/python/deprecated.hh"
12 
15 
16 namespace dynamicgraph {
17 namespace python {
23 class DYNAMIC_GRAPH_PYTHON_DLLAPI Interpreter {
24  public:
25  Interpreter();
26  ~Interpreter();
30  DYNAMIC_GRAPH_PYTHON_DEPRECATED std::string python(const std::string& command);
31 
34  void python(const std::string& command, std::string& result, std::string& out, std::string& err);
35 
38  void runPythonFile(std::string filename);
39  void runPythonFile(std::string filename, std::string& err);
40  void runMain(void);
41 
44  std::string processStream(std::istream& stream, std::ostream& os);
45 
47  PyObject* globals();
48 
49  private:
51  PyThreadState* _pyState;
53  PyObject* globals_;
55  PyObject* locals_;
56  PyObject* mainmod_;
57 };
58 } // namespace python
59 } // namespace dynamicgraph
60 #endif // DYNAMIC_GRAPH_PYTHON_INTERPRETER_H
Definition: interpreter.hh:23
Definition: convert-dg-to-py.hh:8