Moved the ReadFunctor to protected section.

This commit is contained in:
Robert Osfield 2004-11-10 13:47:22 +00:00
parent 4e19c03de1
commit 2db9dc2e60
2 changed files with 27 additions and 20 deletions

View File

@ -395,21 +395,6 @@ class OSGDB_EXPORT Registry : public osg::Referenced
/** Get the SharedStateManager. Return 0 if no SharedStateManager has been assigned.*/ /** Get the SharedStateManager. Return 0 if no SharedStateManager has been assigned.*/
SharedStateManager* getSharedStateManager() { return _sharedStateManager.get(); } SharedStateManager* getSharedStateManager() { return _sharedStateManager.get(); }
/** Functor used in internal implementations.*/
struct ReadFunctor
{
ReadFunctor(const std::string& filename, const ReaderWriter::Options* options):
_filename(filename),
_options(options) {}
virtual ~ReadFunctor() {}
virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw) const = 0;
virtual bool isValid(ReaderWriter::ReadResult& readResult) const = 0;
virtual bool isValid(osg::Object* object) const = 0;
std::string _filename;
const ReaderWriter::Options* _options;
};
protected: protected:
@ -436,6 +421,28 @@ class OSGDB_EXPORT Registry : public osg::Referenced
void eraseWrapper(DotOsgWrapperMap& wrappermap,DotOsgWrapper* wrapper); void eraseWrapper(DotOsgWrapperMap& wrappermap,DotOsgWrapper* wrapper);
/** Functor used in internal implementations.*/
struct ReadFunctor
{
ReadFunctor(const std::string& filename, const ReaderWriter::Options* options):
_filename(filename),
_options(options) {}
virtual ~ReadFunctor() {}
virtual ReaderWriter::ReadResult doRead(ReaderWriter& rw) const = 0;
virtual bool isValid(ReaderWriter::ReadResult& readResult) const = 0;
virtual bool isValid(osg::Object* object) const = 0;
std::string _filename;
const ReaderWriter::Options* _options;
};
struct ReadObjectFunctor;
struct ReadImageFunctor;
struct ReadHeightFieldFunctor;
struct ReadNodeFunctor;
struct ReadArchiveFunctor;
ReaderWriter::ReadResult read(const ReadFunctor& readFunctor); ReaderWriter::ReadResult read(const ReadFunctor& readFunctor);
ReaderWriter::ReadResult readImplementation(const ReadFunctor& readFunctor,CacheHintOptions useObjectCache); ReaderWriter::ReadResult readImplementation(const ReadFunctor& readFunctor,CacheHintOptions useObjectCache);

View File

@ -1116,7 +1116,7 @@ bool Registry::writeObject(const osg::Object& obj,Output& fw)
struct ReadObjectFunctor : public Registry::ReadFunctor struct Registry::ReadObjectFunctor : public Registry::ReadFunctor
{ {
ReadObjectFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {} ReadObjectFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {}
@ -1125,7 +1125,7 @@ struct ReadObjectFunctor : public Registry::ReadFunctor
virtual bool isValid(osg::Object* object) const { return object!=0; } virtual bool isValid(osg::Object* object) const { return object!=0; }
}; };
struct ReadImageFunctor : public Registry::ReadFunctor struct Registry::ReadImageFunctor : public Registry::ReadFunctor
{ {
ReadImageFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {} ReadImageFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {}
@ -1134,7 +1134,7 @@ struct ReadImageFunctor : public Registry::ReadFunctor
virtual bool isValid(osg::Object* object) const { return dynamic_cast<osg::Image*>(object)!=0; } virtual bool isValid(osg::Object* object) const { return dynamic_cast<osg::Image*>(object)!=0; }
}; };
struct ReadHeightFieldFunctor : public Registry::ReadFunctor struct Registry::ReadHeightFieldFunctor : public Registry::ReadFunctor
{ {
ReadHeightFieldFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {} ReadHeightFieldFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {}
@ -1143,7 +1143,7 @@ struct ReadHeightFieldFunctor : public Registry::ReadFunctor
virtual bool isValid(osg::Object* object) const { return dynamic_cast<osg::HeightField*>(object)!=0; } virtual bool isValid(osg::Object* object) const { return dynamic_cast<osg::HeightField*>(object)!=0; }
}; };
struct ReadNodeFunctor : public Registry::ReadFunctor struct Registry::ReadNodeFunctor : public Registry::ReadFunctor
{ {
ReadNodeFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {} ReadNodeFunctor(const std::string& filename, const ReaderWriter::Options* options):ReadFunctor(filename,options) {}
@ -1153,7 +1153,7 @@ struct ReadNodeFunctor : public Registry::ReadFunctor
}; };
struct ReadArchiveFunctor : public Registry::ReadFunctor struct Registry::ReadArchiveFunctor : public Registry::ReadFunctor
{ {
ReadArchiveFunctor(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const ReaderWriter::Options* options): ReadArchiveFunctor(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const ReaderWriter::Options* options):
ReadFunctor(filename,options), ReadFunctor(filename,options),