/usr/include/simgear/scene/util/OsgSingleton.hxx is in libsimgear-dev 3.4.0-3.
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 | #ifndef SIMGEAR_OSGSINGLETON_HXX
#define SIMGEAR_OSGSINGLETON_HXX 1
#include <simgear/structure/Singleton.hxx>
#include <osg/Referenced>
#include <osg/ref_ptr>
namespace simgear {
template <typename RefClass>
class SingletonRefPtr
{
public:
SingletonRefPtr()
{
ptr = new RefClass;
}
static RefClass* instance()
{
SingletonRefPtr& singleton
= boost::details::pool::singleton_default<SingletonRefPtr>::instance();
return singleton.ptr.get();
}
private:
osg::ref_ptr<RefClass> ptr;
};
template <typename RefClass>
class ReferencedSingleton : public virtual osg::Referenced
{
public:
static RefClass* instance()
{
return SingletonRefPtr<RefClass>::instance();
}
};
}
#endif
|