#include "exports.h"
#include "MRPybind11.h"
#include "MRMesh/MRExpected.h"
#include <functional>
#include <filesystem>
#include <unordered_map>
Go to the source code of this file.
Classes | |
class | PythonStreamRedirector< T > |
class | MR::PythonExport |
struct | MR::PythonExport::ModuleData |
struct | MR::PythonFunctionAdder |
Namespaces | |
namespace | MR |
Macros | |
#define | MR_INIT_PYTHON_MODULE(moduleName) MR_INIT_PYTHON_MODULE_PRECALL( moduleName, [](){} ) |
#define | MR_INIT_PYTHON_MODULE_PRECALL(moduleName, precall) |
#define | MR_ADD_PYTHON_FUNCTION(moduleName, name, func, description) static MR::PythonFunctionAdder name##_adder_( #moduleName, [](pybind11::module_& m){ m.def(#name, func, description);} ); |
#define | MR_ADD_PYTHON_CUSTOM_DEF(moduleName, name, ...) |
#define | _MR_PYTHON_CUSTOM_CLASS_HOLDER_NAME(name) name##_class_ |
Python class wrapper name; for internal use only. | |
#define | MR_PYTHON_CUSTOM_CLASS(name) ( *_MR_PYTHON_CUSTOM_CLASS_HOLDER_NAME( name ) ) |
#define | MR_ADD_PYTHON_CUSTOM_CLASS_DECL(moduleName, name, ...) static std::optional<pybind11::class_<__VA_ARGS__>> _MR_PYTHON_CUSTOM_CLASS_HOLDER_NAME( name ); |
#define | MR_ADD_PYTHON_CUSTOM_CLASS_INST(moduleName, name) |
#define | MR_ADD_PYTHON_CUSTOM_CLASS_INST_FUNC(moduleName, name, ...) |
#define | MR_ADD_PYTHON_CUSTOM_CLASS(moduleName, name, ...) |
#define | MR_ADD_PYTHON_VEC(moduleName, name, type) |
#define | MR_ADD_PYTHON_MAP(moduleName, name, mapType) |
#define | MR_ADD_PYTHON_EXPECTED(moduleName, name, type, errorType) |
Typedefs | |
using | StdoutPyRedirector = PythonStreamRedirector<Stdout> |
using | StderrPyRedirector = PythonStreamRedirector<Stderr> |
Enumerations | |
enum | StreamType { Stdout , Stderr } |
Functions | |
template<typename E > | |
void | MR::throwExceptionFromExpected (const E &err) |
template<typename R , typename E , typename... Args> | |
auto | MR::decorateExpected (std::function< Expected< R, E >(Args...)> &&f) -> std::function< R(Args...)> |
template<typename F > | |
auto | MR::decorateExpected (F &&f) |
template<typename R , typename T , typename... Args> | |
auto | MR::decorateExpected (R(T::*memFunction)(Args...)) |
#define _MR_PYTHON_CUSTOM_CLASS_HOLDER_NAME | ( | name | ) | name##_class_ |
Python class wrapper name; for internal use only.
#define MR_ADD_PYTHON_CUSTOM_CLASS | ( | moduleName, | |
name, | |||
... ) |
For the proper stub file generation, a class must be defined prior to its depending methods. To achieve it, declare the class before the MR_ADD_PYTHON_CUSTOM_DEF block:
#define MR_ADD_PYTHON_CUSTOM_CLASS_DECL | ( | moduleName, | |
name, | |||
... ) static std::optional<pybind11::class_<__VA_ARGS__>> _MR_PYTHON_CUSTOM_CLASS_HOLDER_NAME( name ); |
Explicitly declare the Python class wrapper
#define MR_ADD_PYTHON_CUSTOM_CLASS_INST | ( | moduleName, | |
name ) |
Explicitly instantiate the Python class wrapper
#define MR_ADD_PYTHON_CUSTOM_CLASS_INST_FUNC | ( | moduleName, | |
name, | |||
... ) |
Explicitly instantiate the Python class wrapper with a custom function (pybind11::bind_vector, pybind11::bind_map, etc.)
#define MR_ADD_PYTHON_CUSTOM_DEF | ( | moduleName, | |
name, | |||
... ) |
#define MR_ADD_PYTHON_EXPECTED | ( | moduleName, | |
name, | |||
type, | |||
errorType ) |
#define MR_ADD_PYTHON_FUNCTION | ( | moduleName, | |
name, | |||
func, | |||
description ) static MR::PythonFunctionAdder name##_adder_( #moduleName, [](pybind11::module_& m){ m.def(#name, func, description);} ); |
#define MR_ADD_PYTHON_MAP | ( | moduleName, | |
name, | |||
mapType ) |
#define MR_ADD_PYTHON_VEC | ( | moduleName, | |
name, | |||
type ) |
#define MR_INIT_PYTHON_MODULE | ( | moduleName | ) | MR_INIT_PYTHON_MODULE_PRECALL( moduleName, [](){} ) |
NOTE: Include this header AFTER any OpenVDB header; otherwise it will break MSVC debug builds.
External links:
#define MR_INIT_PYTHON_MODULE_PRECALL | ( | moduleName, | |
precall ) |
#define MR_PYTHON_CUSTOM_CLASS | ( | name | ) | ( *_MR_PYTHON_CUSTOM_CLASS_HOLDER_NAME( name ) ) |
Python class wrapper accessor
enum StreamType |