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_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;
38class GDALDataset;
39
40namespace 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. */
55
56 /*! \brief Virtual destructor. */
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
76
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::core::EncodingType> 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
111 } // end namespace da
112} // end namespace te
113
114#endif // __TERRALIB_GPKG_INTERNAL_DATASOURCE_H
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
static void setDialect(te::da::SQLDialect *dialect)
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::map< std::string, std::string > m_connectionInfo
Connection information.
Definition: DataSource.h:100
DataSource()
Default constructor that can be called by subclasses.
void create(const std::map< std::string, std::string > &dsInfo)
void open()
It opens the data source and makes it ready for using.
GDALDataset * m_ogrDS
A pointer to OGR Data Source.
Definition: DataSource.h:102
bool m_isValid
True if this is a valid datasource.
Definition: DataSource.h:103
std::auto_ptr< te::da::DataSourceTransactor > getTransactor()
It returns the set of parameters used to set up the access channel to the underlying repository.
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
const std::map< std::string, std::string > & getConnectionInfo() const
GDALDataset * getOGRDataSource()
void drop(const std::map< std::string, std::string > &dsInfo)
bool isValid() const
It checks if the data source is valid (available for using).
te::da::DataSourceCapabilities m_capabilities
OGR capabilities.
Definition: DataSource.h:104
bool exists(const std::map< std::string, std::string > &dsInfo)
void setConnectionInfo(const std::map< std::string, std::string > &connInfo)
~DataSource()
Virtual destructor.
static te::da::SQLDialect * sm_myDialect
OGR SQL dialect.
Definition: DataSource.h:107
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS,...
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
std::vector< te::core::EncodingType > getEncodings(const std::map< std::string, std::string > &dsInfo)
void close()
It closes the data source and clears all the resources used by its internal communication channel.
bool m_isInTransaction
Tells if there is a transaction in progress.
Definition: DataSource.h:105
std::vector< std::string > getDataSourceNames(const std::map< std::string, std::string > &dsInfo)
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
DataSource * Build()
TerraLib.
#define TERRAMOBILEPLUGINSDLLEXPORT
Definition: Config.h:89
An exception class for the XML module.