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 
32 namespace te
33 {
34  namespace common
35  {
36  /*!
37  \class Module
38 
39  \brief This singleton defines an entry in the Platform for the TerraLib Common Runtime module.
40 
41  This class is responsible for:
42  <ul>
43  <li>registering the initialization and cleanup routines for the Common Runtime module if it is required.</li>
44  <li>start the logger configuration if TerraLib is configured to have it initialized automatically.</li>
45  <li>registering the Common Runtime multilingual support.</li>
46  </ul>
47 
48  \ingroup common
49  */
50  class Module : public te::common::Singleton<Module>
51  {
53 
54  protected:
55 
56  /*!
57  \brief The singleton constructor will make some initializations.
58 
59  The initialization includes:
60  <ul>
61  <li>registering the Common Runtime module in the list of initializable modules.</li>
62  <li>registering the Common Runtime multilingual support.</li>
63  <li>Singletons initialization</li>
64  <li>Logger initialization when automatic static initialization is enabled.</li>
65  </ul>
66  */
67  Module();
68 
69  /*
70  \brief The singleton destructor will make some cleanup.
71 
72  The cleanup includes:
73  <ul>
74  <li>Logger finalization when automatic static initialization is enabled.</li>
75  <li>un-registering the module from the TerraLib Platform singleton.</li>
76  </ul>
77  */
78  ~Module();
79 
80  private:
81 
82  /*!
83  \brief This is the startup function for the TerraLib Common Runtime module.
84 
85  \note This method doesn't perform operations for this module.
86  */
87  static void initialize();
88 
89  /*!
90  \brief This is the cleanup function for the TerraLib Common Runtime module.
91 
92  \note This method doesn't perform operations for this module.
93  */
94  static void finalize();
95 
96  private:
97 
98  static const Module& sm_module; //!< let's force C++ to make an static initialization.
99  };
100 
101  } // end namespace common
102 } // end namespace te
103 
104 #endif // __TERRALIB_COMMON_INTERNAL_MODULE_H
105 
Module()
The singleton constructor will make some initializations.
This singleton defines an entry in the Platform for the TerraLib Common Runtime module.
Definition: Module.h:50
static void initialize()
This is the startup function for the TerraLib Common Runtime module.
Template support for singleton pattern.
URI C++ Library.
static void finalize()
This is the cleanup function for the TerraLib Common Runtime module.
static const Module & sm_module
let's force C++ to make an static initialization.
Definition: Module.h:98
Template support for singleton pattern.
Definition: Singleton.h:100