OpenSceneGraph 3.6.5
Archive
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_ARCHIVE
15#define OSGDB_ARCHIVE 1
16
17#include <osgDB/ReaderWriter>
18#include <osgDB/Registry>
19#include <osgDB/FileUtils>
20
21#include <fstream>
22#include <list>
23
24namespace osgDB {
25
26
29{
30 public:
32 virtual ~Archive();
33
34 virtual const char* libraryName() const { return "osgDB"; }
35
36 virtual const char* className() const { return "Archive"; }
37
38 virtual bool acceptsExtension(const std::string& /*extension*/) const { return true; }
39
41 virtual void close() = 0;
42
44 virtual std::string getArchiveFileName() const = 0;
45
47 virtual std::string getMasterFileName() const = 0;
48
50 virtual bool fileExists(const std::string& filename) const = 0;
51
53 virtual FileType getFileType(const std::string& filename) const = 0;
54
56
58 virtual bool getFileNames(FileNameList& fileNames) const = 0;
59
62 virtual DirectoryContents getDirectoryContents(const std::string& dirName) const;
63
64
65 virtual ReadResult readObject(const std::string& /*fileName*/,const Options* =NULL) const = 0;
66 virtual ReadResult readImage(const std::string& /*fileName*/,const Options* =NULL) const = 0;
67 virtual ReadResult readHeightField(const std::string& /*fileName*/,const Options* =NULL) const = 0;
68 virtual ReadResult readNode(const std::string& /*fileName*/,const Options* =NULL) const = 0;
69 virtual ReadResult readShader(const std::string& /*fileName*/,const Options* =NULL) const = 0;
70
71 virtual WriteResult writeObject(const osg::Object& /*obj*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
72 virtual WriteResult writeImage(const osg::Image& /*image*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
73 virtual WriteResult writeHeightField(const osg::HeightField& /*heightField*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
74 virtual WriteResult writeNode(const osg::Node& /*node*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
75 virtual WriteResult writeShader(const osg::Shader& /*shader*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
76
77};
78
80OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint=4096);
81
83OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,Options* options);
84}
85
86#endif // OSGDB_ARCHIVE
The osgDB library provides support for reading and writing scene graphs, providing a plugin framework...
Definition Archive:24
OSGDB_EXPORT Archive * openArchive(const std::string &filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint=4096)
Open an archive for reading or writing.
std::vector< std::string > DirectoryContents
simple list of names to represent a directory's contents.
Definition FileUtils:67
FileType
Definition FileUtils:47
Image class for encapsulating the storage texture image data.
Definition Image:179
Base class for all internal nodes in the scene graph.
Definition Node:72
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
osg::Shader is an application-level abstraction of an OpenGL glShader.
Definition Shader:89
Definition Shape:483
Base class for implementing database Archives.
Definition Archive:29
virtual WriteResult writeNode(const osg::Node &, const std::string &, const Options *=NULL) const =0
virtual ReadResult readImage(const std::string &, const Options *=NULL) const =0
virtual WriteResult writeHeightField(const osg::HeightField &, const std::string &, const Options *=NULL) const =0
virtual void close()=0
close the archive.
virtual ReadResult readHeightField(const std::string &, const Options *=NULL) const =0
virtual const char * libraryName() const
return the name of the object's library.
Definition Archive:34
virtual WriteResult writeImage(const osg::Image &, const std::string &, const Options *=NULL) const =0
osgDB::DirectoryContents FileNameList
Definition Archive:55
virtual WriteResult writeShader(const osg::Shader &, const std::string &, const Options *=NULL) const =0
virtual bool acceptsExtension(const std::string &) const
Return true if ReaderWriter accepts specified file extension.
Definition Archive:38
virtual bool fileExists(const std::string &filename) const =0
return true if file exists in archive.
virtual ReadResult readObject(const std::string &, const Options *=NULL) const =0
virtual ReadResult readShader(const std::string &, const Options *=NULL) const =0
virtual const char * className() const
return the name of the object's class type.
Definition Archive:36
virtual ReadResult readNode(const std::string &, const Options *=NULL) const =0
virtual std::string getArchiveFileName() const =0
Get the file name which represents the archived file.
virtual ~Archive()
virtual WriteResult writeObject(const osg::Object &, const std::string &, const Options *=NULL) const =0
virtual DirectoryContents getDirectoryContents(const std::string &dirName) const
return the contents of a directory.
virtual bool getFileNames(FileNameList &fileNames) const =0
Get the full list of file names available in the archive.
virtual std::string getMasterFileName() const =0
Get the file name which represents the master file recorded in the Archive.
virtual FileType getFileType(const std::string &filename) const =0
return type of file.
Options base class used for passing options into plugins to control their operation.
Definition Options:30
osgDB::Options Options
Definition ReaderWriter:227
ArchiveStatus
Definition ReaderWriter:221
ReaderWriter()
Definition ReaderWriter:44
Definition ReaderWriter:109
Definition ReaderWriter:184
#define NULL
Definition Export:55
#define OSGDB_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.