OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Archive.h
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 
24 namespace osgDB {
25 
26 
29 {
30  public:
31  Archive();
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 
80 OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint=4096);
81 
83 OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,Options* options);
84 }
85 
86 #endif // OSGDB_ARCHIVE
#define NULL
Definition: Export.h:59
FileType
Definition: FileUtils.h:46
virtual const char * libraryName() const
Definition: Archive.h:34
virtual bool acceptsExtension(const std::string &) const
Definition: Archive.h:38
osgDB::DirectoryContents FileNameList
Definition: Archive.h:55
OSGDB_EXPORT Archive * openArchive(const std::string &filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint=4096)
virtual const char * className() const
Definition: Archive.h:36
Definition: Archive.h:24
OSGDB_EXPORT bool fileExists(const std::string &filename)
#define OSGDB_EXPORT
Definition: Export.h:39
Definition: Node.h:71
std::vector< std::string > DirectoryContents
Definition: FileUtils.h:67
void readImage(const osg::Image *image, O &operation)
Definition: ImageUtils.h:59
OSGDB_EXPORT DirectoryContents getDirectoryContents(const std::string &dirName)