This file is indexed.

/usr/include/osgEarth/Extension is in libosgearth-dev 2.9.0+dfsg-1.

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
/* -*-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_EXTENSION_H
#define OSGEARTH_EXTENSION_H 1

#include <osgEarth/Common>
#include <osgEarth/Config>
#include <osgEarth/PluginLoader>
#include <osg/Object>
#include <osgDB/Options>
#include <osgDB/ReaderWriter>
#include <osgDB/FileNameUtils>
#include <osgDB/Registry>


namespace osgEarth
{
    /**
     * An Extension is an object that can be loaded on demand (from a plugin) 
     * and can have multiple object-specific interfaces. Its main function is
     * to enable activation and configuration of a plugin feature from an
     * osgEarth .earth file.
     *
     * For example, the pattern for declaring an Extension that connects to a
     * MapNode looks like:
     *
     *   public MyExtension : public Extension,
     *                        public ExtensionInterface<MapNode>
     *
     * You can implement more than one interface. This one would connect to a
     * MapNode and to a UI Control:
     *
     *   public MyExtension : public Extension,
     *                        public ExtensionInterface<MapNode>,
     *                        public ExtensionInterface<Control>
     *
     * You can register an Extension so that one can activate and configure it
     * from a .earth file. Use the registration macro:
     *
     *   REGISTER_OSGEARTH_EXTENSION( osgearth_extension, ExtentionClassName );
     *
     * Where the string "extension" in osgearth_extension is the key string 
     * that will appear in the earth file under the <map> element.
     */
    class OSGEARTH_EXPORT Extension : public osg::Object // header-only
    {
    public:
        /**
         * Sets DB options that this extension should use when doing IO operations.
         */
        virtual void setDBOptions(const osgDB::Options* readOptions) { }

        /**
         * Gets the configuration options that can be used to re-configure
         * this Extension. Necessary for serialization.
         */
        virtual const ConfigOptions& getConfigOptions() const;

        /**
         * Convenience function for casting the extension to another one of its
         * interfaces.
         */
        template<typename T> T* as() { return dynamic_cast<T*>(this); }
        template<typename T> const T* as() const { return dynamic_cast<T*>(this); }

    protected:
        Extension();

    protected:
        virtual ~Extension() { }

    public:
        /**
         * Attempts to create an instance of an named extension.
         */
        static Extension* create(const std::string& name, const ConfigOptions& options);

        /**
         * Fetch configuration options from a plugin loader
         */
        static const ConfigOptions& getConfigOptions(const osgDB::Options*);

    private:
        ConfigOptions _defaultOptions;
    };

    
    /**
     * This template lets you create object-specific interfaces in an extension.
     */
    template<typename T> class ExtensionInterface
    {
    public:
        /**
         * Connects the extension to an object.
         */
        virtual bool connect(T* object) =0;

        /**
         * Disconnects the extension from an object. This should be the
         * same object used to call connect().
         */
        virtual bool disconnect(T* object) =0;
        
        /**
         * Cast a base extension to this interface, or return NULL
         * if the extenstion doesn't implemenent this inteface.
         */
        static ExtensionInterface<T>* get(Extension* e) {
            return dynamic_cast< ExtensionInterface<T>* >(e);
        }
    };

    // convenience define for extensions
#define META_osgEarth_Extension(CLASS) \
    META_Object(osgEarth,CLASS); \
    CLASS () { } \
    CLASS (const CLASS & rhs, const osg::CopyOp& op) { } \
    virtual ~ CLASS() { }

} // namespace osgEarth

#define REGISTER_OSGEARTH_EXTENSION(NAME,CLASS) \
    extern "C" void osgdb_##NAME(void) {} \
    static osgEarth::RegisterPluginLoader< osgEarth::PluginLoader<CLASS, osgEarth::Extension> > g_proxy_##CLASS_##NAME( #NAME );

#endif