現在、Boost::Python を使用して C++ インターフェイス (純粋な仮想クラス) を Python に公開しようとしています。C++ インターフェイスは次のとおりです。
エージェント.hpp
#include "Tab.hpp"
class Agent
{
virtual void start(const Tab& t) = 0;
virtual void stop() = 0;
};
そして、「公式」チュートリアルを読んで、次の Python ラッパーを作成してビルドすることができました。
エージェント.cpp
#include <boost/python.hpp>
#include <Tabl.hpp>
#include <Agent.hpp>
using namespace boost::python;
struct AgentWrapper: Agent, wrapper<Agent>
{
public:
void start(const Tab& t)
{
this->get_override("start")();
}
void stop()
{
this->get_override("stop")();
}
};
BOOST_PYTHON_MODULE(PythonWrapper)
{
class_<AgentWrapper, boost::noncopyable>("Agent")
.def("start", pure_virtual(&Agent::start) )
.def("stop", pure_virtual(&Agent::stop) )
;
}
ビルド中に問題がないことに注意してください。しかし、私が懸念しているのは、ご覧のとおり、AgentWrapper::start が Agent::start に引数を渡していないように見えることです。
void start(const Tab& t)
{
this->get_override("start")();
}
Pythonラッパーは、「開始」が1つの引数を受け取ることをどのように認識しますか? どうすればそうできますか?