Show
Ignore:
Timestamp:
05/11/09 13:39:12 (5 years ago)
Author:
robert
Message:

Moved Registry::ReadFileCallback? + WriteFileCallback?, and osgDB::ReaderWriter::Options into their own separate Options file and into the osgDB namespace.

Introduced a new callback osgDB::FindFileCallback? that overrides the default behavior of findDataFile/findLibraryFile.

Introduced support for assigning ReaderWriter::Options directory to PagedLOD.

Introduced new osgDB::FileLocationCallback? for assistancing the DatabasePager? to know when a file is hosted on a local or remote file system.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osgDB/Options

    r10172 r10174  
    1717#include <osgDB/AuthenticationMap> 
    1818#include <osgDB/ReaderWriter> 
     19#include <osgDB/FileCache> 
    1920 
    2021#include <deque> 
     
    8788}; 
    8889 
     90class OSGDB_EXPORT FileLocationCallback : public virtual osg::Referenced 
     91{ 
     92    public: 
     93 
     94        enum Location 
     95        { 
     96            LOCAL_FILE, 
     97            REMOTE_FILE 
     98        }; 
     99 
     100        virtual Location fileLocation(const std::string& filename, const Options* options) = 0; 
     101 
     102        virtual bool useFileCache() const = 0; 
     103 
     104    protected: 
     105        virtual ~FileLocationCallback() {} 
     106}; 
     107 
     108 
    89109/** Options base class used for passing options into plugins to control their operation.*/ 
    90 class Options : public osg::Object 
     110class OSGDB_EXPORT Options : public osg::Object 
    91111{ 
    92112    public: 
     
    234254 
    235255 
    236         /** Set the Registry callback to use in place of the default writeFile calls.*/ 
     256        /** Set the callback to use in place of the default writeFile calls.*/ 
    237257        void setWriteFileCallback( WriteFileCallback* cb) { _writeFileCallback = cb; } 
    238258 
    239259        /** Get the const writeFile callback.*/ 
    240260        WriteFileCallback* getWriteFileCallback() const { return _writeFileCallback.get(); } 
     261 
     262 
     263        /** Set the callback to use inform the DatabasePager whether a file is located on local or remote file system..*/ 
     264        void setFileLocationCallback( FileLocationCallback* cb) { _fileLocationCallback = cb; } 
     265 
     266        /** Get the callback to use inform the DatabasePager whether a file is located on local or remote file system..*/ 
     267        FileLocationCallback* getFileLocationCallback() const { return _fileLocationCallback.get(); } 
     268 
     269 
     270        /** Set the FileCache that is used to manage local storage of files downloaded from the internet.*/ 
     271        void setFileCache(FileCache* fileCache) { _fileCache = fileCache; } 
     272 
     273        /** Get the FileCache that is used to manage local storage of files downloaded from the internet.*/ 
     274        FileCache* getFileCache() const { return _fileCache.get(); } 
    241275 
    242276 
     
    259293        osg::ref_ptr<ReadFileCallback>      _readFileCallback; 
    260294        osg::ref_ptr<WriteFileCallback>     _writeFileCallback; 
     295        osg::ref_ptr<FileLocationCallback>  _fileLocationCallback; 
     296 
     297        osg::ref_ptr<FileCache>             _fileCache; 
    261298}; 
    262299