30 #ifndef __TERRALIB_CORE_LIB_LIBRARYMANAGER_H__
31 #define __TERRALIB_CORE_LIB_LIBRARYMANAGER_H__
34 #include "../Config.h"
40 #include <boost/function.hpp>
162 #define TERRALIB_LIBRARY_BEGIN(library_name) \
163 class library_ ## library_name \
167 library_ ## library_name() \
169 LibraryEntry le = {#library_name, \
174 te::core::LibraryManager::instance().insert(le); \
177 ~library_ ## library_name() \
179 if(te::core::LibraryManager::instance().exists(#library_name))\
181 te::core::LibraryManager::instance().get(#library_name).shutdown();\
182 te::core::LibraryManager::instance().remove(#library_name);\
187 #define TERRALIB_LIBRARY_STARTUP \
190 #define TERRALIB_LIBRARY_SHUTDOWN \
193 #define TERRALIB_LIBRARY_END(library_name) \
196 static library_ ## library_name s_lib;
A singleton that can be used to observe the available libraries in the system.
bool exists(const std::string &name)
Checks if a LibraryEntry exists from a given name.
static LibraryManager & instance()
It returns a reference to the singleton instance.
~LibraryManager()
Singleton destructor must be private or protected.
const LibraryEntry & get(const std::string &name)
Return a null pointer if a library doesnt't exist.
LibraryManager & operator=(const LibraryManager &)
LibraryManager(const LibraryManager &)
void remove(const std::string &name)
It removes a LibraryEntry from the manager.
LibraryManager()
Singleton constructor must be private or protected.
void insert(const LibraryEntry &entry)
It inserts a LibraryEntry to the manager.
bool isInitialized(const std::string &name)
The current state of the LibraryEntry.
boost::function0< void > CleanupFnct
boost::function0< void > StartupFnct
CleanupFnct m_cleanupFptr