All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Module.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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/ogr/Module.h
22 
23  \brief The TerraLib OGR driver is a plugin.
24 */
25 
26 // TerraLib
27 #include "../common/Logger.h"
28 #include "../common/Translator.h"
29 #include "../dataaccess/datasource/DataSourceManager.h"
30 #include "../dataaccess/datasource/DataSourceFactory.h"
31 
32 #include "../dataaccess/query/BinaryOpEncoder.h"
33 #include "../dataaccess/query/FunctionEncoder.h"
34 #include "../dataaccess/query/SQLDialect.h"
35 #include "../dataaccess/query/SQLFunctionEncoder.h"
36 #include "../dataaccess/query/TemplateEncoder.h"
37 #include "../dataaccess/query/UnaryOpEncoder.h"
38 
39 #include "DataSource.h"
40 #include "Globals.h"
41 #include "Module.h"
42 
43 // OGR
44 #include <ogr_api.h>
45 
47  : te::plugin::Plugin(pluginInfo)
48 {
49 }
50 
52 {
53 }
54 
56 {
57  if(m_initialized)
58  return;
59 
60 // it initializes the Translator support for the TerraLib OGR driver support
62 
63 // registers all format drivers built into OGR.
64  OGRRegisterAll();
65 
66 // it initializes the OGR Factory support
68 
69  #include "OGRDialect.h"
70 
71  TE_LOG_TRACE(TR_OGR("TerraLib OGR driver startup!"));
72 
73  m_initialized = true;
74 }
75 
77 {
78  if(!m_initialized)
79  return;
80 
81 // it finalizes the OGR factory support.
83 
84 // free OGR registered drivers
86 
87  OGRCleanupAll();
88 
90 
91  TE_LOG_TRACE(TR_OGR("TerraLib OGR driver shutdown!"));
92 
93  m_initialized = false;
94 }
95 
97 
The basic information about a plugin.
Definition: PluginInfo.h:61
#define OGR_DRIVER_IDENTIFIER
The OGR driver identifier string.
Definition: Config.h:36
A class for data providers of OGR.
The TerraLib OGR driver is a plugin.
The TerraLib OGR driver is a plugin.
Definition: Module.h:42
#define TE_LOG_TRACE(msg)
Use this tag in order to log a message to a specified logger with the TRACE level.
Definition: Config.h:418
static void setDialect(te::da::SQLDialect *dialect)
Definition: DataSource.cpp:192
An static class with global definitions.
Module(const te::plugin::PluginInfo &pluginInfo)
Plugin constructor.
Definition: Module.cpp:46
#define PLUGIN_CALL_BACK_IMPL(PLUGIN_CLASS_NAME)
This macro should be used by C++ plugins in order to declare the exportable/callable DLL function...
Definition: Config.h:57
#define TR_OGR(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
Definition: Config.h:62
#define TE_OGR_TEXT_DOMAIN
It contains the name of the text domain used in the translation of messages in TerraLib OGR driver im...
Definition: Config.h:48
void startup()
It initializes all TerraLib OGR driver support.
Definition: Module.cpp:55
#define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset)
It adds the given text domain located at domain-dir with the given codeset to the multilingual system...
Definition: Config.h:118
static void remove(const std::string &dsType)
void shutdown()
It finalizes all TerraLib OGR driver support.
Definition: Module.cpp:76
#define TE_OGR_TEXT_DOMAIN_DIR
It contains the translation catalog directory.
Definition: Config.h:55
DataSource * Build()
Definition: DataSource.cpp:311
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
~Module()
Destructor.
Definition: Module.cpp:51
static void add(const std::string &dsType, FactoryFnctType f)