26#ifndef __TERRALIB_MEMORY_INTERNAL_DATASOURCE_H
27#define __TERRALIB_MEMORY_INTERNAL_DATASOURCE_H
35#include <boost/thread.hpp>
67 const std::map<std::string, te::da::DataSetPtr>&
getDataSets()
const;
74 const std::map<std::string, te::da::DataSetTypePtr>
getSchemas()
const;
92 std::unique_ptr<te::da::DataSet>
getDataSet(
const std::string& name,
100 std::unique_ptr<te::da::DataSetType>
getDataSetType(
const std::string& datasetName);
102 boost::ptr_vector<te::dt::Property>
getProperties(
const std::string& datasetName);
104 std::unique_ptr<te::dt::Property>
getProperty(
const std::string& datasetName,
const std::string& name);
106 std::unique_ptr<te::dt::Property>
getProperty(
const std::string& datasetName, std::size_t propertyPos);
116 void dropProperty(
const std::string& datasetName,
const std::string& propertyName);
118 void renameProperty(
const std::string& datasetName,
const std::string& name,
const std::string& newName);
128 void cloneDataSet(
const std::string& name,
const std::string& cloneName,
129 const std::map<std::string, std::string>& options);
136 const std::map<std::string, std::string>& options, std::size_t limit);
140 void update(
const std::string& datasetName,
142 const std::vector<std::size_t>& properties,
144 const std::map<std::string, std::string>& options,
145 std::size_t limit = 0);
160 void create(
const std::string& connInfo);
162 void drop(
const std::string& connInfo);
164 bool exists(
const std::string& connInfo);
171 std::map<std::string, te::da::DataSetTypePtr>
m_schemas;
172 mutable boost::recursive_mutex
m_mtx;
te::da::DataSourceCapabilities capabilities
A class to store the proxy information that must be used to access data located in URIs.
A class that models the description of a dataset.
A dataset is the unit of information manipulated by the data access module of TerraLib.
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.
This class represents a set of unique ids created in the same context. i.e. from the same data set.
It represents the SQL query dialect accepted by a given data source.
It models a property definition.
std::map< std::string, te::da::DataSetTypePtr > m_schemas
The set of dataset schemas.
void open()
It opens the data source and makes it ready for using.
void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids)
It removes all the informed items from the dataset.
void drop(const std::string &connInfo)
It removes the data source with the connection information from a driver.
std::unique_ptr< te::da::DataSourceTransactor > getTransactor()
It returns the set of parameters used to set up the access channel to the underlying repository.
std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset.
static const te::da::SQLDialect sm_dialect
A dummy dialect.
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
void update(const std::string &datasetName, te::da::DataSet *dataset, const std::vector< std::size_t > &properties, const te::da::ObjectIdSet *oids, const std::map< std::string, std::string > &options, std::size_t limit=0)
It updates the contents of a dataset for the set of data items.
void close()
It closes the data source and clears all the resources used by its internal communication channel.
void renameProperty(const std::string &datasetName, const std::string &name, const std::string &newName)
It renames a property of the given dataset.
bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset.
const std::map< std::string, te::da::DataSetPtr > & getDataSets() const
It returns a map relating the dataset names and their contents.
DataSource(const std::string &connInfo)
bool m_deepCopy
If true, each dataset is cloned in the getDataSet method.
std::unique_ptr< te::da::DataSetType > getDataSetType(const std::string &datasetName)
It gets information about the given dataset.
std::size_t m_numDatasets
The number of datasets kept in the data source.
void cloneDataSet(const std::string &name, const std::string &cloneName, const std::map< std::string, std::string > &options)
It clones the dataset in the data source.
~DataSource()
Virtual destructor.
std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source.
std::map< std::string, te::da::DataSetPtr > m_datasets
The set of datasets stored in memory.
bool exists(const std::string &connInfo)
Check the existence of a data source in a driver.
std::unique_ptr< te::dt::Property > getProperty(const std::string &datasetName, std::size_t propertyPos)
It retrieves the property lying in the given position from the dataset.
std::size_t m_maxNumDatasets
The maximum number of datasets to be handled by the data source.
std::vector< std::string > getDataSetNames()
It gets the dataset names available in the data source.
bool hasDataSets()
It checks if the data source has any dataset.
std::vector< std::string > getDataSourceNames(const std::string &connInfo)
It gets the data source names available in a driver.
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
static te::da::DataSourceCapabilities sm_capabilities
The Memory data source capabilities.
std::unique_ptr< te::da::DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. This method always returns a disconnected dataset,...
bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source.
boost::recursive_mutex m_mtx
The internal mutex.
std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset.
void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema.
std::unique_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)
It retrieves the property with the given name from the dataset.
void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset.
bool m_isOpened
A flag to control the state of the data source.
void create(const std::string &connInfo)
It creates a new data source.
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
bool isValid() const
It checks if the data source is valid (available for using).
void dropProperty(const std::string &datasetName, const std::string &propertyName)
It removes a property from the given dataset.
static void setCapabilities(const te::da::DataSourceCapabilities &capabilities)
It sets the capabilities document.
boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset.
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS,...
DataSource(const te::core::URI &uri)
std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
void add(const std::string &datasetName, te::da::DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit)
It adds data items to the dataset in the data source.
void dropDataSet(const std::string &name)
It removes the dataset schema from the data source.
const std::map< std::string, te::da::DataSetTypePtr > getSchemas() const
It returns a map relating the dataset names and their schemas.
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.
A dataset is the unit of information manipulated by the data access module of TerraLib.
An abstract class for data providers like a DBMS, Web Services or a regular file.
TraverseType
A dataset can be traversed in two ways:
AccessPolicy
Supported data access policies (can be used as bitfield).
Namespace for the DataAccess API of TerraLib.
Namespace for the Data Type module of TerraLib.
Namespace for the memory data source of TerraLib.
Configuration flags for the TerraLib In-memory Data Access driver.
#define TEMEMORYEXPORT
You can use this macro in order to export/import classes and functions from this module.