[Boost.Python] Extracting indirect base.

(No luck on C++-sig - is that list even active? There's absolutely no
traffic, not one mail in two days. Anyway, trying again here.)
Hi,
I've got a hand-wrapped plugin interface hierarchy for my program
allowing implementing plugins in Python. This looks approximately like this:
class Plugin
{
public:
virtual void init() = 0;
virtual PluginCategory getCategory() = 0; // Subtype of the plugin
// ...
};
class InputPlugin : public Plugin
{
public:
virtual void loadData(const string &resource, DataBag &target) = 0;
};
class OutputPlugin : public Plugin
{
public:
virtual void saveData(const string &resource, const DataBag &source) = 0;
};
These are the plugin interfaces. PluginCategory is an enum identifying
the concrete subtype of the plugin, i.e. either Input or Output.
I've got them wrapped like this:
class PluginWrap : public Plugin, public boost::python::wrapper<Plugin>
{
virtual void init() { this->get_override("init")(); }
// ...
};
class InputPlugin : public InputPlugin, public
boost::python::wrapper<InputPlugin>
{
virtual void loadData(...) { ... }
};
// ...
BOOST_PYTHON_MODULE(myprogram)
{
class_
participants (1)
-
Sebastian Redl