osgEarth 2.1.1
Static Public Member Functions

osgEarth::CacheFactory Class Reference

List of all members.

Static Public Member Functions

static Cachecreate (const CacheOptions &options)

Detailed Description

Factory class that can load and instantiate a Cache implementation based on the information in the CacheOptions settings.

Definition at line 493 of file Caching.


Member Function Documentation

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:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines