|
osgEarth 2.1.1
|
Static Public Member Functions | |
| static Cache * | create (const CacheOptions &options) |
Factory class that can load and instantiate a Cache implementation based on the information in the CacheOptions settings.
| Cache * CacheFactory::create | ( | const CacheOptions & | options | ) | [static] |
Definition at line 517 of file Caching.cpp.
{
osg::ref_ptr<Cache> result =0L;
OE_INFO << LC << "Initializing cache of type \"" << options.getDriver() << "\"" << std::endl;
if ( options.getDriver().empty() )
{
OE_WARN << LC << "ILLEGAL: no driver set in cache options" << std::endl;
}
else if ( options.getDriver() == "tms" )
{
result = new TMSCache( options );
}
else if ( options.getDriver() == "tilecache" )
{
result = new DiskCache( options );
}
else // try to load from a plugin
{
osg::ref_ptr<osgDB::ReaderWriter::Options> rwopt = new osgDB::ReaderWriter::Options();
rwopt->setPluginData( CACHE_OPTIONS_TAG, (void*)&options );
std::string driverExt = ".osgearth_cache_" + options.getDriver();
osgDB::ReaderWriter::ReadResult rr = osgDB::readObjectFile( driverExt, rwopt.get() );
result = dynamic_cast<Cache*>( rr.getObject() );
if ( !result )
{
OE_WARN << LC << "Failed to load cache plugin for type \"" << options.getDriver() << "\"" << std::endl;
}
}
return result.release();
}
Here is the call graph for this function:
Here is the caller graph for this function:
1.7.3