[vos-d] Message handler problem
Peter Amstutz
tetron at interreality.org
Thu Mar 15 17:02:29 EDT 2007
On Thu, Mar 15, 2007 at 04:11:41PM -0400, Reed Hedges wrote:
> Peter Amstutz wrote:
> > That's something that was introduced by the new event tables
> > implementation in 0.24. The solution is to make the registration
> > function a templated class, and for the subclass to call the base class
> > registration function with the subclass type to ensure that the method
> > handlers are associated with the subclass as well as the base class.
>
> Well, is there a way to avoid the subclass having to do this? I'm trying
> to make it easy to make a subclass of a local MetaObjects. I haven't
> thought of a way yet but I didn't look too deeply into the way it stores
> the function pointers in VobjectBase yet...
Possibly, if typeid(this) in the base class will produce the typeinfo
for the subclass, or the typeinfo can be propagated up some other way.
The way the mechanism works is by getting the typeid() of the target
vobject, looking that up in a table mapping object types to method
pointers, then casting to the concrete type and calling the method in
question. It's the lookup step (where it maps from the concrete type to
the handler) that it fails if the method has been registered by the base
class but not the subclass.
--
[ Peter Amstutz ][ tetron at interreality.org ][ peter.amstutz at gdit.com ]
[Lead Programmer][Interreality Project][Virtual Reality for the Internet]
[ VOS: Next Generation Internet Communication][ http://interreality.org ]
[ http://interreality.org/~tetron ][ pgpkey: pgpkeys.mit.edu 18C21DF7 ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.interreality.org/pipermail/vos-d/attachments/20070315/71817b5c/attachment.pgp
More information about the vos-d
mailing list