OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

ReaderWriter result checking


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Submission
View previous topic :: View next topic  
Author Message
anishuz (Anish Thomas)
User


Joined: 24 Jul 2012
Posts: 21

PostPosted: Fri Aug 26, 2016 6:25 am    Post subject:
ReaderWriter result checking
Reply with quote

Hi,

I noticed that when ReaderWriters return a ReadStatus::FILE_NOT_FOUND for a file, the osgDB::Registry keeps checking with other ReaderWriters, then generates library names for that file extension, and tries to load those DLLs/SOs.

The code that does the checking is

// first attempt to load the file from existing ReaderWriter's
AvailableReaderWriterIterator itr(_rwList, _pluginMutex);
for(;itr.valid();++itr)
{
ReaderWriter::ReadResult rr = readFunctor.doRead(*itr);
if (readFunctor.isValid(rr)) return rr;
else results.push_back(rr);
}

in ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor)

Now, since ReaderWriters return FILE_NOT_HANDLED when they aren't meant for that file-type, but can return FILE_NOT_FOUND when the search for the file fails, the other ReaderWriters need not be checked.

Attaching an empty osg::Node object to the result to avoid checking the other ReaderWriters would be inefficient. And the receiving NodePaths would need to write the code to handle these empty osg::Node objects too.

Any other opinions?

Thank you!

Cheers,
Anish
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11146

PostPosted: Fri Aug 26, 2016 7:11 am    Post subject:
ReaderWriter result checking
Reply with quote

HI Anish,

Just because one plugin isn't able to locate a file doesn't mean other
plugins won't have the ability to find it. For instance if you have a
file over http then a standard plugin won't find it, but the libcurl
plugin may be able to locate it.

It's a deliberate policy of the Registry to pass on the option for
handling files to all loaded plugins. The design pattern that this
approach is based on is the Chain Of Responsibility Pattern,

Robert.

On 26 August 2016 at 07:26, Anish Thomas <> wrote:
Quote:
Hi,

I noticed that when ReaderWriters return a ReadStatus::FILE_NOT_FOUND for a file, the osgDB::Registry keeps checking with other ReaderWriters, then generates library names for that file extension, and tries to load those DLLs/SOs.

The code that does the checking is

// first attempt to load the file from existing ReaderWriter's
AvailableReaderWriterIterator itr(_rwList, _pluginMutex);
for(;itr.valid();++itr)
{
ReaderWriter::ReadResult rr = readFunctor.doRead(*itr);
if (readFunctor.isValid(rr)) return rr;
else results.push_back(rr);
}

in ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor)

Now, since ReaderWriters return FILE_NOT_HANDLED when they aren't meant for that file-type, but can return FILE_NOT_FOUND when the search for the file fails, the other ReaderWriters need not be checked.

Attaching an empty osg::Node object to the result to avoid checking the other ReaderWriters would be inefficient. And the receiving NodePaths would need to write the code to handle these empty osg::Node objects too.

Any other opinions?

Thank you!

Cheers,
Anish

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68448#68448








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Submission All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts different result rotating Vec3d for Q... gambr General 2 Tue Jan 24, 2017 10:25 am View latest post
No new posts Deferring loading in an DB ReaderWrit... James Turner General 1 Fri Nov 18, 2016 8:03 pm View latest post
No new posts Insersector doesn't take into account... robertosfield General 5 Mon Oct 17, 2016 11:37 am View latest post
No new posts OcclusionQueryNode: do not retrieve t... scrawl Submission 1 Thu Feb 25, 2016 4:41 pm View latest post
No new posts OpenGL Error Checking DiB78 Submission 2 Wed Dec 30, 2015 10:45 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP