Loading...
Searching...
No Matches
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;
38class GDALDataset;
39
40namespace 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
56
57 /*! \brief Virtual destructor. */
59
60 std::string getType() const;
61
62 std::unique_ptr<te::da::DataSourceTransactor> getTransactor();
63
64 void open();
65
66 void close();
67
68 bool isOpened() const;
69
70 bool isValid() const;
71
73
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
83
85
87
88 void begin();
89
90 void commit();
91
92 void rollBack();
93
94 bool isInTransaction() const;
95
97
98 protected:
99
100 void create(const std::string& connInfo);
101
102 void drop(const std::string& connInfo);
103
104 bool exists(const std::string& connInfo);
105
106 std::vector<std::string> getDataSourceNames(const std::string& connInfo);
107
108 protected:
109
110 GDALDataset* m_ogrDS; //!< A pointer to OGR Data Source.
111 bool m_isValid; //!< True if this is a valid datasource.
113 static te::da::SQLDialect* sm_myDialect; //!< OGR SQL dialect.
114 te::core::EncodingType m_encoding; //!< The data source encoding type.
115 std::size_t m_transactionCount; //!< A counter to handle nested transactions
116 };
117
119 } // end namespace da
120} // end namespace te
121
122#endif // __TERRALIB_OGR_INTERNAL_DATASOURCE_H
A class to store the proxy information that must be used to access data located in URIs.
Definition: URI.h:50
A class that models the description of a dataset.
Definition: DataSetType.h:73
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:120
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:56
The OGR data source provider.
Definition: DataSource.h:50
std::size_t m_transactionCount
A counter to handle nested transactions.
Definition: DataSource.h:115
GDALDataset * getOGRDataSource()
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS,...
bool isValid() const
It checks if the data source is valid (available for using).
void createDataSet(te::da::DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
std::vector< std::string > getDataSourceNames(const std::string &connInfo)
It gets the data source names available in a driver.
void create(const std::string &connInfo)
It creates a new data source.
void close()
It closes the data source and clears all the resources used by its internal communication channel.
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
static void setDialect(te::da::SQLDialect *dialect)
te::core::EncodingType getEncoding()
It return the DataSource current encoding.
~DataSource()
Virtual destructor.
GDALDataset * m_ogrDS
A pointer to OGR Data Source.
Definition: DataSource.h:110
bool m_isValid
True if this is a valid datasource.
Definition: DataSource.h:111
static te::da::SQLDialect * sm_myDialect
OGR SQL dialect.
Definition: DataSource.h:113
te::core::EncodingType m_encoding
The data source encoding type.
Definition: DataSource.h:114
bool isInTransaction() const
void open()
It opens the data source and makes it ready for using.
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
void drop(const std::string &connInfo)
It removes the data source with the connection information from a driver.
DataSource(const te::core::URI &uri)
te::da::DataSourceCapabilities m_capabilities
OGR capabilities.
Definition: DataSource.h:112
bool exists(const std::string &connInfo)
Check the existence of a data source in a driver.
void setEncoding(const te::core::EncodingType &et)
It sets the encodings for the data source.
std::unique_ptr< te::da::DataSourceTransactor > getTransactor()
It returns the set of parameters used to set up the access channel to the underlying repository.
DataSource(const std::string &connInfo)
EncodingType
Supported character encodings.
Definition: CharEncoding.h:51
te::da::DataSource * Build(const te::core::URI &uri)
TerraLib.
#define TEOGREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:79
Proxy configuration file for TerraView (see terraview_config.h).
An exception class for the XML module.