root/OpenSceneGraph/trunk/include/osgFX/Registry @ 13041

Revision 13041, 1.7 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13//osgFX - Copyright (C) 2003 Marco Jez
14
15#ifndef OSGFX_REGISTRY_
16#define OSGFX_REGISTRY_
17
18#include <osgFX/Export>
19#include <osgFX/Effect>
20
21#include <osg/ref_ptr>
22
23#include <map>
24#include <string>
25
26namespace osgFX
27{
28
29    class OSGFX_EXPORT Registry : public osg::Referenced
30    {
31    public:
32
33        struct Proxy {
34            Proxy(const Effect* effect)
35            {
36                Registry::instance()->registerEffect(effect);
37            }
38        };
39
40        typedef std::map<std::string, osg::ref_ptr<const Effect> > EffectMap;
41
42        static Registry* instance();
43
44        inline void registerEffect(const Effect* effect);
45
46        inline const EffectMap& getEffectMap() const;
47
48    protected:
49
50        // Registry is a singleton; constructor and destructor must be protected
51        Registry();
52        ~Registry() {}
53
54    private:
55        EffectMap _effects;
56    };
57
58    // INLINE METHODS
59
60
61
62    inline const Registry::EffectMap& Registry::getEffectMap() const
63    {
64        return _effects;
65    }
66
67    inline void Registry::registerEffect(const Effect* effect)
68    {
69        _effects[effect->effectName()] = effect;
70    }
71
72}
73
74#endif
Note: See TracBrowser for help on using the browser.