Go to the documentation of this file.
26 #ifndef __TERRALIB_STMEMORY_INTERNAL_DATASET_H
27 #define __TERRALIB_STMEMORY_INTERNAL_DATASET_H
30 #include "../dataaccess/dataset/DataSet.h"
31 #include "../sam/rtree/Index.h"
38 #include <boost/shared_ptr.hpp>
40 namespace te {
namespace da {
class DataSetType; } }
41 namespace te {
namespace dt {
class DateTimePeriod; } }
42 namespace te {
namespace mem {
class DataSetItem; } }
108 DataSet(
const std::vector<std::string>& pnames,
const std::vector<int>& ptyes,
size_t begTimePropIdx,
size_t endTimePropIdx,
size_t gmPropIdx);
263 void add(
const std::pair<te::dt::DateTime*, DateSetItemShrPtr>& item);
292 std::unique_ptr<DataSet>
clone()
const;
400 std::unique_ptr<te::gm::Envelope>
getExtent(std::size_t i);
446 std::unique_ptr<te::gm::Geometry>
getGeometry(std::size_t i)
const;
448 std::unique_ptr<te::rst::Raster>
getRaster(std::size_t i)
const;
450 std::unique_ptr<te::dt::DateTime>
getDateTime(std::size_t i)
const;
452 std::unique_ptr<te::dt::Array>
getArray(std::size_t i)
const;
456 std::unique_ptr<te::dt::AbstractData>
getValue(std::size_t i)
const;
466 void setChar(
const std::string& name,
char value);
470 void setUChar(
const std::string& name,
unsigned char value);
472 void setInt16(std::size_t i, boost::int16_t value);
474 void setInt16(
const std::string& name, boost::int16_t value);
476 void setInt32(std::size_t i, boost::int32_t value);
478 void setInt32(
const std::string& name, boost::int32_t value);
480 void setInt64(std::size_t i, boost::int64_t value);
482 void setInt64(
const std::string& name, boost::int64_t value);
486 void setBool(
const std::string& name,
bool value);
490 void setFloat(
const std::string& name,
float value);
498 void setNumeric(
const std::string& name,
const std::string& value);
500 void setString(std::size_t i,
const std::string& value);
502 void setString(
const std::string& name,
const std::string& value);
528 std::unique_ptr<te::sam::rtree::Index<te::mem::DataSetItem*> >
m_RTree;
540 #endif // __TERRALIB_STMEMORY_INTERNAL_DATASET_H
A class for representing binary data.
std::unique_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
std::string getNumeric(std::size_t i) const
Method for retrieving a numeric attribute value.
An Envelope defines a 2D rectangular region.
std::size_t getNumProperties() const
It returns the number of properties that composes an item of the dataset.
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
void add(const std::pair< te::dt::DateTime *, DateSetItemShrPtr > &item)
It adds an existing item to the dataset.
const TimeToDataSetItemMap & getData() const
It returns a reference to the internal observation set.
int m_begTimePropIdx
The property index of the DataSetType that contains the phenomenon beginning time.
#define TESTMEMORYEXPORT
You can use this macro in order to export/import classes and functions from this module.
std::unique_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
boost::int64_t getInt64(std::size_t i) const
Method for retrieving a 64-bit integer attribute value (8 bytes long).
std::unique_ptr< DataSet > clone() const
It returns a clone of the DataSet.
std::unique_ptr< te::stmem::DataSet > nearestObservations(const te::dt::DateTime *time, int n) const
It returns the n nearest observations to a given date and time.
std::string getDatasetNameOfProperty(std::size_t i) const
It returns the underlying dataset name of the property at position pos.
DataSet(const std::vector< std::string > &pnames, const std::vector< int > &ptyes, size_t begTimePropIdx, size_t endTimePropIdx, size_t gmPropIdx)
It constructs an empty in-memory dataset indexed by time and space.
std::vector< int > m_ptypes
The list of property types.
void setByteArray(const std::string &name, te::dt::ByteArray *value)
An abstract class for raster data strucutures.
std::unique_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
void setString(std::size_t i, const std::string &value)
std::unique_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
TimeToDataSetItemMap::const_iterator m_iterator
The pointer to the current item.
DataSet(te::da::DataSet *ds, size_t begTimePropIdx, size_t endTimePropIdx, size_t gmPropIdx, unsigned int limit)
It constructs an in-memory observation dataset from a given data set.
std::unique_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
bool moveLast()
It sets the dataset internal pointer to the last item in the collection.
void setInt16(const std::string &name, boost::int16_t value)
bool isPositionValid() const
It tells if the dataset internal pointer is on a valid position.
TimeToDataSetItemMap m_items
The list of dataset items, ordered by time.
TraverseType
A dataset can be traversed in two ways:
DataSet(const te::da::DataSetType *type, size_t tpPropIdx, size_t gmPropIdx)
It constructs an empty in-memory dataset indexed by time and space.
void setString(const std::string &name, const std::string &value)
te::common::TraverseType getTraverseType() const
It returns the traverse type associated to the dataset.
std::unique_ptr< DataSet > filter(const te::gm::Envelope *e, te::gm::SpatialRelation r) const
It returns a new DataSet, based on a given spatial filter.
std::unique_ptr< DataSet > filter(const te::gm::Geometry *g, te::gm::SpatialRelation r) const
It returns a new DataSet, based on a given spatial filter.
int m_geomPropIdx
The property index of the DataSetType that contains geometries.
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
bool moveNext()
It moves the internal pointer to the next item of the collection.
DataSet(te::da::DataSet *ds, size_t tpPropIdx, size_t gmPropIdx=-1, unsigned int limit=0)
It constructs an in-memory observation dataset from a given data set.
boost::shared_ptr< te::mem::DataSetItem > DateSetItemShrPtr
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
void copy(te::da::DataSet *src, unsigned int limit=0)
It copies up to limit items from the source dataset.
void copy(te::da::DataSet *src, const std::vector< std::size_t > &properties, unsigned int limit=0)
It copies up to limit items from the source dataset (src).
std::multimap< te::dt::DateTime *, DateSetItemShrPtr, te::dt::CompareDateTime > TimeToDataSetItemMap
bool movePrevious()
It moves the internal pointer to the previous item of the collection.
void setNumeric(std::size_t i, const std::string &value)
bool isConnected() const
It returns true if the dataset is connected and false if it is disconnected. A dataset can be connect...
int getPropertyDataType(std::size_t i) const
It returns the underlying data type of the property at position pos.
DataSet(const te::da::DataSetType *type, size_t tpPropIdx)
It constructs an empty in-memory dataset indexed by time and space.
std::vector< std::string > m_pnames
internal control
int getEndTimePropIdx() const
It returns the index of the property that contains the end phenomenon time.
boost::int32_t getInt32(std::size_t i) const
Method for retrieving a 32-bit integer attribute value (4 bytes long).
void setFloat(std::size_t i, float value)
boost::int16_t getInt16(std::size_t i) const
Method for retrieving a 16-bit integer attribute value (2 bytes long).
void setRaster(std::size_t i, te::rst::Raster *value)
void setFloat(const std::string &name, float value)
bool getBool(std::size_t i) const
Method for retrieving a boolean attribute value.
float getFloat(std::size_t i) const
Method for retrieving a float attribute value.
bool move(std::size_t i)
It moves the dataset internal pointer to a given position.
SpatialRelation
Spatial relations between geometric objects.
void setDouble(const std::string &name, double value)
void setByteArray(std::size_t i, te::dt::ByteArray *value)
void setUChar(std::size_t i, unsigned char value)
void setDateTime(const std::string &name, te::dt::DateTime *value)
bool isBeforeBegin() const
It tells if the dataset internal pointer is in a position before the first element of the collection ...
void setInt16(std::size_t i, boost::int16_t value)
std::pair< te::dt::DateTime *, DateSetItemShrPtr > TimeAndDateSetItemPair
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
std::unique_ptr< DataSet > filter(const te::gm::Geometry *g, te::gm::SpatialRelation r, const te::dt::DateTime *dt, te::dt::TemporalRelation tr) const
It returns a new DataSet, based on a given spatial filter.
void setDouble(std::size_t i, double value)
int getBeginTimePropIdx() const
It returns the index of the property that contains the beginning phenomenon time.
std::unique_ptr< te::dt::DateTimePeriod > getTemporalExtent() const
It returns the temporal extent of the observations.
std::string getString(std::size_t i) const
Method for retrieving a string value attribute.
bool isEmpty() const
It returns true if the collection is empty.
void setBool(const std::string &name, bool value)
te::common::AccessPolicy getAccessPolicy() const
It returns the read and write permission associated to the dataset.
void setChar(std::size_t i, char value)
std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
unsigned char getUChar(std::size_t i) const
Method for retrieving an unsigned character attribute value (1 byte long).
A base class for values that can be retrieved from the data access module.
std::unique_ptr< DataSet > filter(const te::dt::DateTime *dt, te::dt::TemporalRelation tr) const
It returns a new DataSet, based on a given temporal filter.
std::unique_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
void setGeometry(std::size_t i, te::gm::Geometry *value)
int m_endTimePropIdx
The property index of the DataSetType that contains the phenomenon end time.
int getGeomPropIdx() const
It returns the index of the property that contains the observed geometries.
void setGeometry(const std::string &name, te::gm::Geometry *value)
void setRaster(const std::string &name, te::rst::Raster *value)
DataSet(const DataSet &rhs, const bool deepCopy=false)
Regular copy constructor.
void setDateTime(std::size_t i, te::dt::DateTime *value)
std::string getPropertyName(std::size_t i) const
It returns the property name at position pos.
void add(te::mem::DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
void setInt64(std::size_t i, boost::int64_t value)
bool isNull(std::size_t i) const
It checks if the attribute value is NULL.
std::unique_ptr< DataSet > filter(const te::gm::Envelope *e, te::gm::SpatialRelation r, const te::dt::DateTime *dt, te::dt::TemporalRelation tr) const
It returns a new DataSet, based on a given spatial and temporal filter.
A dataset is the unit of information manipulated by the data access module of TerraLib.
bool moveFirst()
It moves the internal pointer to the first item in the collection.
bool isAtBegin() const
It tells if the dataset internal pointer is on the first element of the collection or not.
Proxy configuration file for TerraView (see terraview_config.h).
void setInt32(std::size_t i, boost::int32_t value)
A class that models the description of a dataset.
DataSet(const te::da::DataSetType *type, size_t begTimePropIdx, size_t endTimePropIdx, size_t gmPropIdx)
It constructs an empty in-memory dataset indexed by time and space.
Implementation of a in-memory data set that contains spatiotemporal observations indexed by time and ...
void setChar(const std::string &name, char value)
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
void setInt64(const std::string &name, boost::int64_t value)
void setBool(std::size_t i, bool value)
bool isAtEnd() const
It tells if the dataset internal pointer is on the last element of the collection.
void setUChar(const std::string &name, unsigned char value)
void setValue(const std::string &name, te::dt::AbstractData *ad)
char getChar(std::size_t i) const
Method for retrieving a signed character attribute value (1 byte long).
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
std::unique_ptr< te::sam::rtree::Index< te::mem::DataSetItem * > > m_RTree
A RTree index created over the default geometry property.
void setValue(std::size_t i, te::dt::AbstractData *value)
std::size_t size() const
It returns the collection size, if it is known.
AccessPolicy
Supported data access policies (can be used as bitfield).
void setNumeric(const std::string &name, const std::string &value)
void setInt32(const std::string &name, boost::int32_t value)