![]() |
TerraLib 4.1
|
00001 /************************************************************************************ 00002 TerraLib - a library for developing GIS applications. 00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio. 00004 00005 This code is part of the TerraLib library. 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 You should have received a copy of the GNU Lesser General Public 00012 License along with this library. 00013 00014 The authors reassure the license terms regarding the warranties. 00015 They specifically disclaim any warranties, including, but not limited to, 00016 the implied warranties of merchantability and fitness for a particular purpose. 00017 The library provided hereunder is on an "as is" basis, and the authors have no 00018 obligation to provide maintenance, support, updates, enhancements, or modifications. 00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct, 00020 indirect, special, incidental, or consequential damages arising out of the use 00021 of this library and its documentation. 00022 *************************************************************************************/ 00026 #ifndef __TERRALIB_INTERNAL_SINGLETON_H 00027 #define __TERRALIB_INTERNAL_SINGLETON_H 00028 00030 00034 #include "TeDefines.h" 00035 00036 template <class T> 00037 class TeSingleton { 00038 public: 00039 00040 static T& instance () 00041 { 00042 static T instance_; 00043 return instance_; 00044 } 00045 00046 // -- Destructor 00047 00048 virtual ~TeSingleton() {} // base class 00049 00050 protected: 00051 00052 // -- Contructors 00053 00054 TeSingleton() {} 00055 00056 00057 private: 00058 00059 // No copy allowed 00060 00061 TeSingleton(const TeSingleton&); 00062 TeSingleton& operator=(const TeSingleton&){return *this;} 00063 00064 }; 00065 00066 #endif 00067