/usr/include/osgEarth/Registry 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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | /* -*-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_REGISTRY
#define OSGEARTH_REGISTRY 1
#include <osgEarth/Common>
#include <osgEarth/CachePolicy>
#include <osgEarth/Units>
#include <OpenThreads/ReentrantMutex>
#include <OpenThreads/ScopedLock>
#include <osgEarth/ThreadingUtils>
#include <osg/Referenced>
#include <osgDB/ReaderWriter>
#include <osgText/Font>
#define GDAL_SCOPED_LOCK \
OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> _slock( osgEarth::Registry::instance()->getGDALMutex() )\
namespace osgEarth
{
class Cache;
class Capabilities;
class Profile;
class ShaderFactory;
class TaskServiceManager;
class URIReadCallback;
class ColorFilterRegistry;
class StateSetCache;
/**
* Application-wide global repository.
*/
class OSGEARTH_EXPORT Registry : public osg::Referenced
{
public:
/** Access the global Registry singleton. */
static Registry* instance(bool erase = false);
/** Gets a well-known named profile instance. */
const Profile* getNamedProfile( const std::string& name ) const;
/** Gets the global-geodetic builtin profile */
const Profile* getGlobalGeodeticProfile() const;
/** Gets the global-meractor builtin profile (mercator/WGS84 datum) */
const Profile* getGlobalMercatorProfile() const;
/** Gets the spherical-mercator builtin profile (mercator/sphere) */
const Profile* getSphericalMercatorProfile() const;
/** Gets the unified cube builtin profile */
const Profile* getCubeProfile() const;
/** Access to the application-wide GDAL serialization mutex. GDAL is not thread-safe. */
OpenThreads::ReentrantMutex& getGDALMutex();
/** The system-wide default cache. */
Cache* getCache() const;
void setCache( Cache* cache );
/** The override cache policy (overrides all others if set) */
const optional<CachePolicy>& overrideCachePolicy() const { return _overrideCachePolicy; }
void setOverrideCachePolicy( const CachePolicy& policy );
/** The default cache policy (used when no policy is set) */
const optional<CachePolicy>& defaultCachePolicy() const { return _defaultCachePolicy; }
void setDefaultCachePolicy( const CachePolicy& policy );
/**
* Gets the cache policy.
* First checks for an override policy; then looks in the DB::Options for one,
* then checks for the default policy; then returns false as a last resort.
*/
bool getCachePolicy( optional<CachePolicy>& cp, const osgDB::Options* options =0L ) const;
/**
* Whether the given filename is blacklisted
*/
bool isBlacklisted(const std::string &filename);
/**
* Blacklist the given filename
*/
void blacklist(const std::string &filename);
/**
* Gets the number of blacklisted filenames
*/
unsigned int getNumBlacklistedFilenames();
/**
* Clears the blacklist
*/
void clearBlacklist();
/**
* Sets or gets a default system font to use
*/
void setDefaultFont( osgText::Font* font );
osgText::Font* getDefaultFont();
/**
* The graphics hardware capabilities for this platform.
*/
const Capabilities& getCapabilities() const;
void setCapabilities( Capabilities* caps );
static const Capabilities& capabilities() { return instance()->getCapabilities(); }
/**
* Gets or sets the default shader factory. You can replace the default
* shader factory if you want to alter any of osgEarth's baseline shaders
* (advanced usage).
*/
const ShaderFactory* getShaderFactory() const;
void setShaderFactory( ShaderFactory* lib );
static const ShaderFactory* shaderFactory() { return instance()->getShaderFactory(); }
/**
* A default StateSetCache to use by any process that uses one.
* A StateSetCache assist in stateset sharing across multiple nodes.
* Note: A registry-wide SSC is only supported in OSG 3.1.4+. See
* the Registry.cpp comments for details.
*/
StateSetCache* getStateSetCache() const;
void setStateSetCache( StateSetCache* cache );
static StateSetCache* stateSetCache() { return instance()->getStateSetCache(); }
/**
* Gets a reference to the global task service manager.
*/
TaskServiceManager* getTaskServiceManager() {
return _taskServiceManager.get(); }
/**
* Generates an instance-wide global unique ID.
*/
UID createUID();
/**
* Sets a global read callback for URI objects.
*/
void setURIReadCallback( URIReadCallback* callback );
/**
* Gets the global read callback for URI objects.
*/
URIReadCallback* getURIReadCallback() const;
/**
* Gets the default set of osgDB::Options to use.
*/
const osgDB::Options* getDefaultOptions() const { return _defaultOptions.get(); }
/**
* Clones an options structure (fixing the archive caching), or creates
* a new one.
*/
osgDB::Options* cloneOrCreateOptions( const osgDB::Options* options =0L ) const;
/**
* Registers a Units definition.
*/
void registerUnits( const Units* staticInstance );
const Units* getUnits(const std::string& name) const;
/**
* The name of the default terrain engine driver
*/
void setDefaultTerrainEngineDriverName( const std::string& name );
const std::string& getDefaultTerrainEngineDriverName() const { return _terrainEngineDriver; }
protected:
virtual ~Registry();
Registry();
void destruct();
OpenThreads::ReentrantMutex _gdal_mutex;
bool _gdal_registered;
osg::ref_ptr<const Profile> _global_geodetic_profile;
osg::ref_ptr<const Profile> _global_mercator_profile;
osg::ref_ptr<const Profile> _spherical_mercator_profile;
osg::ref_ptr<const Profile> _cube_profile;
Threading::ReadWriteMutex _regMutex;
int _numGdalMutexGets;
typedef std::map< std::string, std::string> MimeTypeExtensionMap;
// maps mime-types to extensions.
MimeTypeExtensionMap _mimeTypeExtMap;
osg::ref_ptr<Cache> _cache;
optional<CachePolicy> _defaultCachePolicy;
optional<CachePolicy> _overrideCachePolicy;
typedef std::set<std::string> StringSet;
StringSet _blacklistedFilenames;
Threading::ReadWriteMutex _blacklistMutex;
osg::ref_ptr<ShaderFactory> _shaderLib;
osg::ref_ptr<TaskServiceManager> _taskServiceManager;
// unique ID generator:
int _uidGen;
mutable Threading::Mutex _uidGenMutex;
// system capabilities:
osg::ref_ptr< Capabilities > _caps;
mutable Threading::Mutex _capsMutex;
void initCapabilities();
osg::ref_ptr<osgDB::Options> _defaultOptions;
osg::ref_ptr<URIReadCallback> _uriReadCallback;
osg::ref_ptr<osgText::Font> _defaultFont;
typedef std::vector<const Units*> UnitsVector;
UnitsVector _unitsVector;
mutable Threading::ReadWriteMutex _unitsVectorMutex;
osg::ref_ptr<StateSetCache> _stateSetCache;
std::string _terrainEngineDriver;
};
}
/** Proxy class for automatic registration of Units with the Registry.*/
struct osgEarthRegisterUnits {
osgEarthRegisterUnits(const osgEarth::Units* units) {
osgEarth::Registry::instance()->registerUnits(units);
}
};
#define OSGEARTH_REGISTER_UNITS(NAME,INSTANCE) \
static osgEarthRegisterUnits s_osgEarthRegistryUnitsProxy##NAME (INSTANCE)
#endif //OSGEARTH_REGISTRY
|