5#ifndef __pinocchio_python_utils_namespace_hpp__
6#define __pinocchio_python_utils_namespace_hpp__
8#include <boost/python.hpp>
19 inline std::string getCurrentScopeName()
21 namespace bp = boost::python;
22 bp::scope current_scope;
24 return std::string(bp::extract<const char *>(current_scope.attr(
"__name__")));
34 inline boost::python::object getOrCreatePythonNamespace(
const std::string & submodule_name)
36 namespace bp = boost::python;
38 const std::string complete_submodule_name = getCurrentScopeName() +
"." + submodule_name;
40 bp::object submodule(bp::borrowed(PyImport_AddModule(complete_submodule_name.c_str())));
41 bp::scope current_scope;
42 current_scope.attr(submodule_name.c_str()) = submodule;
Main pinocchio namespace.