|
Boost : |
From: rwgk_at_[hidden]
Date: 2001-04-18 18:47:12
--- In boost_at_y..., Pearu Peterson <boost_at_c...> wrote:
> The key question seems to be: How to declare a base class
> that is defined in another module?:
> symbol_class.declare_base(basic_class);
>
> If class_basic_converters object could provide a method
> get_extension_class() then my problem would be solved, right?:
I have not thought about this problem before.
Your idea sounds plausible.
David, do you think this could be done?
Unfortunately I will not be able to work on this for the next
couple of weeks (at least).
How many methods do you have in your basic class?
Here is an untested idea for an interim workaround:
Say, your class symbol inherits a method int foo(int) from
class basic, I think you could do something like this in the
symbol module:
namespace {
int basic_foo(const symbol& s, int i)
{
return s.foo(i);
}
}
BOOST_PYTHON_MODULE_INIT(symbol)
{
//...
symbol_class.def(basic_foo, "foo");
//...
}
You might be able to use macros so that you do not have to
repeat this for all your 15 derived classes.
Ralf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk