An utility class to control the startup and cleanup of the TerraLib Platform and its resources. More...
#include <TerraLib.h>
Classes | |
| struct | Module |
| This internal structure is used to model the basic information about a TerraLib module. More... | |
Public Types | |
| typedef void(* | CleanupFptr) (void) |
| This is the type for call back functions that makes the cleanup of a module. More... | |
| typedef void(* | StartupFptr) (void) |
| This is the type for call back functions that makes the startup of a module. More... | |
Public Member Functions | |
| void | add (const Module &m) |
| It registers the module in the TerraLib Platform. More... | |
| void | finalize () |
| It finalizes the TerraLib Platform. More... | |
| void | finalize (const std::size_t i) |
| It finalizes the i-th registered module in the TerraLib Platform. More... | |
| void | finalize (const std::string &moduleName) |
| It finalizes the registered module in the TerraLib Platform. More... | |
| std::size_t | getModuleIdx (const std::string &moduleName) const |
| It returns the module index inside the internal data structure. More... | |
| const std::string & | getModuleName (std::size_t i) const |
| It return the i-th module name. More... | |
| std::size_t | getNumRegModules () const |
| It returns the number of registered modules. More... | |
| void | initialize () |
| It initializes the TerraLib Platform. More... | |
| void | initialize (const std::size_t i) |
| It initializes the i-th registered module in the TerraLib Platform. More... | |
| void | initialize (const std::string &moduleName) |
| It initializes the registered module in the TerraLib Platform. More... | |
| void | remove (const std::string &moduleName) |
| It removes the module entry identified by the given name. More... | |
| void | remove (const std::size_t i) |
| It removes the i-th module entry. More... | |
Static Public Member Functions | |
| static TerraLib & | getInstance () |
| It returns a reference to the singleton instance. More... | |
Protected Member Functions | |
| TerraLib () | |
| The singleton constructor is not callable outside the class. More... | |
| ~TerraLib () | |
Private Attributes | |
| std::vector< bool > | m_initialized |
| The list of modules to be initialized when initialize is called. More... | |
| std::vector< Module > | m_modules |
| This static function is invoked automatically when the application finishes its execution. More... | |
Friends | |
| class | te::common::Singleton< TerraLib > |
An utility class to control the startup and cleanup of the TerraLib Platform and its resources.
This singleton will control the initialization and the cleanup of TerraLib modules and their resources. If you are creating a C++ application you may need to make an explicit initialization of the TerraLib Platform as showned in the code below:
Notice the calling to the finalize function at the end of the example program, it is necessary in order to close/release any pending resource initialized by the modules.
Definition at line 70 of file common/TerraLib.h.
| void(* TerraLib::CleanupFptr)(void) |
This is the type for call back functions that makes the cleanup of a module.
Definition at line 88 of file common/TerraLib.h.
| void(* TerraLib::StartupFptr)(void) |
This is the type for call back functions that makes the startup of a module.
Definition at line 81 of file common/TerraLib.h.
|
protected |
The singleton constructor is not callable outside the class.
Definition at line 157 of file common/TerraLib.cpp.
References ~TerraLib().
|
protecteddefault |
Referenced by TerraLib().
| void TerraLib::add | ( | const Module & | m | ) |
It registers the module in the TerraLib Platform.
Each registered module will be initialized when TerraLib Platform is explicitly started and then finalized when the application finalizes.
| m | A TerraLib module. |
Definition at line 100 of file common/TerraLib.cpp.
References m_initialized, and m_modules.
Referenced by te::at::Module::Module(), te::addressgeocoding::Module::Module(), te::dt::Module::Module(), te::edit::Module::Module(), te::color::Module::Module(), te::fe::Module::Module(), te::gm::Module::Module(), te::da::Module::Module(), te::map::Module::Module(), te::mem::Module::Module(), te::stmem::Module::Module(), te::st::Module::Module(), te::graph::Module::Module(), te::v8::jsi::Module::Module(), te::qt::widgets::Module::Module(), te::v8::common::Module::Module(), te::xml::Module::Module(), te::srs::Module::Module(), te::rp::Module::Module(), and te::common::Module::Module().
| void TerraLib::finalize | ( | ) |
It finalizes the TerraLib Platform.
| Exception | It may throws an exception. |
Definition at line 67 of file common/TerraLib.cpp.
References te::core::plugin::FinalizePluginSystem(), and m_modules.
Referenced by Finalize(), finalize(), te::qt::af::ApplicationController::finalize(), IDL_ExitHandler(), main(), and TEST().
| void TerraLib::finalize | ( | const std::size_t | i | ) |
It finalizes the i-th registered module in the TerraLib Platform.
| Exception | It may throws an exception. |
Definition at line 78 of file common/TerraLib.cpp.
References TerraLib::Module::m_cleanupFptr, m_initialized, and m_modules.
| void TerraLib::finalize | ( | const std::string & | moduleName | ) |
It finalizes the registered module in the TerraLib Platform.
| Exception | It may throws an exception. |
Definition at line 94 of file common/TerraLib.cpp.
References finalize(), and getModuleIdx().
|
staticinherited |
It returns a reference to the singleton instance.
Referenced by Finalize(), te::qt::af::ApplicationController::finalize(), IDL_ExitHandler(), IDL_Load(), Initialize(), te::qt::af::ApplicationController::initialize(), te::plugin::PluginManager::load(), main(), te::map::Module::Module(), te::color::Module::Module(), te::mem::Module::Module(), te::at::Module::Module(), te::da::Module::Module(), te::addressgeocoding::Module::Module(), te::dt::Module::Module(), te::edit::Module::Module(), te::fe::Module::Module(), te::gm::Module::Module(), te::graph::Module::Module(), te::st::Module::Module(), te::stmem::Module::Module(), te::v8::jsi::Module::Module(), te::qt::widgets::Module::Module(), te::v8::common::Module::Module(), te::xml::Module::Module(), te::srs::Module::Module(), te::rp::Module::Module(), te::common::Module::Module(), te::qt::af::InternalSettingsDialog::setModules(), TEST(), te::map::Module::~Module(), te::gm::Module::~Module(), te::da::Module::~Module(), te::color::Module::~Module(), te::mem::Module::~Module(), te::edit::Module::~Module(), te::dt::Module::~Module(), te::at::Module::~Module(), te::addressgeocoding::Module::~Module(), te::fe::Module::~Module(), te::stmem::Module::~Module(), te::graph::Module::~Module(), te::st::Module::~Module(), te::qt::widgets::Module::~Module(), te::v8::common::Module::~Module(), te::v8::jsi::Module::~Module(), te::xml::Module::~Module(), te::srs::Module::~Module(), te::rp::Module::~Module(), and te::common::Module::~Module().
| std::size_t TerraLib::getModuleIdx | ( | const std::string & | moduleName | ) | const |
It returns the module index inside the internal data structure.
| moduleName | The name of a valid module registered in this singleton. |
Definition at line 138 of file common/TerraLib.cpp.
References m_modules.
Referenced by finalize(), and initialize().
| const std::string & TerraLib::getModuleName | ( | std::size_t | i | ) | const |
It return the i-th module name.
| i | The module you are looking for its name. |
Definition at line 151 of file common/TerraLib.cpp.
References m_modules.
Referenced by te::qt::af::InternalSettingsDialog::setModules().
| std::size_t TerraLib::getNumRegModules | ( | ) | const |
It returns the number of registered modules.
Definition at line 133 of file common/TerraLib.cpp.
References m_modules.
Referenced by te::plugin::PluginManager::load(), and te::qt::af::InternalSettingsDialog::setModules().
| void TerraLib::initialize | ( | ) |
It initializes the TerraLib Platform.
This method will perform the startup of all registered modules. If there isn't modules to be initialized this method has no effect.
| Exception | It may throws an exception. |
Definition at line 34 of file common/TerraLib.cpp.
References te::core::plugin::InitializePluginSystem(), and m_modules.
Referenced by IDL_Load(), Initialize(), initialize(), te::qt::af::ApplicationController::initialize(), te::plugin::PluginManager::load(), main(), and TEST().
| void TerraLib::initialize | ( | const std::size_t | i | ) |
It initializes the i-th registered module in the TerraLib Platform.
| Exception | It may throws an exception. |
Definition at line 45 of file common/TerraLib.cpp.
References m_initialized, m_modules, and TerraLib::Module::m_startFptr.
| void TerraLib::initialize | ( | const std::string & | moduleName | ) |
It initializes the registered module in the TerraLib Platform.
| Exception | It may throws an exception. |
Definition at line 61 of file common/TerraLib.cpp.
References getModuleIdx(), and initialize().
| void TerraLib::remove | ( | const std::string & | moduleName | ) |
It removes the module entry identified by the given name.
| moduleName | The TerraLib module to be removed from the platform control. |
Definition at line 106 of file common/TerraLib.cpp.
References m_initialized, m_modules, and TerraLib::Module::m_name.
Referenced by te::at::Module::~Module(), te::addressgeocoding::Module::~Module(), te::dt::Module::~Module(), te::edit::Module::~Module(), te::color::Module::~Module(), te::fe::Module::~Module(), te::gm::Module::~Module(), te::da::Module::~Module(), te::map::Module::~Module(), te::mem::Module::~Module(), te::stmem::Module::~Module(), te::st::Module::~Module(), te::graph::Module::~Module(), te::v8::jsi::Module::~Module(), te::qt::widgets::Module::~Module(), te::v8::common::Module::~Module(), te::xml::Module::~Module(), te::srs::Module::~Module(), te::rp::Module::~Module(), and te::common::Module::~Module().
| void TerraLib::remove | ( | const std::size_t | i | ) |
It removes the i-th module entry.
| i | The i-th TerraLib module to be removed from the platform control. |
Definition at line 125 of file common/TerraLib.cpp.
References m_initialized, and m_modules.
|
friend |
Definition at line 72 of file common/TerraLib.h.
|
private |
The list of modules to be initialized when initialize is called.
Definition at line 265 of file common/TerraLib.h.
Referenced by add(), finalize(), initialize(), and remove().
|
private |
This static function is invoked automatically when the application finishes its execution.
| Exception | It may throws an exception. |
Definition at line 264 of file common/TerraLib.h.
Referenced by add(), finalize(), getModuleIdx(), getModuleName(), getNumRegModules(), initialize(), and remove().