From f4c20290509d7ed3a8fd5304577e7a4cc0b9d974 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 3 Apr 2007 03:49:53 +0000 Subject: Ok, no code is left in src, it's all in src/old. We'll gradually move code back into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier. --- src/singleton.h | 59 --------------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/singleton.h (limited to 'src/singleton.h') diff --git a/src/singleton.h b/src/singleton.h deleted file mode 100644 index 47adbd5..0000000 --- a/src/singleton.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef SINGLETON_H -#define SINGLETON_H - -#include - -/** - * Provides singleton functionality in a modular sort of way. Make this the - * base class of any other class and you immediately gain singleton - * functionality. Be sure to make your constructor and various functions use - * intellegent scoping. Cleanup and instantiation are performed automatically - * for you at first use and program exit. There are two things that you must - * do when using this template, first is to inherit from it with the name of - * your class filling in for T and then make this class a friend of your class. - *@code - * // Making the Single Singleton: - * class Single : public Singleton - * { - * friend class Singleton; - * protected: - * Single(); - * ... - * }; - @endcode - * You can still add public functions and variables to your new Singleton child - * class, but your constructor should be protected (hence the need for the - * friend decleration). - *@author Mike Buland - */ -template -class Singleton -{ -protected: - /** - * Private constructor. This constructor is empty but has a body so that - * you can make your own override of it. Be sure that you're override is - * also protected. - */ - Singleton() {}; - -private: - /** - * Copy constructor, defined so that you could write your own as well. - */ - Singleton( const Singleton& ); - -public: - /** - * Get a handle to the contained instance of the contained class. It is - * a reference. - *@returns A reference to the contained object. - */ - static T &getInstance() - { - static T i; - return i; - } -}; - -#endif -- cgit v1.2.3