Hi Gerrit,

Gerrit Voss wrote:
> On Tue, 2008-11-18 at 11:04 -0600, Carsten Neumann wrote:
>>      Hi Andreas, All,
>>
>> I'm currently looking at making the singletons SceneFileHandler and 
>> ImageFileHandler replaceable with user derived types [1].
>> While looking at the current code I stumbled over the 
>> setReadCB/setWriteCB functions and I'm wondering what these callbacks 
>> are used for, if present they seem to take over the operation of the 
>> SFH/IFH ? What are use cases for these callbacks and could the same 
>> thing be done if there was a way to derive from SFH/IFH and override 
>> some functions ?
> 
> just for my understanding what do you expect to override in the top
> level handler ?. The specific loaders inside can already be replaced.

i'd like to be able to add the ability of caching things, while that can 
(and maybe should) be done by the app for scenes, for images it is 
tricky, because the loaders all go to the global ImageFileHandler. 
That's why I'd like to have SFH hold a pointer to the IFH to use and 
pass its "this" pointer to the loaders. The default for the IFH would 
simply be the global one.
Maybe that is actually the bigger problem, that loaders always use the 
global objects instead of the ones they were called from ?

> A small problem I see is that it does not seem likely to scale. What
> do you do if project/lib A needs to use their replacement where as
> project/lib B theirs. I would not try to encourage this.

But currently you either have to hack OpenSG or use the callback 
functions to take over control.
I think there are legitimate uses for extending what SFH does (Andreas 
mentioned encrypted streams) and deriving from it seems the better way 
to implement these things. Then finally it seems nice to be able to use 
a derived type for the global instance, instead of being fixed to what 
OpenSG comes with. So basically I'm changing SceneFileHandlerBase a bit 
and instead of

typedef SingletonHolder<SceneFileHandlerBase> SceneFileHandler;

it is:

class SceneFileHandler
{
   public:
     static SceneFileHandlerBase *the(void);

     static bool destroy     (void                           );
     static void setSingleton(SceneFileHandlerBase *singleton);

   private:
     static SceneFileHandlerBaseRefPtr _the;
};

so that _the can be replaced.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to