Re: Casting from a wrapped class to a possible implemented interface

On Sun, 2008-03-02 at 01:57 -0500, José Alburquerque wrote:
> Is it possible to cast a class that in its declaration 
> does not by default implement a certain interface and then cast it's 
> RefPtr to the interface (assuming that the C object implements the 
> interface)?

Generally, no.

> In gstreamer, the GstImplementsInterface 
> <> 
> has functionality to test if an Element implements an interface 
> (gst_element_implements_interface 
> <>) 
> and to cast to that interface if necessary 
> (gst_implements_interface_cast() 
> <>) 
> and I thought maybe this functionality can be used to cast from a 
> wrapped Gst::Element to a RefPtr of the interface.  Would this make
> sense?

This would cause us to have two C++ instances with the same underlying C
instance. I wonder if that would have any bad side-effects. You would
probably have to avoid using Glib::wrap(), because it assumes a 1-to-1

Murray Cumming
murrayc murrayc com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]