Files
simgear/simgear/structure/Singleton.hxx
T
Mathias Froehlich 8c78588ee1 Untangle osg singleton dependencies.
Take two. The ModelRegistry's are already derived from osg::Referenced.
So also introduce the osg dependent version in simgear/scene/util.
2012-03-03 18:57:48 +01:00

29 lines
552 B
C++

#ifndef SIMGEAR_SINGLETON_HXX
#define SIMGEAR_SINGLETON_HXX 1
#include "singleton.hpp"
namespace simgear
{
/**
* Class that supplies the address of a singleton instance. This class
* can be inherited by its Class argument in order to support the
* instance() method in that class.
*/
template <typename Class>
class Singleton
{
protected:
Singleton() {}
public:
static Class* instance()
{
Class& singleton
= boost::details::pool::singleton_default<Class>::instance();
return &singleton;
}
};
}
#endif