1 #ifndef SIMGEAR_OSGSINGLETON_HXX
2 #define SIMGEAR_OSGSINGLETON_HXX 1
4 #include <simgear/structure/Singleton.hxx>
6 #include <osg/Referenced>
11 template <typename RefClass>
19 static RefClass* instance()
21 SingletonRefPtr& singleton
22 = boost::details::pool::singleton_default<SingletonRefPtr>::instance();
23 return singleton.ptr.get();
26 osg::ref_ptr<RefClass> ptr;
29 template <typename RefClass>
30 class ReferencedSingleton : public virtual osg::Referenced
33 static RefClass* instance()
35 return SingletonRefPtr<RefClass>::instance();