| Line | |
|---|
| 1 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield |
|---|
| 2 | * |
|---|
| 3 | * This library is open source and may be redistributed and/or modified under |
|---|
| 4 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or |
|---|
| 5 | * (at your option) any later version. The full license is in LICENSE file |
|---|
| 6 | * included with this distribution, and on the openscenegraph.org website. |
|---|
| 7 | * |
|---|
| 8 | * This library is distributed in the hope that it will be useful, |
|---|
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | * OpenSceneGraph Public License for more details. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef OSGDB_FILECACHE |
|---|
| 15 | #define OSGDB_FILECACHE 1 |
|---|
| 16 | |
|---|
| 17 | #include <osg/Node> |
|---|
| 18 | |
|---|
| 19 | #include <osgDB/ReaderWriter> |
|---|
| 20 | |
|---|
| 21 | namespace osgDB { |
|---|
| 22 | |
|---|
| 23 | class OSGDB_EXPORT FileCache : public osg::Referenced |
|---|
| 24 | { |
|---|
| 25 | public: |
|---|
| 26 | |
|---|
| 27 | FileCache(const std::string& path); |
|---|
| 28 | |
|---|
| 29 | const std::string& getFileCachePath() const { return _fileCachePath; } |
|---|
| 30 | |
|---|
| 31 | virtual std::string createCacheFileName(const std::string& originalFileName) const; |
|---|
| 32 | |
|---|
| 33 | virtual bool existsInCache(const std::string& originalFileName) const; |
|---|
| 34 | |
|---|
| 35 | virtual ReaderWriter::ReadResult readNode(const std::string& originalFileName, const osgDB::Options* options, bool buildKdTreeIfRequired=true) const; |
|---|
| 36 | |
|---|
| 37 | virtual ReaderWriter::WriteResult writeNode(const osg::Node& node, const std::string& originalFileName, const osgDB::Options* options) const; |
|---|
| 38 | |
|---|
| 39 | protected: |
|---|
| 40 | |
|---|
| 41 | virtual ~FileCache(); |
|---|
| 42 | |
|---|
| 43 | std::string _fileCachePath; |
|---|
| 44 | |
|---|
| 45 | }; |
|---|
| 46 | |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | #endif |
|---|