I'm currently trying to expose a c++ Interface (pure virtual class) to Python using Boost::Python. The c++ interface is:
Agent.hpp
#include "Tab.hpp"
class Agent
{
virtual void start(const Tab& t) = 0;
virtual void stop() = 0;
};
And, by reading the "official" tutorial, I managed to write and build the next Python wrapper:
Agent.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) )
;
}
Note that I have no problems while building it. What concerns me, though, is that as you can see AgentWrapper::start doesn't seem to pass any argument to Agent::start in:
void start(const Tab& t)
{
this->get_override("start")();
}
How will the python wrapper know "start" recieves one argument? How can i do so?