From: John P. (Quinticent) <jo...@ma...> - 2000-10-31 07:31:48
|
Linux/gcc - Hierarchy: mriIAsset / \ / \ mriIVisualAsset mriIAudioAsset (There will be more in the future) I think the whole problem is that SOMELib uses some sort of smart pointers that I haven't looked into. Tom is using them in SOME::Object. SOME::Object<T> expands to class SOME::Object : public boost_smart_ptr<T> I haven't looked at the boost stuff and I am not sure if boost_smart_ptr isA T or hasA T. If it is hasA this will have to change. If it cannot be downcast then it needs to be taken out of SOMELib as I am not sure what benefits it gives. -Quinticent "Frank V. Castellucci" wrote: > What is the hierarchy? You may need dynamic_cast<> based on the rules of > usage in 1998(E) C++ standard. > What is the error, and what is the compiler/platform? > > John Palmieri wrote: > > > > I am trying to integrate SOMELib into snaglepuss and am having errors > > with downcasting my objects. > > > > You see I have a hiarchy of interfaces for use with dynamicly loadable > > assets (png, mp3, mpg files). They all get loaded and stuffed into > > chests which are just glorified vectors of type mriIAsset *. Now each > > of the assets can be rendered to the screen, audio device, etc. with a > > call to the render() method. But, each type of asset also has enhanced > > functionality based on their type so my png loader asset would also > > inherit the interface mriIVisualAsset which would in turn inherit the > > mriIAsset interface. The problem I am having is that when I load my > > object I check to see if it is visual, audio. Let's say it is a visual > > asset. I then use this code to construct the object: > > > > SOME::Object<mriIVisualAsset>oAsset(assets[0]); > > //construct our asset > > if(!oAsset.construct()){ ... > > > > this works fine but now I want to add this asset to my chest: > > > > asset = static_cast<mriIAsset *>(oAsset); //error here. I'm guessting > > the template is not truly inheriting > > > > chest->addAsset( chestpos, asset );//I should be able to mix and match > > different assests in my chest > > > > This is an important feature and as much as I know you love the boost > > stuff if it restricts projects from using standard C++ mechanisms when > > working with SOMELib it will have to go. > > > > -Quinticent > > > > _______________________________________________ > > somelib-devel mailing list > > som...@li... > > http://lists.sourceforge.net/mailman/listinfo/somelib-devel > > -- > Frank V. Castellucci > http://corelinux.sourceforge.net > OOA/OOD/C++ Standards and Guidelines for Linux > http://PythPat.sourceforge.net > Pythons Pattern Package > _______________________________________________ > somelib-devel mailing list > som...@li... > http://lists.sourceforge.net/mailman/listinfo/somelib-devel |