1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
14#ifndef OSGDB_DATABASEREVISIONS
15#define OSGDB_DATABASEREVISIONS 1
19#include <osgDB/ReaderWriter>
25class OSGDB_EXPORT FileList : public osg::Object
30 FileList(const FileList& fileList, const osg::CopyOp & copyop=osg::CopyOp::SHALLOW_COPY);
32 META_Object(osgDB, FileList);
34 typedef std::set<std::string> FileNames;
35 FileNames& getFileNames() { return _files; }
36 const FileNames& getFileNames() const { return _files; }
38 bool empty() const { return _files.empty(); }
40 bool containsFile(const std::string& filename) const { return _files.count(filename)!=0; }
42 void addFile(const std::string& filename) { _files.insert(filename); }
44 bool removeFile(const std::string& filename);
46 void append(FileList* fileList);
56class OSGDB_EXPORT DatabaseRevision : public osg::Object
61 DatabaseRevision(const DatabaseRevision& revision, const osg::CopyOp & copyop=osg::CopyOp::SHALLOW_COPY);
63 META_Object(osgDB, DatabaseRevision)
65 void setDatabasePath(const std::string& path) { _databasePath = path; }
66 const std::string& getDatabasePath() const { return _databasePath; }
68 typedef std::set<std::string> FileNames;
70 void setFilesAdded(FileList* fileList) { _filesAdded = fileList; }
71 FileList* getFilesAdded() { return _filesAdded.get(); }
72 const FileList* getFilesAdded() const { return _filesAdded.get(); }
74 void setFilesRemoved(FileList* fileList) { _filesRemoved = fileList; }
75 FileList* getFilesRemoved() { return _filesRemoved.get(); }
76 const FileList* getFilesRemoved() const { return _filesRemoved.get(); }
78 void setFilesModified(FileList* fileList) { _filesModified = fileList; }
79 FileList* getFilesModified() { return _filesModified.get(); }
80 const FileList* getFilesModified() const { return _filesModified.get(); }
82 bool isFileBlackListed(const std::string& filename) const;
84 bool removeFile(const std::string& filename);
88 virtual ~DatabaseRevision();
90 std::string _databasePath;
92 osg::ref_ptr<FileList> _filesAdded;
93 osg::ref_ptr<FileList> _filesRemoved;
94 osg::ref_ptr<FileList> _filesModified;
97class OSGDB_EXPORT DatabaseRevisions : public osg::Object
102 DatabaseRevisions(const DatabaseRevisions& revisions, const osg::CopyOp & copyop=osg::CopyOp::SHALLOW_COPY);
104 META_Object(osgDB, DatabaseRevisions);
106 typedef std::vector< osg::ref_ptr<DatabaseRevision> > DatabaseRevisionList;
108 void setDatabasePath(const std::string& path) { _databasePath = path; }
109 const std::string& getDatabasePath() const { return _databasePath; }
111 void addRevision(DatabaseRevision* revision);
112 void removeRevision(DatabaseRevision* revision);
114 DatabaseRevision* getDatabaseRevision(unsigned int i) { return i<_revisionList.size() ? _revisionList[i].get() : 0; }
116 DatabaseRevisionList& getDatabaseRevisionList() { return _revisionList; }
117 const DatabaseRevisionList& getDatabaseRevisionList() const { return _revisionList; }
119 bool isFileBlackListed(const std::string& filename) const;
121 bool removeFile(const std::string& filename);
125 virtual ~DatabaseRevisions();
127 std::string _databasePath;
128 DatabaseRevisionList _revisionList;