openscenegraph
osgDB/Callbacks
Go to the documentation of this file.
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_CALLBACKS
15#define OSGDB_CALLBACKS 1
16
17#include <osgDB/AuthenticationMap>
18#include <osgDB/ReaderWriter>
19#include <osgDB/FileCache>
20
21#include <deque>
22#include <list>
23#include <iosfwd>
24
25namespace osgDB {
26
27/** list of directories to search through which searching for files. */
28typedef std::deque<std::string> FilePathList;
29
30enum CaseSensitivity
31{
32 CASE_SENSITIVE,
33 CASE_INSENSITIVE
34};
35
36// forward declare
37class Options;
38
39class OSGDB_EXPORT FindFileCallback : public virtual osg::Referenced
40{
41 public:
42
43 virtual std::string findDataFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity);
44
45 virtual std::string findLibraryFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity);
46
47 protected:
48 virtual ~FindFileCallback() {}
49};
50
51
52class OSGDB_EXPORT ReadFileCallback : public virtual osg::Referenced
53{
54 public:
55
56 virtual ReaderWriter::ReadResult openArchive(const std::string& filename,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* useObjectCache);
57
58 virtual ReaderWriter::ReadResult readObject(const std::string& filename, const Options* options);
59
60 virtual ReaderWriter::ReadResult readImage(const std::string& filename, const Options* options);
61
62 virtual ReaderWriter::ReadResult readHeightField(const std::string& filename, const Options* options);
63
64 virtual ReaderWriter::ReadResult readNode(const std::string& filename, const Options* options);
65
66 virtual ReaderWriter::ReadResult readShader(const std::string& filename, const Options* options);
67
68 virtual ReaderWriter::ReadResult readScript(const std::string& filename, const Options* options);
69
70 protected:
71 virtual ~ReadFileCallback() {}
72};
73
74class OSGDB_EXPORT WriteFileCallback : public virtual osg::Referenced
75{
76 public:
77
78 virtual ReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName,const Options* options);
79
80 virtual ReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName,const Options* options);
81
82 virtual ReaderWriter::WriteResult writeHeightField(const osg::HeightField& obj, const std::string& fileName,const Options* options);
83
84 virtual ReaderWriter::WriteResult writeNode(const osg::Node& obj, const std::string& fileName,const Options* options);
85
86 virtual ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options);
87
88 virtual ReaderWriter::WriteResult writeScript(const osg::Script& obj, const std::string& fileName,const Options* options);
89
90 protected:
91 virtual ~WriteFileCallback() {}
92};
93
94class OSGDB_EXPORT FileLocationCallback : public virtual osg::Referenced
95{
96 public:
97
98 enum Location
99 {
100 LOCAL_FILE,
101 REMOTE_FILE
102 };
103
104 virtual Location fileLocation(const std::string& filename, const Options* options) = 0;
105
106 virtual bool useFileCache() const = 0;
107
108 protected:
109 virtual ~FileLocationCallback() {}
110};
111
112}
113
114#endif // OSGDB_OPTIONS