[C++-sig] extending with C++ and typeinfo question
Niall Douglas
s_sourceforge at nedprod.com
Mon Jan 5 03:16:57 CET 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 4 Jan 2004 at 18:45, John wrote:
> These are the areas I am having trouble getting my head around at the
> moment.
I foresee the following problems:
1. RTTI can't know what types python derives from i_subscriber.
You're going to need some other mechanism here (good reason why RTTI
is not the right thing to use here - I personally decode RTTI into a
string and use the string as a unique identifier - it's fast,
portable and extendable).
2. Even if you get this working, C++ entering and exiting python is
slow. You don't want to do it iteratively like you're doing it unless
there's any other way.
Can I suggest that you tag each event with a flag which when true
means python has a handler installed? Then set the flag only when
needed and use an alternative type deduction mechanism.
> How do I transmit the type of a published event through the
> interpreter so that my on_event handler knows what event is being
> processed?
RTTI really is a long unique string on any compiler I know of. Think
of generating a long unique string from the python side and you're
nearly done.
Cheers,
Niall
-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2
iQA/AwUBP/jJGcEcvDLFGKbPEQKrWACgnmn/XVO+s9t0jnNXf7vxsmX3r9UAoPEa
zyxFTUzaomlA1weLzE+cq5lX
=ba3M
-----END PGP SIGNATURE-----
More information about the Cplusplus-sig
mailing list