/usr/include/osgEarth/CacheBin is in libosgearth-dev 2.5.0+dfsg-2+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2013 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_CACHE_BIN_H
#define OSGEARTH_CACHE_BIN_H 1
#include <osgEarth/Common>
#include <osgEarth/Config>
#include <osgEarth/IOTypes>
#include <osgDB/ReaderWriter>
namespace osgEarth
{
/**
* CacheBin is a names container within a Cache. It allows different
* application modules to compartmentalize their data withing a single
* cache location.
*/
class /*no export*/ CacheBin : public osg::Referenced
{
public:
/** returned by the getRecordStatus() function */
enum RecordStatus {
STATUS_NOT_FOUND, // record is not in the cache
STATUS_OK, // record is in the cache and newer than the test time
STATUS_EXPIRED // record is in the cache and older than the test time
};
public:
/**
* Constructs a caching bin.
* @param binID Name of this caching bin (unique withing a Cache)
* @param driver ReaderWriter that serializes data for this caching bin.
*/
CacheBin( const std::string& binID ) : _binID(binID) { }
/** dtor */
virtual ~CacheBin() { }
/**
* The identifier (unique withing a Cache) of this bin.
*/
const std::string& getID() const { return _binID; }
/**
* Reads an object from the cache bin.
* @param key Lookup key to read
* @param minTime Fail if the entry's timestamp is older than this
*/
virtual ReadResult readObject(const std::string& key, TimeStamp minTime) =0;
/**
* Reads an image from the cache bin.
* @param key Lookup key to read
* @param minTime Fail if the entry's timestamp is older than this
*/
virtual ReadResult readImage(const std::string& key, TimeStamp minTime) =0;
/**
* Reads a string buffer from the cache bin.
* @param key Lookup key to read.
* @param minTime Fail if the entry's timestamp is older than this.
*/
virtual ReadResult readString(const std::string& key, TimeStamp minTime) =0;
/**
* Writes an object (or an image) to the cache bin.
* @param key Lookup key to write to
* @param object Object to serialize to the cache
*/
virtual bool write(
const std::string& key,
const osg::Object* object,
const Config& metadata =Config() ) =0;
/**
* Gets the status of a key, i.e. not found, valid or expired.
* Pass in a minTime = 0 to simply check whether the record exists.
* @param key Lookup key to check for
* @param minTime Return EXPIRED if the key exists but is older than this
*/
virtual RecordStatus getRecordStatus(const std::string& key, TimeStamp minTime) =0;
/**
* Checks whether a key exists in the cache.
* @deprecated - Please use getRecordStatus instead
*/
//bool isCached(const std::string& key) {
// return getRecordStatus(key, 0) == STATUS_OK; }
/**
* Purge an entry from the cache bin
*/
virtual bool remove(const std::string& key) =0;
/**
* Update a record's timestamp to "now", as if it were a
* new entry.
*/
virtual bool touch(const std::string& key) =0;
/**
* Reads custom metadata from the cache.
*/
virtual Config readMetadata() { return Config(); }
/**
* Writes custom metadata to the cache.
*/
virtual bool writeMetadata( const Config& meta ) { return false; }
/**
* Purges all entries in the cache bin.
*/
virtual bool purge() = 0;
/**
* Store this pointer in an options structure
*/
void apply( osgDB::Options* options ) const {
if ( options ) options->setPluginData( "osgEarth::CacheBin", (void*)this );
}
/**
* Retrieve pointer from an options struture
*/
static CacheBin* get( const osgDB::Options* options ) {
return options ? const_cast<CacheBin*>(static_cast<const CacheBin*>(options->getPluginData("osgEarth::CacheBin"))) : 0L;
}
protected:
std::string _binID;
};
}
#endif // OSGEARTH_CACHE_BIN_H
|