te::dt::Array Class Reference

The type for variable-length multidimensional arrays. More...

#include <Array.h>

Inheritance diagram for te::dt::Array:
te::dt::AbstractData

Public Member Functions

 Array (std::size_t d, int t)
 Multi-dimensional array constructor. More...
 
 Array (const Array &rhs)
 Copy constructor. More...
 
AbstractDataclone () const
 It creates a new clone of the array. More...
 
te::dt::AbstractDatagetData (const std::vector< std::size_t > &i)
 Returns data from specified position. More...
 
std::size_t getDimension () const
 Returns the numbe of dimensions of the array. More...
 
std::size_t getDimensionSize (std::size_t i) const
 Gets the number of elements in the i-th dimension. More...
 
int getElementsTypeCode ()
 Returns the data type of the elements of the array. More...
 
int getTypeCode () const
 Returns the type code for array data: ARRAY_TYPE. More...
 
void insert (te::dt::AbstractData *data, const std::vector< std::size_t > &pos)
 Inserts data into specified position. More...
 
Arrayoperator= (const Array &rhs)
 Assignment operator. More...
 
te::dt::AbstractDataoperator[] (const std::vector< std::size_t > &i)
 Access data in i index. More...
 
std::string toString () const
 Return a string with all the data inside array. More...
 
 ~Array ()
 Destructor. More...
 

Protected Attributes

std::map< std::vector< std::size_t >, te::dt::AbstractData * > m_data
 A map from positions to data. More...
 
std::size_t m_dimension
 The number of dimensions. More...
 
std::vector< std::size_t > m_dimensionSizes
 The vector of sizes for the dimensions. More...
 
int m_type
 The data type of this array. More...
 

Detailed Description

The type for variable-length multidimensional arrays.

Note
This class was not designed to achieve performance, since it maps a vector of positions to one abstract data. This class is only a container to be used by database drivers. If you need a high performance array class with matrix operations, see the Matrix module. To access the data, you must define a vector of positions, where each dimension in the vector corresponds to the respective dimension in the array.
See also
ArrayProperty, AbstractData

Definition at line 59 of file Array.h.

Constructor & Destructor Documentation

te::dt::Array::Array ( std::size_t  d,
int  t 
)

Multi-dimensional array constructor.

Parameters
dThe number of dimensions of the array.
tThe data type.
te::dt::Array::Array ( const Array rhs)

Copy constructor.

Parameters
rhsThe right-hand-side instance.
te::dt::Array::~Array ( )

Destructor.

Member Function Documentation

AbstractData* te::dt::Array::clone ( ) const
virtual

It creates a new clone of the array.

Returns
A new clone of the array. The caller will take its ownership.

Implements te::dt::AbstractData.

te::dt::AbstractData* te::dt::Array::getData ( const std::vector< std::size_t > &  i)

Returns data from specified position.

Parameters
iThe position in the array to get data (d1, d2, ... dn).
Returns
The data from specified position.
std::size_t te::dt::Array::getDimension ( ) const

Returns the numbe of dimensions of the array.

std::size_t te::dt::Array::getDimensionSize ( std::size_t  i) const

Gets the number of elements in the i-th dimension.

Parameters
iThe dimension index.
Returns
The number of elements in the i-th dimension.
int te::dt::Array::getElementsTypeCode ( )

Returns the data type of the elements of the array.

Note
The attribute types are listed in terralib/datatype/DataTypes.h
int te::dt::Array::getTypeCode ( ) const
inlinevirtual

Returns the type code for array data: ARRAY_TYPE.

Implements te::dt::AbstractData.

Definition at line 144 of file Array.h.

References te::dt::ARRAY_TYPE.

void te::dt::Array::insert ( te::dt::AbstractData data,
const std::vector< std::size_t > &  pos 
)

Inserts data into specified position.

Parameters
dataThe data to be inserted.
posThe position in the array to insert data (d1, d2, ... dn).
Array& te::dt::Array::operator= ( const Array rhs)

Assignment operator.

Parameters
rhsThe right-hand-side instance.
Returns
A reference to this array.
te::dt::AbstractData& te::dt::Array::operator[] ( const std::vector< std::size_t > &  i)

Access data in i index.

Parameters
iThe data index, a vector of std::size_t.
Warning
The caller is reponsible for providing a valid index.
Returns
A reference to the i-th data.
std::string te::dt::Array::toString ( ) const
virtual

Return a string with all the data inside array.

Implements te::dt::AbstractData.

Member Data Documentation

std::map<std::vector<std::size_t>, te::dt::AbstractData*> te::dt::Array::m_data
protected

A map from positions to data.

Definition at line 151 of file Array.h.

std::size_t te::dt::Array::m_dimension
protected

The number of dimensions.

Definition at line 152 of file Array.h.

std::vector<std::size_t> te::dt::Array::m_dimensionSizes
protected

The vector of sizes for the dimensions.

Definition at line 153 of file Array.h.

int te::dt::Array::m_type
protected

The data type of this array.

Definition at line 154 of file Array.h.


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