te::da::DataAccess Class Reference

Class used to centralize and control access to data in terralib. It aims to create a high-level interface for simplifying the concepts defined in the terralib DataAccess module. More...

#include <DataAccess.h>

Public Member Functions

void createDataSet (te::da::DataSetType *dataSetType)
 Function used to create a new DataSet into internal datasource. This class will NOT take the ownership of the dataSetType pointer. More...
 
 DataAccess (const te::core::URI &uri, const std::string &dataSourceDriver, const std::string &dataSetName="")
 constructor. More...
 
 DataAccess (te::da::DataSourcePtr dataSource, const std::string &dataSetName="")
 Constructor. More...
 
 DataAccess (te::da::DataSourcePtr dataSource, const te::da::DataSetType *dataSetType)
 constructor. More...
 
bool dataSetExists () const
 
te::da::DataSetTypeConvertergetConverter () const
 Get data set type. More...
 
std::unique_ptr< te::da::DataSetgetDataSet () const
 Get dataset using internal information (data source, query, datasetTypeConverter) More...
 
std::string getDataSetName () const
 Get data set name. More...
 
const te::da::DataSetTypegetDataSetType () const
 Get data set type. More...
 
te::da::DataSourcePtr getDataSource () const
 Get the data source associated with this data access. More...
 
std::string getDataSourceConnectionInfo ()
 Get data source connection info. More...
 
std::vector< std::string > getDistinctValues (const std::string &attributeName)
 Function used to get distinct values ir order, from a specific attribute. More...
 
te::da::LiteralgetLiteral (const std::string &attributeName, const std::string &value)
 It creates a Literal Expression based on a attribute type. More...
 
te::gm::Envelope getMBR () const
 Gets the MBR of the data access. More...
 
te::da::SelectgetQuery () const
 Get query object. More...
 
int getSRID () const
 Gets the SRID of the data access. More...
 
std::string getStrQuery () const
 Get query object as string. More...
 
std::unique_ptr< te::da::DataSetquery (const te::da::Select &select)
 Get dataset using internal information (data source, datasetTypeConverter), but using query parameter for data restriction. More...
 
std::unique_ptr< te::da::DataSetquery (const std::string &query)
 
void saveDataSet (te::da::DataSet *dataSet, bool enableProgress=true)
 Function used to save data into internal datasource (if a converter was defined, it will be used) More...
 
void setConverter (te::da::DataSetTypeConverter *converter)
 Set data set converter type. More...
 
void setObjectIdSetFilter (const te::da::ObjectIdSet *objectIdSetFilter)
 
void setQuery (te::da::Select *select)
 Set data set restriction. More...
 
 ~DataAccess ()
 Default destructor. More...
 

Protected Attributes

std::string m_dataSetName
 Dataset name. More...
 
std::unique_ptr< te::da::Selectm_dataSetQuery
 Filter used to load data with restriction. More...
 
std::unique_ptr< te::da::DataSetTypem_dataSetType
 Data set type. More...
 
std::unique_ptr< te::da::DataSetTypeConverterm_dataSetTypeConverter
 DataSetType Converter. More...
 
te::da::DataSourcePtr m_dataSource
 Data source. More...
 
std::unique_ptr< te::da::ObjectIdSetm_objectIdSetFilter
 A optional filter containg an objectId set. More...
 

Detailed Description

Class used to centralize and control access to data in terralib. It aims to create a high-level interface for simplifying the concepts defined in the terralib DataAccess module.

Definition at line 73 of file DataAccess.h.

Constructor & Destructor Documentation

◆ DataAccess() [1/3]

te::da::DataAccess::DataAccess ( const te::core::URI uri,
const std::string &  dataSourceDriver,
const std::string &  dataSetName = "" 
)

constructor.

Parameters
uriThe URI used to describe the datasource connection.
dataSourceDriverThe data source type name (example: POSTGIS, ORACLE, SQLITE).
dataSetNameThe dataset name (not needed to inform if DataAccess will be used to create a new Dataset)
Exceptions
ExceptionAn exception can be thrown, if the data source cannot be created or opened and dataset not found.
Note
A data source will be created without id information

◆ DataAccess() [2/3]

te::da::DataAccess::DataAccess ( te::da::DataSourcePtr  dataSource,
const std::string &  dataSetName = "" 
)

Constructor.

Parameters
dataSourceThe data source pointer.
dataSetNameThe dataset name (not needed to inform if DataAccess will be used to create a new Dataset)
Exceptions
ExceptionAn exception can be thrown, if the data source cannot be opened or dataset not found.
Note
This class will take the ownership of data source pointer

◆ DataAccess() [3/3]

te::da::DataAccess::DataAccess ( te::da::DataSourcePtr  dataSource,
const te::da::DataSetType dataSetType 
)

constructor.

Parameters
dataSourceThe data source pointer.
dataSetTypeThe dataset type
Exceptions
ExceptionAn exception can be thrown, if the data source cannot be opened or dataset not found.
Note
This class will take the ownership of data source pointer, but will clone the received dataSetType

◆ ~DataAccess()

te::da::DataAccess::~DataAccess ( )

Default destructor.

Check if the the dataSet exists

Member Function Documentation

◆ createDataSet()

void te::da::DataAccess::createDataSet ( te::da::DataSetType dataSetType)

Function used to create a new DataSet into internal datasource. This class will NOT take the ownership of the dataSetType pointer.

Parameters
dataSetPointer to a data set type to be created

◆ dataSetExists()

bool te::da::DataAccess::dataSetExists ( ) const

◆ getConverter()

te::da::DataSetTypeConverter* te::da::DataAccess::getConverter ( ) const

Get data set type.

Returns
Pointer to the datasettype
Note
The caller of this method will NOT take the ownership of the given pointer

◆ getDataSet()

std::unique_ptr<te::da::DataSet> te::da::DataAccess::getDataSet ( ) const

Get dataset using internal information (data source, query, datasetTypeConverter)

Returns
DataSet object

◆ getDataSetName()

std::string te::da::DataAccess::getDataSetName ( ) const

Get data set name.

Returns
String with the new data set name

◆ getDataSetType()

const te::da::DataSetType* te::da::DataAccess::getDataSetType ( ) const

Get data set type.

Returns
Pointer to the datasettype
Note
The caller of this method will NOT take the ownership of the given pointer

◆ getDataSource()

te::da::DataSourcePtr te::da::DataAccess::getDataSource ( ) const

Get the data source associated with this data access.

Returns
The data source associated with this data access

◆ getDataSourceConnectionInfo()

std::string te::da::DataAccess::getDataSourceConnectionInfo ( )

Get data source connection info.

Returns
String with data source connection info

◆ getDistinctValues()

std::vector<std::string> te::da::DataAccess::getDistinctValues ( const std::string &  attributeName)

Function used to get distinct values ir order, from a specific attribute.

Parameters
attributeNameString with attribute name
Returns
A vector with all distinct values from a attribute in order.

◆ getLiteral()

te::da::Literal* te::da::DataAccess::getLiteral ( const std::string &  attributeName,
const std::string &  value 
)

It creates a Literal Expression based on a attribute type.

Parameters
attributeNameAttribute name from data set
valueAttribute value used to create the right Literal expression
Returns
Valid pointer if the attribute type is supported and a null pointer in other case

◆ getMBR()

te::gm::Envelope te::da::DataAccess::getMBR ( ) const

Gets the MBR of the data access.

Returns
The MBR of the data access

◆ getQuery()

te::da::Select* te::da::DataAccess::getQuery ( ) const

Get query object.

Returns
Pointer to the query object
Note
The caller of this method will NOT take the ownership of the given pointer

◆ getSRID()

int te::da::DataAccess::getSRID ( ) const

Gets the SRID of the data access.

Returns
The SRID of the data accessThe the objectId set to be used as a filter

◆ getStrQuery()

std::string te::da::DataAccess::getStrQuery ( ) const

Get query object as string.

Returns
String with the query restriction.

◆ query() [1/2]

std::unique_ptr<te::da::DataSet> te::da::DataAccess::query ( const te::da::Select select)

Get dataset using internal information (data source, datasetTypeConverter), but using query parameter for data restriction.

Parameters
selectSelect object that defines the data filter information.
Returns
DataSet object

◆ query() [2/2]

std::unique_ptr<te::da::DataSet> te::da::DataAccess::query ( const std::string &  query)

◆ saveDataSet()

void te::da::DataAccess::saveDataSet ( te::da::DataSet dataSet,
bool  enableProgress = true 
)

Function used to save data into internal datasource (if a converter was defined, it will be used)

Parameters
dataSetPointer to a data set to be saved
Note
DataAccess will take the ownership of dataset and erase the data at end

◆ setConverter()

void te::da::DataAccess::setConverter ( te::da::DataSetTypeConverter converter)

Set data set converter type.

Parameters
converterThe data set type converter pointer
Note
This class will take the ownership of converter pointer

◆ setObjectIdSetFilter()

void te::da::DataAccess::setObjectIdSetFilter ( const te::da::ObjectIdSet objectIdSetFilter)

◆ setQuery()

void te::da::DataAccess::setQuery ( te::da::Select select)

Set data set restriction.

Parameters
selectThe data set query pointer
Note
This class will take the ownership of query pointer

Member Data Documentation

◆ m_dataSetName

std::string te::da::DataAccess::m_dataSetName
protected

Dataset name.

Definition at line 270 of file DataAccess.h.

◆ m_dataSetQuery

std::unique_ptr<te::da::Select> te::da::DataAccess::m_dataSetQuery
protected

Filter used to load data with restriction.

Definition at line 269 of file DataAccess.h.

◆ m_dataSetType

std::unique_ptr<te::da::DataSetType> te::da::DataAccess::m_dataSetType
protected

Data set type.

Definition at line 267 of file DataAccess.h.

◆ m_dataSetTypeConverter

std::unique_ptr<te::da::DataSetTypeConverter> te::da::DataAccess::m_dataSetTypeConverter
protected

DataSetType Converter.

Definition at line 268 of file DataAccess.h.

◆ m_dataSource

te::da::DataSourcePtr te::da::DataAccess::m_dataSource
protected

Data source.

Definition at line 266 of file DataAccess.h.

◆ m_objectIdSetFilter

std::unique_ptr<te::da::ObjectIdSet> te::da::DataAccess::m_objectIdSetFilter
protected

A optional filter containg an objectId set.

Definition at line 271 of file DataAccess.h.


The documentation for this class was generated from the following file: