All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataSource.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/ogr/DataSource.h
22 
23  \brief A class for data providers of OGR.
24 */
25 
26 #ifndef __TERRALIB_OGR_INTERNAL_DATASOURCE_H
27 #define __TERRALIB_OGR_INTERNAL_DATASOURCE_H
28 
29 // TerraLib
30 #include "Config.h"
31 #include "../dataaccess/datasource/DataSource.h"
32 #include "../dataaccess/datasource/DataSourceCapabilities.h"
33 #include "../dataaccess/dataset/DataSetType.h"
34 #include "Exception.h"
35 
36 // Forward declarations
37 class OGRDataSource;
38 
39 namespace te
40 {
41  namespace ogr
42  {
43  /*!
44  \class DataSource
45 
46  \brief The OGR data source provider.
47  */
49  {
50  public:
51 
52  /*! \brief Default constructor that can be called by subclasses. */
53  DataSource();
54 
55  /*! \brief Virtual destructor. */
56  ~DataSource();
57 
58  std::string getType() const;
59 
60  const std::map<std::string, std::string>& getConnectionInfo() const;
61 
62  void setConnectionInfo(const std::map<std::string, std::string>& connInfo);
63 
64  std::auto_ptr<te::da::DataSourceTransactor> getTransactor();
65 
66  void open();
67 
68  void close();
69 
70  bool isOpened() const;
71 
72  bool isValid() const;
73 
74  const te::da::DataSourceCapabilities& getCapabilities() const;
75 
76  const te::da::SQLDialect* getDialect() const;
77 
78  void createDataSet(te::da::DataSetType* dt, const std::map<std::string, std::string>& options);
79 
80  static void setDialect(te::da::SQLDialect* dialect);
81 
82  OGRDataSource* getOGRDataSource();
83 
84  protected:
85 
86  void create(const std::map<std::string, std::string>& dsInfo);
87 
88  void drop(const std::map<std::string, std::string>& dsInfo);
89 
90  bool exists(const std::map<std::string, std::string>& dsInfo);
91 
92  std::vector<std::string> getDataSourceNames(const std::map<std::string, std::string>& dsInfo);
93 
94  std::vector<te::common::CharEncoding> getEncodings(const std::map<std::string, std::string>& dsInfo);
95 
96  protected:
97 
98  std::map<std::string, std::string> m_connectionInfo; //!< Connection information.
99  OGRDataSource* m_ogrDS; //!< A pointer to OGR Data Source.
100  bool m_isValid; //!< True if this is a valid datasource.
102  bool m_isInTransaction; //!< Tells if there is a transaction in progress.
103 
104  static te::da::SQLDialect* sm_myDialect; //!< OGR SQL dialect.
105  };
106 
107  DataSource* Build();
108  } // end namespace da
109 } // end namespace te
110 
111 #endif // __TERRALIB_OGR_INTERNAL_DATASOURCE_H
An exception class for the OGR module.
te::da::SQLDialect * dialect
Definition: WFSDialect.h:1
A class that models the description of a dataset.
Definition: DataSetType.h:72
#define TEOGREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:81
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:55
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
bool m_isInTransaction
Tells if there is a transaction in progress.
Definition: DataSource.h:102
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
te::da::DataSourceCapabilities m_capabilities
OGR capabilities.
Definition: DataSource.h:101
static te::da::SQLDialect * sm_myDialect
OGR SQL dialect.
Definition: DataSource.h:104
std::map< std::string, std::string > m_connectionInfo
Connection information.
Definition: DataSource.h:98
The OGR data source provider.
Definition: DataSource.h:48
Configuration flags for the OGR Driver Implementation of TerraLib.
DataSource * Build()
Definition: DataSource.cpp:309
OGRDataSource * m_ogrDS
A pointer to OGR Data Source.
Definition: DataSource.h:99
bool m_isValid
True if this is a valid datasource.
Definition: DataSource.h:100