proxsuite-nlp
0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
namespace.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <boost/python.hpp>
4
5
namespace
proxsuite
{
6
namespace
nlp {
7
namespace
python {
8
namespace
bp
=
boost::python
;
9
10
inline
std::string
get_scope_name
(bp::scope scope) {
11
return
std::string(bp::extract<const char *>(scope.attr(
"__name__"
)));
12
}
13
20
inline
bp::object
get_namespace
(
const
std::string &name) {
21
bp::scope cur_scope;
// current scope
22
const
std::string complete_name =
get_scope_name
(cur_scope) +
"."
+ name;
23
bp::object submodule(bp::borrowed(PyImport_AddModule(complete_name.c_str())));
24
cur_scope.attr(name.c_str()) = submodule;
25
return
submodule;
26
}
27
28
}
// namespace python
29
30
}
// namespace nlp
31
}
// namespace proxsuite
boost::python
Definition
polymorphic.hpp:14
proxsuite::nlp::python::get_scope_name
std::string get_scope_name(bp::scope scope)
Definition
namespace.hpp:10
proxsuite::nlp::python::get_namespace
bp::object get_namespace(const std::string &name)
Create or retrieve a Python scope (that is, a class or module namespace).
Definition
namespace.hpp:20
proxsuite
Main package namespace.
Definition
bcl-params.hpp:5
bindings
python
include
proxsuite-nlp
python
utils
namespace.hpp
Generated by
1.11.0