IMP Manual
develop.5128fd965d,2024/12/03
|
IMP uses SWIG to wrap code C++ code and export it to Python. Since SWIG is relatively complicated, we provide a number of helper macros and an example file (see modules/example/pyext/swig.i-in
). The key bits are
swig.i-in
in the module pyext
directoryIMP_SWIG_VALUE(),
IMP_SWIG_OBJECT()
or IMP_SWIG_DECORATOR()
line per value type, object type or decorator object the module exports to Python. Each of these lines looks like IMP_SWIG_VALUE(IMP::module_namespace, ClassName, ClassNames);
%include
lines, one per header file in the module which exports a class or function to Python. The header files must be in order such that no class is used before a declaration for it is encountered (SWIG does not do recursive inclusion)%template
call. It should look something like namespace IMP { namespace module_namespace { %template(PythonName) CPPName<Restraint, 3>; }