DatabaseRevisions
Go to the documentation of this file.
/* -*-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 {
class OSGDB_EXPORT FileList : public osg::Object
{
public:
FileList();
FileList(const FileList& fileList, const osg::CopyOp & 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; }
bool empty() const { return _files.empty(); }
bool containsFile(const std::string& filename) const { return _files.count(filename)!=0; }
void addFile(const std::string& filename) { _files.insert(filename); }
bool removeFile(const std::string& filename);
void append(FileList* fileList);
protected:
virtual ~FileList();
FileNames _files;
};
class OSGDB_EXPORT DatabaseRevision : public osg::Object
{
public:
DatabaseRevision();
DatabaseRevision(const DatabaseRevision& revision, const osg::CopyOp & copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgDB, DatabaseRevision)
void setDatabasePath(const std::string& path) { _databasePath = path; }
const std::string& getDatabasePath() const { return _databasePath; }
typedef std::set<std::string> FileNames;
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(); }
bool isFileBlackListed(const std::string& filename) const;
bool removeFile(const std::string& filename);
protected:
virtual ~DatabaseRevision();
std::string _databasePath;
osg::ref_ptr<FileList> _filesAdded;
osg::ref_ptr<FileList> _filesRemoved;
osg::ref_ptr<FileList> _filesModified;
};
class OSGDB_EXPORT DatabaseRevisions : public osg::Object
{
public:
DatabaseRevisions();
DatabaseRevisions(const DatabaseRevisions& revisions, const osg::CopyOp & copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgDB, DatabaseRevisions);
typedef std::vector< osg::ref_ptr<DatabaseRevision> > DatabaseRevisionList;
void setDatabasePath(const std::string& path) { _databasePath = path; }
const std::string& getDatabasePath() const { return _databasePath; }
void addRevision(DatabaseRevision* revision);
void removeRevision(DatabaseRevision* revision);
DatabaseRevision* getDatabaseRevision(unsigned int i) { return i<_revisionList.size() ? _revisionList[i].get() : 0; }
DatabaseRevisionList& getDatabaseRevisionList() { return _revisionList; }
const DatabaseRevisionList& getDatabaseRevisionList() const { return _revisionList; }
bool isFileBlackListed(const std::string& filename) const;
bool removeFile(const std::string& filename);
protected:
virtual ~DatabaseRevisions();
std::string _databasePath;
DatabaseRevisionList _revisionList;
};
}
#endif
Node
ReaderWriter
osgDB::DatabaseRevision
Definition DatabaseRevisions:57
osgDB::DatabaseRevision::_filesRemoved
osg::ref_ptr< FileList > _filesRemoved
Definition DatabaseRevisions:93
osgDB::DatabaseRevision::setFilesAdded
void setFilesAdded(FileList *fileList)
Definition DatabaseRevisions:70
osgDB::DatabaseRevision::FileNames
std::set< std::string > FileNames
Definition DatabaseRevisions:68
osgDB::DatabaseRevision::setFilesModified
void setFilesModified(FileList *fileList)
Definition DatabaseRevisions:78
osgDB::DatabaseRevision::_filesModified
osg::ref_ptr< FileList > _filesModified
Definition DatabaseRevisions:94
osgDB::DatabaseRevision::getFilesAdded
const FileList * getFilesAdded() const
Definition DatabaseRevisions:72
osgDB::DatabaseRevision::setFilesRemoved
void setFilesRemoved(FileList *fileList)
Definition DatabaseRevisions:74
osgDB::DatabaseRevision::isFileBlackListed
bool isFileBlackListed(const std::string &filename) const
osgDB::DatabaseRevision::DatabaseRevision
DatabaseRevision(const DatabaseRevision &revision, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgDB::DatabaseRevision::getFilesRemoved
FileList * getFilesRemoved()
Definition DatabaseRevisions:75
osgDB::DatabaseRevision::getFilesAdded
FileList * getFilesAdded()
Definition DatabaseRevisions:71
osgDB::DatabaseRevision::removeFile
bool removeFile(const std::string &filename)
osgDB::DatabaseRevision::getFilesModified
const FileList * getFilesModified() const
Definition DatabaseRevisions:80
osgDB::DatabaseRevision::_databasePath
std::string _databasePath
Definition DatabaseRevisions:90
osgDB::DatabaseRevision::_filesAdded
osg::ref_ptr< FileList > _filesAdded
Definition DatabaseRevisions:92
osgDB::DatabaseRevision::getFilesRemoved
const FileList * getFilesRemoved() const
Definition DatabaseRevisions:76
osgDB::DatabaseRevision::DatabaseRevision
DatabaseRevision()
osgDB::DatabaseRevision::META_Object
META_Object(osgDB, DatabaseRevision) void setDatabasePath(const std
Definition DatabaseRevisions:63
osgDB::DatabaseRevision::getFilesModified
FileList * getFilesModified()
Definition DatabaseRevisions:79
osgDB::DatabaseRevision::~DatabaseRevision
virtual ~DatabaseRevision()
osgDB::DatabaseRevision::getDatabasePath
const std::string & getDatabasePath() const
Definition DatabaseRevisions:66
osgDB::DatabaseRevisions::_databasePath
std::string _databasePath
Definition DatabaseRevisions:127
osgDB::DatabaseRevisions::DatabaseRevisionList
std::vector< osg::ref_ptr< DatabaseRevision > > DatabaseRevisionList
Definition DatabaseRevisions:106
osgDB::DatabaseRevisions::DatabaseRevisions
DatabaseRevisions()
osgDB::DatabaseRevisions::DatabaseRevisions
DatabaseRevisions(const DatabaseRevisions &revisions, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgDB::DatabaseRevisions::getDatabaseRevisionList
DatabaseRevisionList & getDatabaseRevisionList()
Definition DatabaseRevisions:116
osgDB::DatabaseRevisions::getDatabaseRevision
DatabaseRevision * getDatabaseRevision(unsigned int i)
Definition DatabaseRevisions:114
osgDB::DatabaseRevisions::META_Object
META_Object(osgDB, DatabaseRevisions)
osgDB::DatabaseRevisions::removeRevision
void removeRevision(DatabaseRevision *revision)
osgDB::DatabaseRevisions::removeFile
bool removeFile(const std::string &filename)
osgDB::DatabaseRevisions::getDatabaseRevisionList
const DatabaseRevisionList & getDatabaseRevisionList() const
Definition DatabaseRevisions:117
osgDB::DatabaseRevisions::setDatabasePath
void setDatabasePath(const std::string &path)
Definition DatabaseRevisions:108
osgDB::DatabaseRevisions::isFileBlackListed
bool isFileBlackListed(const std::string &filename) const
osgDB::DatabaseRevisions::_revisionList
DatabaseRevisionList _revisionList
Definition DatabaseRevisions:128
osgDB::DatabaseRevisions::getDatabasePath
const std::string & getDatabasePath() const
Definition DatabaseRevisions:109
osgDB::DatabaseRevisions::addRevision
void addRevision(DatabaseRevision *revision)
osgDB::DatabaseRevisions::~DatabaseRevisions
virtual ~DatabaseRevisions()
osgDB::FileList
Definition DatabaseRevisions:26
osgDB::FileList::META_Object
META_Object(osgDB, FileList)
osgDB::FileList::_files
FileNames _files
Definition DatabaseRevisions:52
osgDB::FileList::getFileNames
FileNames & getFileNames()
Definition DatabaseRevisions:35
osgDB::FileList::append
void append(FileList *fileList)
osgDB::FileList::removeFile
bool removeFile(const std::string &filename)
osgDB::FileList::FileList
FileList(const FileList &fileList, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgDB::FileList::~FileList
virtual ~FileList()
osgDB::FileList::FileNames
std::set< std::string > FileNames
Definition DatabaseRevisions:34
osgDB::FileList::getFileNames
const FileNames & getFileNames() const
Definition DatabaseRevisions:36
osgDB::FileList::addFile
void addFile(const std::string &filename)
Definition DatabaseRevisions:42
osgDB::FileList::containsFile
bool containsFile(const std::string &filename) const
Definition DatabaseRevisions:40
osgDB::FileList::FileList
FileList()
osgDB::FileList::empty
bool empty() const
Definition DatabaseRevisions:38
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Object
Definition Object:61
osg::ref_ptr
Definition ref_ptr:32
osgDB
Definition Archive:24
OSGDB_EXPORT
#define OSGDB_EXPORT
Definition osgDB/Export:39