From d80c0c347864dc5b8c4bc689eb6174960d5456da Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Tue, 8 Feb 2011 20:04:32 +0100
Subject: [PATCH] Add an accessor to get the global dictionary.

---
 include/dynamic-graph/python/interpreter.hh | 3 +++
 src/interpreter.cc                          | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/include/dynamic-graph/python/interpreter.hh b/include/dynamic-graph/python/interpreter.hh
index ce9977b..064ac13 100644
--- a/include/dynamic-graph/python/interpreter.hh
+++ b/include/dynamic-graph/python/interpreter.hh
@@ -49,6 +49,9 @@ namespace dynamicgraph {
       /// \param stream input stream
       std::string processStream(std::istream& stream, std::ostream& os);
 
+      /// \brief Return a pointer to the dictionary of global variables
+      PyObject* globals();
+
     private:
       /// Pointer to the dictionary of global variables
       PyObject* globals_;
diff --git a/src/interpreter.cc b/src/interpreter.cc
index 23c8b27..8d265a9 100644
--- a/src/interpreter.cc
+++ b/src/interpreter.cc
@@ -98,6 +98,11 @@ std::string Interpreter::python( const std::string& command )
   return value;
 }
 
+PyObject* Interpreter::globals()
+{
+  return globals_;
+}
+
 void Interpreter::runPythonFile( std::string filename )
 {
   Py_Finalize();
-- 
GitLab