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;
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 base class for values that can be retrieved from the data access module.
A class for representing binary data.
An Envelope defines a 2D rectangular region.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
An abstract class for raster data strucutures.
Implementation of a in-memory data set that contains spatiotemporal observations indexed by time and ...
bool isBeforeBegin() const
It tells if the dataset internal pointer is in a position before the first element of the collection ...
std::string getPropertyName(std::size_t i) const
It returns the property name at position pos.
void setUChar(std::size_t i, unsigned char value)
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.
void setRaster(const std::string &name, te::rst::Raster *value)
void setNumeric(std::size_t i, const std::string &value)
std::string getNumeric(std::size_t i) const
Method for retrieving a numeric attribute value.
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.
bool moveLast()
It sets the dataset internal pointer to the last item in the collection.
std::unique_ptr< te::dt::DateTimePeriod > getTemporalExtent() const
It returns the temporal extent of the observations.
boost::int16_t getInt16(std::size_t i) const
Method for retrieving a 16-bit integer attribute value (2 bytes long).
void setUChar(const std::string &name, unsigned char value)
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::size_t size() const
It returns the collection size, if it is known.
TimeToDataSetItemMap::const_iterator m_iterator
The pointer to the current item.
bool moveNext()
It moves the internal pointer to the next item of the collection.
void setRaster(std::size_t i, te::rst::Raster *value)
bool getBool(std::size_t i) const
Method for retrieving a boolean attribute value.
std::vector< int > m_ptypes
The list of property types.
bool moveFirst()
It moves the internal pointer to the first item in the collection.
boost::int32_t getInt32(std::size_t i) const
Method for retrieving a 32-bit integer attribute value (4 bytes long).
void setValue(std::size_t i, te::dt::AbstractData *value)
std::unique_ptr< te::sam::rtree::Index< te::mem::DataSetItem * > > m_RTree
A RTree index created over the default geometry property.
void setChar(const std::string &name, char value)
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::unique_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
te::common::TraverseType getTraverseType() const
It returns the traverse type associated to the dataset.
std::size_t getNumProperties() const
It returns the number of properties that composes an item of the dataset.
std::unique_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
void setDateTime(const std::string &name, te::dt::DateTime *value)
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.
bool movePrevious()
It moves the internal pointer to the previous item of the collection.
void copy(te::da::DataSet *src, unsigned int limit=0)
It copies up to limit items from the source dataset.
std::unique_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
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.
void setGeometry(std::size_t i, te::gm::Geometry *value)
void setNumeric(const std::string &name, const std::string &value)
void setString(const std::string &name, const std::string &value)
void setBool(const std::string &name, bool value)
const TimeToDataSetItemMap & getData() const
It returns a reference to the internal observation set.
bool isAtBegin() const
It tells if the dataset internal pointer is on the first element of the collection or not.
void setInt16(std::size_t i, boost::int16_t value)
int getGeomPropIdx() const
It returns the index of the property that contains the observed geometries.
std::unique_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
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.
bool isEmpty() const
It returns true if the collection is empty.
void setByteArray(const std::string &name, te::dt::ByteArray *value)
void setGeometry(const std::string &name, te::gm::Geometry *value)
int getBeginTimePropIdx() const
It returns the index of the property that contains the beginning phenomenon time.
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::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.
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.
void setByteArray(std::size_t i, te::dt::ByteArray *value)
void setInt32(std::size_t i, boost::int32_t value)
std::vector< std::string > m_pnames
internal control
unsigned char getUChar(std::size_t i) const
Method for retrieving an unsigned character attribute value (1 byte long).
boost::int64_t getInt64(std::size_t i) const
Method for retrieving a 64-bit integer attribute value (8 bytes long).
TimeToDataSetItemMap m_items
The list of dataset items, ordered by time.
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
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(std::size_t i, const std::string &value)
void setDateTime(std::size_t i, te::dt::DateTime *value)
int getEndTimePropIdx() const
It returns the index of the property that contains the end phenomenon time.
void setInt16(const std::string &name, boost::int16_t value)
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.
te::common::AccessPolicy getAccessPolicy() const
It returns the read and write permission associated to the dataset.
void setDouble(const std::string &name, double value)
void setChar(std::size_t i, char value)
int m_endTimePropIdx
The property index of the DataSetType that contains the phenomenon end time.
float getFloat(std::size_t i) const
Method for retrieving a float attribute value.
int m_begTimePropIdx
The property index of the DataSetType that contains the phenomenon beginning time.
void setInt32(const std::string &name, boost::int32_t value)
std::string getDatasetNameOfProperty(std::size_t i) const
It returns the underlying dataset name of the property at position pos.
std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
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.
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
DataSet(const DataSet &rhs, const bool deepCopy=false)
Regular copy constructor.
void setDouble(std::size_t i, double value)
bool move(std::size_t i)
It moves the dataset internal pointer to a given position.
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.
std::string getString(std::size_t i) const
Method for retrieving a string value attribute.
bool isPositionValid() const
It tells if the dataset internal pointer is on a valid position.
void setFloat(std::size_t i, float value)
void add(te::mem::DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
int m_geomPropIdx
The property index of the DataSetType that contains geometries.
void setFloat(const std::string &name, float value)
bool isConnected() const
It returns true if the dataset is connected and false if it is disconnected. A dataset can be connect...
void setValue(const std::string &name, te::dt::AbstractData *ad)
void add(const std::pair< te::dt::DateTime *, DateSetItemShrPtr > &item)
It adds an existing item to the dataset.
char getChar(std::size_t i) const
Method for retrieving a signed character attribute value (1 byte long).
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.
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::unique_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
std::unique_ptr< DataSet > clone() const
It returns a clone of the DataSet.
TraverseType
A dataset can be traversed in two ways:
AccessPolicy
Supported data access policies (can be used as bitfield).
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
SpatialRelation
Spatial relations between geometric objects.
std::pair< te::dt::DateTime *, DateSetItemShrPtr > TimeAndDateSetItemPair
std::multimap< te::dt::DateTime *, DateSetItemShrPtr, te::dt::CompareDateTime > TimeToDataSetItemMap
boost::shared_ptr< te::mem::DataSetItem > DateSetItemShrPtr
#define TESTMEMORYEXPORT
You can use this macro in order to export/import classes and functions from this module.
Proxy configuration file for TerraView (see terraview_config.h).