2009-05-29 16:24:11 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSGDB_DATABASEREVISIONS
|
|
|
|
#define OSGDB_DATABASEREVISIONS 1
|
|
|
|
|
|
|
|
#include <osg/Node>
|
|
|
|
|
|
|
|
#include <osgDB/ReaderWriter>
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
namespace osgDB {
|
|
|
|
|
2009-05-30 02:24:47 +08:00
|
|
|
class OSGDB_EXPORT FileList : public osg::Object
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
FileList();
|
|
|
|
FileList(const FileList& fileList, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
META_Object(osgDB, FileList)
|
|
|
|
|
|
|
|
typedef std::set<std::string> FileNames;
|
|
|
|
FileNames& getFileNames() { return _files; }
|
|
|
|
const FileNames& getFileNames() const { return _files; }
|
|
|
|
|
2009-06-18 00:54:39 +08:00
|
|
|
bool empty() const { return _files.empty(); }
|
|
|
|
|
2009-06-17 23:12:50 +08:00
|
|
|
bool containsFile(const std::string& filename) const { return _files.count(filename)!=0; }
|
|
|
|
|
|
|
|
void addFile(const std::string& filename) { _files.insert(filename); }
|
2009-05-30 02:24:47 +08:00
|
|
|
|
2009-06-04 22:07:12 +08:00
|
|
|
bool removeFile(const std::string& filename);
|
|
|
|
|
2009-06-19 19:04:48 +08:00
|
|
|
void append(FileList* fileList);
|
|
|
|
|
2009-05-30 02:24:47 +08:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~FileList();
|
|
|
|
|
|
|
|
FileNames _files;
|
|
|
|
};
|
|
|
|
|
2009-05-29 16:24:11 +08:00
|
|
|
|
|
|
|
class OSGDB_EXPORT DatabaseRevision : public osg::Object
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
DatabaseRevision();
|
|
|
|
DatabaseRevision(const DatabaseRevision& revision, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
META_Object(osgDB, DatabaseRevision)
|
|
|
|
|
2009-06-03 00:54:34 +08:00
|
|
|
void setDatabasePath(const std::string& path) { _databasePath = path; }
|
|
|
|
const std::string& getDatabasePath() const { return _databasePath; }
|
|
|
|
|
2009-05-29 16:24:11 +08:00
|
|
|
typedef std::set<std::string> FileNames;
|
|
|
|
|
2009-05-30 02:24:47 +08:00
|
|
|
void setFilesAdded(FileList* fileList) { _filesAdded = fileList; }
|
|
|
|
FileList* getFilesAdded() { return _filesAdded.get(); }
|
|
|
|
const FileList* getFilesAdded() const { return _filesAdded.get(); }
|
|
|
|
|
|
|
|
void setFilesRemoved(FileList* fileList) { _filesRemoved = fileList; }
|
|
|
|
FileList* getFilesRemoved() { return _filesRemoved.get(); }
|
|
|
|
const FileList* getFilesRemoved() const { return _filesRemoved.get(); }
|
|
|
|
|
|
|
|
void setFilesModified(FileList* fileList) { _filesModified = fileList; }
|
|
|
|
FileList* getFilesModified() { return _filesModified.get(); }
|
|
|
|
const FileList* getFilesModified() const { return _filesModified.get(); }
|
2009-05-29 16:24:11 +08:00
|
|
|
|
|
|
|
bool isFileBlackListed(const std::string& filename) const;
|
|
|
|
|
2009-06-04 22:07:12 +08:00
|
|
|
bool removeFile(const std::string& filename);
|
|
|
|
|
2009-05-29 16:24:11 +08:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~DatabaseRevision();
|
|
|
|
|
2009-06-03 00:54:34 +08:00
|
|
|
std::string _databasePath;
|
|
|
|
|
|
|
|
osg::ref_ptr<FileList> _filesAdded;
|
|
|
|
osg::ref_ptr<FileList> _filesRemoved;
|
|
|
|
osg::ref_ptr<FileList> _filesModified;
|
2009-05-29 16:24:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class OSGDB_EXPORT DatabaseRevisions : public osg::Object
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
DatabaseRevisions();
|
|
|
|
DatabaseRevisions(const DatabaseRevisions& revisions, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
META_Object(osgDB, DatabaseRevisions)
|
|
|
|
|
|
|
|
typedef std::vector< osg::ref_ptr<DatabaseRevision> > DatabaseRevisionList;
|
|
|
|
|
2009-06-03 00:54:34 +08:00
|
|
|
void setDatabasePath(const std::string& path) { _databasePath = path; }
|
|
|
|
const std::string& getDatabasePath() const { return _databasePath; }
|
|
|
|
|
2009-05-30 02:24:47 +08:00
|
|
|
void addRevision(DatabaseRevision* revision);
|
|
|
|
void removeRevision(DatabaseRevision* revision);
|
|
|
|
|
2009-06-17 18:39:39 +08:00
|
|
|
DatabaseRevision* getDatabaseRevision(unsigned int i) { return i<_revisionList.size() ? _revisionList[i].get() : 0; }
|
2009-06-04 22:07:12 +08:00
|
|
|
|
2009-05-29 16:24:11 +08:00
|
|
|
DatabaseRevisionList& getDatabaseRevisionList() { return _revisionList; }
|
2009-05-30 02:24:47 +08:00
|
|
|
const DatabaseRevisionList& getDatabaseRevisionList() const { return _revisionList; }
|
2009-05-29 16:24:11 +08:00
|
|
|
|
|
|
|
bool isFileBlackListed(const std::string& filename) const;
|
|
|
|
|
2009-06-04 22:07:12 +08:00
|
|
|
bool removeFile(const std::string& filename);
|
|
|
|
|
2009-05-29 16:24:11 +08:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~DatabaseRevisions();
|
|
|
|
|
2009-06-03 00:54:34 +08:00
|
|
|
std::string _databasePath;
|
|
|
|
DatabaseRevisionList _revisionList;
|
2009-05-29 16:24:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|