Code Search for Developers
 
 
  

singleton.h from osgDesigner at Krugle


Show singleton.h syntax highlighted

#ifndef __GEN_PROG_PLUGIN_DETAIL_SINGLETON_H__
#define __GEN_PROG_PLUGIN_DETAIL_SINGLETON_H__ 1

#include <memory>

#include <osgDesigner/core/Export.h>

namespace gen_prog
{
    namespace plugin
    {
        namespace detail
        {
            template < typename T >
            class OSGDESIGNER_EXPORT singleton
            {
                public:
					typedef T                singleton_type;


                    static T * instance() 
                    { 
						static std::auto_ptr< singleton_type > _instance(new singleton_type);
						create_object.do_nothing();
                        return (_instance.get());
                    };
                    
                private:
                    singleton();

					struct object_creator
					{
					  object_creator() { singleton<T>::instance(); }
					  inline void do_nothing() const {}
					};
					static object_creator create_object;
            };
			template < typename T >
			typename singleton<T>::object_creator singleton<T>::create_object;
        }
    }
}

#endif // ** __GEN_PROG_PLUGIN_DETAIL_SINGLETON_H__ ** //




See more files for this project here

osgDesigner

osgDesigner is a graphical tool used to modify an OpenSceneGraph (OSG) scene using the osgIntrospection framework. OpenSceneGraph developpers will be able to extend osgDesigner at need using (editor | render | osgIntrospection wrapper) plugin system.

Project homepage: http://sourceforge.net/projects/osgdesigner
Programming language(s): C++,Shell Script
License: other

  dynamic_library_identifier.h
  singleton.h
  thread_locker.h
  tracker.h