Using pybind11, I am trying to bind double pointer to custom type (abstract class). But I am not seeing any example which explains how to do.
I have class ITest which is abstract and has pure virtual function, which takes argument as double pointer to other abstract class IValue, as shown in below code snippet.
'''
class IValue
{
virtual long get() = 0;
}
class ITest
{
virtual fnDoublePointerarg(wchar_t* value, IValue** obj) = 0;
}
'''
How do I create binding for double pointer in pybind for classes? Any examples to achieve it, is appreciated.
More details:
I created a trampoline class as it is abstract class and pybind11 cannot instantiate as below
class PyIValue : public IValue
{
public IValue::IValue;
long get(){
PYBIND11_OVERRIDE_PURE(
long,
IValue,
get,
);
}
};
class PyITest : public ITest
{
public:
using ITest::ITest;
int fnDoublePointerarg(const wchar_t* domainId, IValue** ppOb) {
PYBIND11_OVERRIDE_PURE(
int,
ITest,
fnDoublePointerarg,
std::wstring domainId,
IValue** ppOb);
}
};
PYBIND11_MODULE(Example, m) {
m.doc() = "pybind11 example plugin"; // Optional module docstring
py::class_<ITest, PyITest>(m, "ITest")
.def(py::init<>())
.def("fnDoublePointerarg",ITest::fnDoublePointerarg)
}