Hi,

On Fri, 2007-04-06 at 16:10 +0200, Carsten Neumann wrote:
>       Hi Gerrit,
> 
> >> Or we could cache the offsets of the fields from the start of the
> >> container. This would never change (except for DynamicFieldAttachment)
> >> even if container copies/instances in some aspects a destroyed and
> >> recreated.
> > 
> > well it does change as the offsets are relative to the ref pointer
> > passed which is either this during resolveLinks or the destination
> > pointer during the sync. As the offsets need to be relative to the
> > target container caching might not work that well because you would 
> > have to readjust the offsets according to the target container. 
> 
> Either I misunderstand what you are writing here or you misunderstood
> what I've suggested above. I'll try to explain my idea better:
> 
> Let's say we have a container SomeContainer with two MFUInt32 (_mfData1,
> _mfData2). To perform the sync or resolveLinks we need to obtain
> pointers to the fields in all (existing) aspects. AspectStore can give
> us the pointer to the SomeContainer instance for each aspect
> 
> // pointer to the container in aspect i
> SomeContainer *pAspect =
> dynamic_cast<SomeContainer*>(_pAspectStore->getPtr(i));
> 
> now _mfData1 will always be a constant number of bytes further in memory
> than pAspect, i.e.
> 
> // obtain pointer to _mfData1 in aspect i
> MFUInt32 *pData1 =
> reinterpret_cast<MFUInt32 *>(reinterpret_cast<Char8*>(pAspect) +
> data1Offset);
> 

we mean different things. The offset we currently use is the offset from
one aspects mfield to the same mfield in another aspect, so inside the
mfield I can do (this + offset) to get to the copy of another aspect.
This way the field does not need any knowledge not available in
OSGBase.

Currently I tend to leave it this way until timings show that it 
is a real problem. BTW as the offsets are instance independent they
would be better cached inside the type object.

regards,
  gerrit




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to