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 class GDALDataset;
39 
40 namespace te
41 {
42  namespace ogr
43  {
44  /*!
45  \class DataSource
46 
47  \brief The OGR data source provider.
48  */
50  {
51  public:
52 
53  DataSource(const std::string& connInfo);
54 
55  DataSource(const te::core::URI& uri);
56 
57  /*! \brief Virtual destructor. */
58  ~DataSource();
59 
60  std::string getType() const;
61 
62  std::auto_ptr<te::da::DataSourceTransactor> getTransactor();
63 
64  void open();
65 
66  void close();
67 
68  bool isOpened() const;
69 
70  bool isValid() const;
71 
72  const te::da::DataSourceCapabilities& getCapabilities() const;
73 
74  const te::da::SQLDialect* getDialect() const;
75 
76  void createDataSet(te::da::DataSetType* dt, const std::map<std::string, std::string>& options);
77 
78  static void setDialect(te::da::SQLDialect* dialect);
79 
80  GDALDataset* getOGRDataSource();
81 
82  void createOGRDataSource();
83 
84  te::core::EncodingType getEncoding();
85 
86  void setEncoding(const te::core::EncodingType& et);
87 
88 
89  protected:
90 
91  void create(const std::string& connInfo);
92 
93  void drop(const std::string& connInfo);
94 
95  bool exists(const std::string& connInfo);
96 
97  std::vector<std::string> getDataSourceNames(const std::string& connInfo);
98 
99  protected:
100 
101  GDALDataset* m_ogrDS; //!< A pointer to OGR Data Source.
102  bool m_isValid; //!< True if this is a valid datasource.
104  bool m_isInTransaction; //!< Tells if there is a transaction in progress.
105  static te::da::SQLDialect* sm_myDialect; //!< OGR SQL dialect.
106  te::core::EncodingType m_encoding; //!< The data source encoding type.
107  };
108 
110  } // end namespace da
111 } // end namespace te
112 
113 #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:79
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:55
te::da::DataSource * Build(const te::core::URI &uri)
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:104
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:119
te::da::DataSourceCapabilities m_capabilities
OGR capabilities.
Definition: DataSource.h:103
EncodingType
Supported character encodings.
Definition: CharEncoding.h:50
te::core::EncodingType m_encoding
The data source encoding type.
Definition: DataSource.h:106
URI C++ Library.
The OGR data source provider.
Definition: DataSource.h:49
Configuration flags for the OGR Driver Implementation of TerraLib.
A class for representing an Uniform Resource Identifier (URI).
Definition: URI.h:49
GDALDataset * m_ogrDS
A pointer to OGR Data Source.
Definition: DataSource.h:101
static te::da::SQLDialect * sm_myDialect
OGR SQL dialect.
Definition: DataSource.h:105
bool m_isValid
True if this is a valid datasource.
Definition: DataSource.h:102