Loading...
Searching...
No Matches
Module.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/common/Module.h
22
23 \brief This singleton defines an entry in the Platform for the TerraLib Common Runtime module.
24*/
25
26#ifndef __TERRALIB_COMMON_INTERNAL_MODULE_H
27#define __TERRALIB_COMMON_INTERNAL_MODULE_H
28
29// TerraLib
30#include "Singleton.h"
31#include "TerraLib.h"
32
33//STL
34#include <memory>
35
36namespace te
37{
38 namespace common
39 {
40 /*!
41 \class Module
42
43 \brief This singleton defines an entry in the Platform for the TerraLib Common Runtime module.
44
45 This class is responsible for:
46 <ul>
47 <li>registering the initialization and cleanup routines for the Common Runtime module if it is required.</li>
48 <li>start the logger configuration if TerraLib is configured to have it initialized automatically.</li>
49 <li>registering the Common Runtime multilingual support.</li>
50 </ul>
51
52 \ingroup common
53 */
54 class Module : public te::common::Singleton<Module>
55 {
56 friend class te::common::Singleton<Module>;
57
58 protected:
59
60 /*!
61 \brief The singleton constructor will make some initializations.
62
63 The initialization includes:
64 <ul>
65 <li>registering the Common Runtime module in the list of initializable modules.</li>
66 <li>registering the Common Runtime multilingual support.</li>
67 <li>Singletons initialization</li>
68 <li>Logger initialization when automatic static initialization is enabled.</li>
69 </ul>
70 */
72
73 /*
74 \brief The singleton destructor will make some cleanup.
75
76 The cleanup includes:
77 <ul>
78 <li>Logger finalization when automatic static initialization is enabled.</li>
79 <li>un-registering the module from the TerraLib Platform singleton.</li>
80 </ul>
81 */
83
84 private:
85
86 /*!
87 \brief This is the startup function for the TerraLib Common Runtime module.
88
89 \note This method doesn't perform operations for this module.
90 */
91 static void initialize();
92
93 /*!
94 \brief This is the cleanup function for the TerraLib Common Runtime module.
95
96 \note This method doesn't perform operations for this module.
97 */
98 static void finalize();
99
100 private:
101
102 static const Module& sm_module; //!< let's force C++ to make an static initialization.
103 std::shared_ptr<TerraLib::Module> m_module;
104 };
105
106 } // end namespace common
107} // end namespace te
108
109#endif // __TERRALIB_COMMON_INTERNAL_MODULE_H
110
Template support for singleton pattern.
This singleton defines an entry in the Platform for the TerraLib Common Runtime module.
Definition: Module.h:55
std::shared_ptr< TerraLib::Module > m_module
Definition: Module.h:103
Module()
The singleton constructor will make some initializations.
static void initialize()
This is the startup function for the TerraLib Common Runtime module.
static const Module & sm_module
let's force C++ to make an static initialization.
Definition: Module.h:102
static void finalize()
This is the cleanup function for the TerraLib Common Runtime module.
Template support for singleton pattern.
Definition: Singleton.h:101
TerraLib.