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_GPKG_INTERNAL_DATASOURCE_H
27 #define __TERRALIB_GPKG_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 class GDALDataset;
39 
40 namespace te
41 {
42  namespace gpkg
43  {
44  /*!
45  \class DataSource
46 
47  \brief The OGR data source provider.
48  */
50  {
51  public:
52 
53  /*! \brief Default constructor that can be called by subclasses. */
54  DataSource();
55 
56  /*! \brief Virtual destructor. */
57  ~DataSource();
58 
59  std::string getType() const;
60 
61  const std::map<std::string, std::string>& getConnectionInfo() const;
62 
63  void setConnectionInfo(const std::map<std::string, std::string>& connInfo);
64 
65  std::auto_ptr<te::da::DataSourceTransactor> getTransactor();
66 
67  void open();
68 
69  void close();
70 
71  bool isOpened() const;
72 
73  bool isValid() const;
74 
75  const te::da::DataSourceCapabilities& getCapabilities() const;
76 
77  const te::da::SQLDialect* getDialect() const;
78 
79  void createDataSet(te::da::DataSetType* dt, const std::map<std::string, std::string>& options);
80 
81  static void setDialect(te::da::SQLDialect* dialect);
82 
83  //OGRDataSource* getOGRDataSource();
84  GDALDataset* getOGRDataSource();
85 
86  protected:
87 
88  void create(const std::map<std::string, std::string>& dsInfo);
89 
90  void drop(const std::map<std::string, std::string>& dsInfo);
91 
92  bool exists(const std::map<std::string, std::string>& dsInfo);
93 
94  std::vector<std::string> getDataSourceNames(const std::map<std::string, std::string>& dsInfo);
95 
96  std::vector<te::common::CharEncoding> getEncodings(const std::map<std::string, std::string>& dsInfo);
97 
98  protected:
99 
100  std::map<std::string, std::string> m_connectionInfo; //!< Connection information.
101  //OGRDataSource* m_ogrDS; //!< A pointer to OGR Data Source.
102  GDALDataset* m_ogrDS; //!< A pointer to OGR Data Source.
103  bool m_isValid; //!< True if this is a valid datasource.
105  bool m_isInTransaction; //!< Tells if there is a transaction in progress.
106 
107  static te::da::SQLDialect* sm_myDialect; //!< OGR SQL dialect.
108  };
109 
110  DataSource* Build();
111  } // end namespace da
112 } // end namespace te
113 
114 #endif // __TERRALIB_GPKG_INTERNAL_DATASOURCE_H
te::da::SQLDialect * dialect
Definition: WFSDialect.h:1
bool m_isInTransaction
Tells if there is a transaction in progress.
Definition: DataSource.h:105
GDALDataset * m_ogrDS
A pointer to OGR Data Source.
Definition: DataSource.h:102
A class that models the description of a dataset.
Definition: DataSetType.h:72
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...
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
static te::da::SQLDialect * sm_myDialect
OGR SQL dialect.
Definition: DataSource.h:107
URI C++ Library.
std::map< std::string, std::string > m_connectionInfo
Connection information.
Definition: DataSource.h:100
te::da::DataSourceCapabilities m_capabilities
OGR capabilities.
Definition: DataSource.h:104
bool m_isValid
True if this is a valid datasource.
Definition: DataSource.h:103
#define TERRAMOBILEPLUGINSDLLEXPORT
Definition: Config.h:89
DataSource * Build()
The OGR data source provider.
Definition: DataSource.h:49