class OSGDB_EXPORT osgDB::Registry

Registry is a singleton factory which stores the reader/writers which are linked in at runtime for reading non-native file formats.

Inheritance:


Public Methods

[more]static Registry* instance()
[more]void readCommandLine(osg::ArgumentParser& commandLine)
read the command line arguments
[more]void addFileExtensionAlias(const std::string mapExt, const std::string toExt)
register an fileextension alias to mapExt toExt, the later should the the extension name of the readerwriter plugin library.
[more]void addDotOsgWrapper(DotOsgWrapper* wrapper)
[more]void removeDotOsgWrapper(DotOsgWrapper* wrapper)
[more]void addReaderWriter(ReaderWriter* rw)
[more]void removeReaderWriter(ReaderWriter* rw)
[more]std::string createLibraryNameForFile(const std::string& fileName)
create the platform specific library name associated with file
[more]std::string createLibraryNameForExtension(const std::string& ext)
create the platform specific library name associated with file extension
[more]std::string createLibraryNameForNodeKit(const std::string& name)
create the platform specific library name associated with nodekit library name
[more]bool loadLibrary(const std::string& fileName)
find the library in the SG_LIBRARY_PATH and load it
[more]bool closeLibrary(const std::string& fileName)
close the attached library with specified name
[more]ReaderWriter* getReaderWriterForExtension(const std::string& ext)
get a reader writer which handles specified extension
[more]osg::Object* readObjectOfType(const osg::Object& compObj, Input& fr)
[more]osg::Object* readObjectOfType(const basic_type_wrapper &btw, Input& fr)
[more]osg::Object* readObject(Input& fr)
[more]osg::Image* readImage(Input& fr)
[more]osg::Drawable* readDrawable(Input& fr)
[more]osg::StateAttribute* readStateAttribute(Input& fr)
[more]osg::Node* readNode(Input& fr)
[more]bool writeObject(const osg::Object& obj, Output& fw)
[more]ReaderWriter::ReadResult readObject(const std::string& fileName, bool useObjectCache)
[more]ReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName)
[more]ReaderWriter::ReadResult readImage(const std::string& fileName, bool useObjectCache)
[more]ReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName)
[more]ReaderWriter::ReadResult readNode(const std::string& fileName, bool useObjectCache)
[more]ReaderWriter::WriteResult writeNode(const osg::Node& node, const std::string& fileName)
[more]void setCreateNodeFromImage(bool flag)
[more]bool getCreateNodeFromImage() const
[more]void setOptions(ReaderWriter::Options* opt)
[more]ReaderWriter::Options* getOptions()
[more]const ReaderWriter::Options* getOptions() const
[more]void initFilePathLists()
initilize both the Data and Library FilePaths, by default called by the constructor, so it should only be required if you want to force the re-reading of environmental variables
[more]void initDataFilePathList()
initilize the Data FilePath by reading the OSG_FILE_PATH environmental variable
[more]void setDataFilePathList(const FilePathList& filepath)
Set the data file path using a list of paths stored in a FilePath, which is used when search for data files
[more]void setDataFilePathList(const std::string& paths)
Set the data file path using a single string deliminated either with ';' (Windows) or ':' (All other platforms), which is used when search for data files
[more]FilePathList& getDataFilePathList()
get the data file path which is used when search for data files
[more]const FilePathList& getDataFilePathList() const
get the const data file path which is used when search for data files
[more]void initLibraryFilePathList()
initilize the Library FilePath by reading the OSG_LIBRARY_PATH and the appropriate system environmental variables
[more]void setLibraryFilePathList(const FilePathList& filepath)
Set the library file path using a list of paths stored in a FilePath, which is used when search for data files
[more]void setLibraryFilePathList(const std::string& paths)
Set the library file path using a single string deliminated either with ';' (Windows) or ':' (All other platforms), which is used when search for data files
[more]FilePathList& getLibraryFilePathList()
get the library file path which is used when search for library (dso/dll's) files
[more]const FilePathList& getLibraryFilePathList() const
get the const library file path which is used when search for library (dso/dll's) files
[more]static void convertStringPathIntoFilePathList(const std::string& paths, FilePathList& filepath)
convert a string containing a list of paths deliminated either with ';' (Windows) or ':' (All other platforms) into FilePath represetation
[more]void updateTimeStampOfObjectsInCacheWithExtenalReferences(double currentTime)
For each object in the cache which has an reference count greater than 1 (and therefore referenced by elsewhere in the application) set the time stamp for that object in the cache to specified time.
[more]void removeExpiredObjectsInCache(double expiryTime)
Removed object in the cache which have a time stamp at or before the specified expiry time.
[more]void clearObjectCache()
Remove all objects in the cache regardless of having external references or expiry times

Protected Fields

[more]bool _createNodeFromImage
[more]DotOsgWrapperMap _objectWrapperMap
[more]DotOsgWrapperMap _imageWrapperMap
[more]DotOsgWrapperMap _drawableWrapperMap
[more]DotOsgWrapperMap _stateAttrWrapperMap
[more]DotOsgWrapperMap _nodeWrapperMap
[more]DotOsgWrapperMap _classNameWrapperMap
[more]ReaderWriterList _rwList
[more]DynamicLibraryList _dlList
[more]bool _openingLibrary
[more]ExtensionAliasMap _extAliasMap
[more]osg::ref_ptr<ReaderWriter::Options> _options
[more]FilePathList _dataFilePath
[more]FilePathList _libraryFilePath
[more]ObjectCache _objectCache

Protected Methods

[more]virtual ~Registry()
[more] Registry()
constructor is private, as its a singleton, preventing construction other than via the instance() method and therefore ensuring only one copy is ever constructed
[more]DynamicLibraryList::iterator getLibraryItr(const std::string& fileName)
get the attached library with specified name
[more]DynamicLibrary* getLibrary(const std::string& fileName)
[more]osg::Object* readObject(DotOsgWrapperMap& dowMap, Input& fr)
[more]void eraseWrapper(DotOsgWrapperMap& wrappermap, DotOsgWrapper* wrapper)
[more]ReaderWriter::ReadResult readObject(const std::string& fileName)
[more]ReaderWriter::ReadResult readImage(const std::string& fileName)
[more]ReaderWriter::ReadResult readNode(const std::string& fileName)

Protected Members

[more]typedef std::map< std::string, osg::ref_ptr<DotOsgWrapper> > DotOsgWrapperMap
[more]typedef std::vector< osg::ref_ptr<ReaderWriter> > ReaderWriterList
[more]typedef std::vector< osg::ref_ptr<DynamicLibrary> > DynamicLibraryList
[more]typedef std::map< std::string, std::string> ExtensionAliasMap
[more]typedef std::pair<osg::ref_ptr<osg::Object>, double > ObjectTimeStampPair
[more]typedef std::map<std::string, ObjectTimeStampPair > ObjectCache


Documentation

Registry is a singleton factory which stores the reader/writers which are linked in at runtime for reading non-native file formats.

The RegisterDotOsgWrapperProxy can be used to automatically register DotOsgWrappers, at runtime with the Registry. A DotOsgWrapper encapsulates the functions that can read and write to the .osg for each osg::Object.

The RegisterReaderWriterProxy can be used to automatically register at runtime a reader/writer with the Registry.

ostatic Registry* instance()

ovoid readCommandLine(osg::ArgumentParser& commandLine)
read the command line arguments

ovoid addFileExtensionAlias(const std::string mapExt, const std::string toExt)
register an fileextension alias to mapExt toExt, the later should the the extension name of the readerwriter plugin library. For example to map .tif files to the tiff loader, use addExtAlias("tif","tiff") which will enable .tif to be read by the libdb_tiff readerwriter plugin.

ovoid addDotOsgWrapper(DotOsgWrapper* wrapper)

ovoid removeDotOsgWrapper(DotOsgWrapper* wrapper)

ovoid addReaderWriter(ReaderWriter* rw)

ovoid removeReaderWriter(ReaderWriter* rw)

ostd::string createLibraryNameForFile(const std::string& fileName)
create the platform specific library name associated with file

ostd::string createLibraryNameForExtension(const std::string& ext)
create the platform specific library name associated with file extension

ostd::string createLibraryNameForNodeKit(const std::string& name)
create the platform specific library name associated with nodekit library name

obool loadLibrary(const std::string& fileName)
find the library in the SG_LIBRARY_PATH and load it

obool closeLibrary(const std::string& fileName)
close the attached library with specified name

oReaderWriter* getReaderWriterForExtension(const std::string& ext)
get a reader writer which handles specified extension

oosg::Object* readObjectOfType(const osg::Object& compObj, Input& fr)

oosg::Object* readObjectOfType(const basic_type_wrapper &btw, Input& fr)

oosg::Object* readObject(Input& fr)

oosg::Image* readImage(Input& fr)

oosg::Drawable* readDrawable(Input& fr)

oosg::StateAttribute* readStateAttribute(Input& fr)

oosg::Node* readNode(Input& fr)

obool writeObject(const osg::Object& obj, Output& fw)

oReaderWriter::ReadResult readObject(const std::string& fileName, bool useObjectCache)

oReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName)

oReaderWriter::ReadResult readImage(const std::string& fileName, bool useObjectCache)

oReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName)

oReaderWriter::ReadResult readNode(const std::string& fileName, bool useObjectCache)

oReaderWriter::WriteResult writeNode(const osg::Node& node, const std::string& fileName)

ovoid setCreateNodeFromImage(bool flag)

obool getCreateNodeFromImage() const

ovoid setOptions(ReaderWriter::Options* opt)

oReaderWriter::Options* getOptions()

oconst ReaderWriter::Options* getOptions() const

ovoid initFilePathLists()
initilize both the Data and Library FilePaths, by default called by the constructor, so it should only be required if you want to force the re-reading of environmental variables

ovoid initDataFilePathList()
initilize the Data FilePath by reading the OSG_FILE_PATH environmental variable

ovoid setDataFilePathList(const FilePathList& filepath)
Set the data file path using a list of paths stored in a FilePath, which is used when search for data files

ovoid setDataFilePathList(const std::string& paths)
Set the data file path using a single string deliminated either with ';' (Windows) or ':' (All other platforms), which is used when search for data files

oFilePathList& getDataFilePathList()
get the data file path which is used when search for data files

oconst FilePathList& getDataFilePathList() const
get the const data file path which is used when search for data files

ovoid initLibraryFilePathList()
initilize the Library FilePath by reading the OSG_LIBRARY_PATH and the appropriate system environmental variables

ovoid setLibraryFilePathList(const FilePathList& filepath)
Set the library file path using a list of paths stored in a FilePath, which is used when search for data files

ovoid setLibraryFilePathList(const std::string& paths)
Set the library file path using a single string deliminated either with ';' (Windows) or ':' (All other platforms), which is used when search for data files

oFilePathList& getLibraryFilePathList()
get the library file path which is used when search for library (dso/dll's) files

oconst FilePathList& getLibraryFilePathList() const
get the const library file path which is used when search for library (dso/dll's) files

ostatic void convertStringPathIntoFilePathList(const std::string& paths, FilePathList& filepath)
convert a string containing a list of paths deliminated either with ';' (Windows) or ':' (All other platforms) into FilePath represetation

ovoid updateTimeStampOfObjectsInCacheWithExtenalReferences(double currentTime)
For each object in the cache which has an reference count greater than 1 (and therefore referenced by elsewhere in the application) set the time stamp for that object in the cache to specified time. This would typically be called once per frame by applications which are doing database paging, and need to prune objects that are no longer required. Time value is time in sceonds.

ovoid removeExpiredObjectsInCache(double expiryTime)
Removed object in the cache which have a time stamp at or before the specified expiry time. This would typically be called once per frame by applications which are doing database paging, and need to prune objects that are no longer required, and called after the a called after the call to updateTimeStampOfObjectsInCacheWithExtenalReferences(currentTime). Note, the currentTime is not the expiryTime, one would typically set the expiry time to a fixed amount of time before currentTime, such as expiryTime = currentTime-10.0. Time value is time in sceonds.

ovoid clearObjectCache()
Remove all objects in the cache regardless of having external references or expiry times

ovirtual ~Registry()

otypedef std::map< std::string, osg::ref_ptr<DotOsgWrapper> > DotOsgWrapperMap

otypedef std::vector< osg::ref_ptr<ReaderWriter> > ReaderWriterList

otypedef std::vector< osg::ref_ptr<DynamicLibrary> > DynamicLibraryList

otypedef std::map< std::string, std::string> ExtensionAliasMap

otypedef std::pair<osg::ref_ptr<osg::Object>, double > ObjectTimeStampPair

otypedef std::map<std::string, ObjectTimeStampPair > ObjectCache

o Registry()
constructor is private, as its a singleton, preventing construction other than via the instance() method and therefore ensuring only one copy is ever constructed

oDynamicLibraryList::iterator getLibraryItr(const std::string& fileName)
get the attached library with specified name

oDynamicLibrary* getLibrary(const std::string& fileName)

obool _createNodeFromImage

oosg::Object* readObject(DotOsgWrapperMap& dowMap, Input& fr)

ovoid eraseWrapper(DotOsgWrapperMap& wrappermap, DotOsgWrapper* wrapper)

oReaderWriter::ReadResult readObject(const std::string& fileName)

oReaderWriter::ReadResult readImage(const std::string& fileName)

oReaderWriter::ReadResult readNode(const std::string& fileName)

oDotOsgWrapperMap _objectWrapperMap

oDotOsgWrapperMap _imageWrapperMap

oDotOsgWrapperMap _drawableWrapperMap

oDotOsgWrapperMap _stateAttrWrapperMap

oDotOsgWrapperMap _nodeWrapperMap

oDotOsgWrapperMap _classNameWrapperMap

oReaderWriterList _rwList

oDynamicLibraryList _dlList

obool _openingLibrary

oExtensionAliasMap _extAliasMap

oosg::ref_ptr<ReaderWriter::Options> _options

oFilePathList _dataFilePath

oFilePathList _libraryFilePath

oObjectCache _objectCache


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.