From Vincent Bourdier, addition of out of memory read result.

This commit is contained in:
Robert Osfield 2010-03-10 14:28:18 +00:00
parent e082b01f26
commit 950d282f55
3 changed files with 6 additions and 2 deletions

View File

@ -110,7 +110,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
FILE_LOADED, //!< File successfully found, loaded, and converted into osg.
FILE_LOADED_FROM_CACHE, //!< File found in cache and returned.
ERROR_IN_READING_FILE, //!< File found, loaded, but an error was encountered during processing.
FILE_REQUESTED //!< Asyncronous file read has been requested, but returning immediatiely, keep polling plugin till file read has been completed.
FILE_REQUESTED, //!< Asyncronous file read has been requested, but returning immediatiely, keep polling plugin till file read has been completed.
INSUFFICIENT_MEMORY_TO_LOAD //!< File found but not loaded because estimated memory usage is not enought
};
ReadResult(ReadStatus status=FILE_NOT_HANDLED):_status(status) {}
@ -150,6 +151,7 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
bool error() const { return _status==ERROR_IN_READING_FILE; }
bool notHandled() const { return _status==FILE_NOT_HANDLED || _status==NOT_IMPLEMENTED; }
bool notFound() const { return _status==FILE_NOT_FOUND; }
bool notEnoughMemory() const { return _status==INSUFFICIENT_MEMORY_TO_LOAD; }
protected:

View File

@ -619,6 +619,7 @@ void DatabasePager::DatabaseThread::run()
if (rr.validNode()) databaseRequest->_loadedModel = rr.getNode();
if (rr.error()) OSG_NOTIFY(osg::WARN)<<"Error in reading file "<<databaseRequest->_fileName<<" : "<<rr.message() << std::endl;
if (rr.notEnoughMemory()) OSG_INFO<<"Not enought memory to load file "<<databaseRequest->_fileName << std::endl;
if (databaseRequest->_loadedModel.valid() &&
fileCache.valid() &&

View File

@ -68,7 +68,8 @@ Node* osgDB::readNodeFile(const std::string& filename,const Options* options)
{
ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options);
if (rr.validNode()) return rr.takeNode();
if (rr.error()) notify(WARN) << rr.message() << std::endl;
if (rr.error()) OSG_WARN << rr.message() << std::endl;
if (rr.notEnoughMemory()) OSG_INFO << "Not enought memory to load file "<<filename << std::endl;
return NULL;
}