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  ][ [EMAIL PROTECTED] ][ [EMAIL PROTECTED] ]
[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 ]

Attachment: signature.asc
Description: Digital signature

_______________________________________________
vos-d mailing list
vos-d@interreality.org
http://www.interreality.org/cgi-bin/mailman/listinfo/vos-d

Reply via email to