2
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
3
* Copyright 2008-2010 Pelican Mapping
6
* osgEarth is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>
19
#ifndef OSGEARTH_DRIVER_SQLITE3_CACHE_DRIVEROPTIONS
20
#define OSGEARTH_DRIVER_SQLITE3_CACHE_DRIVEROPTIONS 1
22
#include <osgEarth/Common>
23
#include <osgEarth/Caching>
24
#include <osgEarth/TileSource>
26
// there is leak using the cache if compressed. It's resolved in
27
// rev 11609 of osg svn
29
namespace osgEarth { namespace Drivers
31
using namespace osgEarth;
33
class Sqlite3CacheOptions : public CacheOptions // NO EXPORT; header only
37
* Pathname of the database file.
39
optional<std::string>& path() { return _path; }
40
const optional<std::string>& path() const { return _path; }
42
optional<bool>& asyncWrites() { return _useAsyncWrites; }
43
const optional<bool>& asyncWrites() const { return _useAsyncWrites; }
45
optional<bool>& serialized() { return _serialized; }
46
const optional<bool>& serialized() const { return _serialized; }
48
optional<unsigned int>& maxSize() { return _maxSize; }
49
const optional<unsigned int>& maxSize() const { return _maxSize; }
53
Sqlite3CacheOptions( const ConfigOptions& options =ConfigOptions() )
54
: CacheOptions( options ),
55
_useAsyncWrites( true ),
59
setDriver( "sqlite3" );
63
Config getConfig() const {
64
Config conf = CacheOptions::getConfig();
65
conf.updateIfSet( "path", _path );
66
conf.updateIfSet( "async_writes", _useAsyncWrites );
67
conf.updateIfSet( "serialized", _serialized );
68
conf.updateIfSet( "max_size", _maxSize );
72
void mergeConfig( const Config& conf ) {
73
CacheOptions::mergeConfig( conf );
77
void fromConfig( const Config& conf ) {
78
conf.getIfSet( "path", _path );
79
conf.getIfSet( "async_writes", _useAsyncWrites );
80
conf.getIfSet( "serialized", _serialized );
81
conf.getIfSet( "max_size", _maxSize );
84
optional<std::string> _path;
85
optional<bool> _useAsyncWrites;
86
optional<bool> _serialized;
87
optional<unsigned int>_maxSize; // layer - MB
90
} } // namespace osgEarth::Drivers
92
#endif // OSGEARTH_DRIVER_SQLITE3_CACHE_DRIVEROPTIONS