This file is indexed.

/usr/include/osgEarthFeatures/Session is in libosgearth-dev 2.5.0+dfsg-8build1.

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
/* -*-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_FEATURES_SESSION_H
#define OSGEARTH_FEATURES_SESSION_H 1

#include <osgEarthFeatures/Common>
#include <osgEarthFeatures/ScriptEngine>
#include <osgEarthSymbology/StyleSheet>
#include <osgEarth/StateSetCache>
#include <osgEarth/ThreadingUtils>
#include <osgEarth/MapInfo>
#include <osgEarth/MapFrame>
#include <osgEarth/Map>

namespace osgEarth { namespace Features
{
    using namespace osgEarth;
    using namespace osgEarth::Symbology;

    class FeatureSource;

    /**
     * Session is a state object that exists throughout the life of one or more related
     * feature compilations.
     *
     * A Session holds shared, re-usable data elements that can be accessed through a 
     * FilterContext.
     *
     * Whereas a FilterContext exists thoughout the life of a single compilation, a Session
     * exists one level above this and governs any number of "related" compilations
     * (e.g., the compilation of many grid cells comprising a single feature layer).
     *
     * Session implements the URIResolver interface to resolve relative URIs.
     */
    class OSGEARTHFEATURES_EXPORT Session : public osg::Referenced
    {
    public:
        /**
         * Constructs a new Session that is tied to a map
         */
        Session( const Map* map, StyleSheet* styles =0L, FeatureSource* source =0L, const osgDB::Options* dbOptions =0L );
        virtual ~Session();

        /**
         * URI Context for relative path resolution.
         */
        void setURIContext( const URIContext& value ) { _uriContext = value; }
        const URIContext& uriContext() const { return _uriContext; }

        /**
         * Gets the underlying map (frame) interface in this session
         */
        MapFrame createMapFrame( Map::ModelParts parts =Map::TERRAIN_LAYERS ) const;

        /**
         * Gets the map information backing up this session.
         */
        const MapInfo& getMapInfo() const { return _mapInfo; }

        /** Gets the SRS of the map behind this session */
        const SpatialReference* getMapSRS() const { return _mapInfo.getSRS(); }

        /**
         * Gets the map related to this session. Be carefull, this is held by an osg::observer_ptr and may be NULL
         */
        const Map* getMap() const { return _map.get(); }

        /** The style sheet governing this session. */
        void setStyles( StyleSheet* value );
        StyleSheet* styles() const { return _styles.get(); }

        /** Gets the current feature source */
        FeatureSource* getFeatureSource() const;

        /** The I/O options for operations within this session */
        const osgDB::Options* getDBOptions() const;

    public:
        template<typename T>
        struct CreateFunctor {
            virtual T* operator()() const =0;
        };

        /**
         * Stores an object in the shared Session cache.
         *
         * WARNING! Don't store things like nodes in here unless you plan
         * to clone them. This is a multi-threaded store.
         *
         * Returns the object written, OR the already-existing object if overwrite = false
         * and the key was already taken.
         */
        template<typename T>
        T* putObject( const std::string& key, T* object, bool overwrite =true ) {
            //Threading::ScopedWriteLock lock( _objMapMutex );
            Threading::ScopedMutexLock lock( _objMapMutex );
            ObjectMap::iterator i = _objMap.find(key);
            if ( i != _objMap.end() && !overwrite )
                return dynamic_cast<T*>(i->second.get());
            _objMap[key] = object;
            return object;
        }

        /**
         * Gets an object from the shared Session cache.
         * (returns a ref_ptr so as not to lose its ref in a multi-threaded app)
         */
        template<typename T>
        osg::ref_ptr<T> getObject( const std::string& key ) {
            //Threading::ScopedReadLock lock( _objMapMutex );
            Threading::ScopedMutexLock lock( _objMapMutex );
            ObjectMap::const_iterator i = _objMap.find(key);
            return i != _objMap.end() ? dynamic_cast<T*>( i->second.get() ) : 0L;
        }

        template<typename T>
        bool getOrCreateObject(const std::string& key, osg::ref_ptr<T>& output, const CreateFunctor<T>& create) {
            Threading::ScopedMutexLock lock( _objMapMutex );
            ObjectMap::const_iterator i = _objMap.find(key);
            if ( i != _objMap.end() ) {
                output = dynamic_cast<T*>( i->second.get() );
                return true;
            }
            else {
                T* object = create();
                if ( object ) {
                    _objMap[key] = object;
                    output = object;
                    return true;
                }
                else {
                    return false;
                }
            }
        }

        void removeObject( const std::string& key );

    public:
        /**
         * The cache for optimizing stateset sharing within a session
         */
        StateSetCache* getStateSetCache() { return _stateSetCache.get(); }

    public:
      ScriptEngine* getScriptEngine() const;

    private:
        typedef std::map<std::string, osg::ref_ptr<osg::Referenced> > ObjectMap;
        ObjectMap                    _objMap;
        //Threading::ReadWriteMutex    _objMapMutex;
        Threading::Mutex             _objMapMutex;

        URIContext                         _uriContext;
        osg::observer_ptr<const Map>       _map;
        MapInfo                            _mapInfo;
        osg::ref_ptr<StyleSheet>           _styles;
        osg::ref_ptr<const osgDB::Options> _dbOptions;
        osg::ref_ptr<ScriptEngine>         _styleScriptEngine;
        osg::ref_ptr<FeatureSource>        _featureSource;
        osg::ref_ptr<StateSetCache>        _stateSetCache;
    };

} }

#endif // OSGEARTH_FEATURES_SESSION_H