feat: Support python md plugins
This commit is contained in:
1 parent
8579c9fdc5
commit
7fa8e4ca47
48 files changed
+3411
No files matched your search
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "python_md/md_provider.h"
|
||||
#include "python_md/md_sink.h"
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
namespace bts::md::py_interop {
|
||||
|
||||
/**
|
||||
* An implementation of `bts::md::py_interop::MdProvider` that binds to a python object at runtime.
|
||||
*
|
||||
* @note The python object must derive from 'python_md_module.MdProvider', and define methods:
|
||||
* 1. 'start(md_sink: python_md_module.MdSink)'
|
||||
* 2. 'stop'
|
||||
* @note 'python_md_module' is a python module defined by us in c++ (see 'py_module.cpp').
|
||||
*/
|
||||
class PyMdProvider : public MdProvider {
|
||||
public:
|
||||
using MdProvider::MdProvider;
|
||||
|
||||
~PyMdProvider() override;
|
||||
|
||||
void start(MdSink *sink) override {
|
||||
PYBIND11_OVERLOAD_PURE(void, MdProvider, start, sink);
|
||||
}
|
||||
|
||||
void stop() override { PYBIND11_OVERLOAD_PURE(void, MdProvider, stop); }
|
||||
};
|
||||
|
||||
} // namespace bts::md::py_interop
|
||||
Reference in new issue
Block a user