On 2 June 2016 at 11:48, Ralf Habacker <[email protected]> wrote:
> Am 02.06.2016 um 12:29 schrieb Robert Osfield:
>
> Hi Robert,
>> I don't think an extra method getContextHash() would be required. I'd
>> just implement an == operator in Options
> to use the == operator on iterating through the cache entries in
> getRefFromObjectCache ?
>
> getRefFromObjectCache() uses find() for fetching the key, which requires
> a string representation of a unique key for the related Options
> instance. On inserting there is also a string key required.
The map inside ObjectCache would need to change from:
typedef std::map<std::string, ObjectTimeStampPair >
ObjectCacheMap;
To something like:
typedef std::pair<std::string, osg::ref_ptr<osgDB::Options>>
FileNameOptionsPair;
typedef std::map<FileNameOptionsPair, ObjectTimeStampPair >
ObjectCacheMap;
We'd need to pass in a less operator for the map as well to test
against contents of the Options object rather than rely upon pointer
comparison.
>
>> and then clone the Options object that is passed into addEntryToObjectCache.
> what should I do with the cloned instance, save in the object cache ?
>
> Can you explain ?
One would simply use a osg::clone(options) to generate the options
object to store in the cache, this would insulate the cache from being
invalidated by changes to the original Options object passed in,
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org