/*
 * Copyright (C) 2006 Mike Pultz. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Library General Public License as published
 * by the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * Written by: Mike Pultz (mike@mrhost.ca)
 *
 */
#ifndef __CSINGLETON_H__
#define __CSINGLETON_H__

template <typename T> class csingleton {
        protected:
                csingleton()
		{ 
		}

        public:
                static T* instance()
                {
                        return &(reference());
                }
                static T& reference();

        virtual ~csingleton()
	{ 
	}
};
template <typename T> inline T& csingleton<T>::reference()
{
	static T ref;
	return ref;
}

#endif //__CSINGLETON_H__
