From: John P. <jo...@ma...> - 2000-10-31 03:14:45
|
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 |