All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 // registers all format drivers built into OGR.
61  OGRRegisterAll();
62 
63 // it initializes the OGR Factory support
65 
66  #include "OGRDialect.h"
67 
68  TE_LOG_TRACE(TE_TR("TerraLib OGR driver startup!"));
69 
70  m_initialized = true;
71 }
72 
74 {
75  if(!m_initialized)
76  return;
77 
78 // it finalizes the OGR factory support.
80 
81 // free OGR registered drivers
83 
84  OGRCleanupAll();
85 
87 
88  TE_LOG_TRACE(TE_TR("TerraLib OGR driver shutdown!"));
89 
90  m_initialized = false;
91 }
92 
94 
#define TE_LOG_TRACE(msg)
Use this tag in order to log a message to a specified logger with the TRACE level.
Definition: Logger.h:136
A class for data providers of OGR.
~Module()
Destructor.
Definition: Module.cpp:51
#define OGR_DRIVER_IDENTIFIER
The OGR driver identifier string.
Definition: Config.h:36
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:345
#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
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
The TerraLib OGR driver is a plugin.
Definition: Module.h:42
The TerraLib OGR driver is a plugin.
Module(const te::plugin::PluginInfo &pluginInfo)
Plugin constructor.
Definition: Module.cpp:46
DataSource * Build()
Definition: DataSource.cpp:309
static void add(const std::string &dsType, FactoryFnctType f)
The basic information about a plugin.
Definition: PluginInfo.h:61
static void remove(const std::string &dsType)
An static class with global definitions.
void startup()
It initializes all TerraLib OGR driver support.
Definition: Module.cpp:55
static void setDialect(te::da::SQLDialect *dialect)
Definition: DataSource.cpp:192
void shutdown()
It finalizes all TerraLib OGR driver support.
Definition: Module.cpp:73