27 #include "../common/STLUtils.h" 
   45   : m_dimension(rhs.m_dimension),
 
   46     m_dimensionSizes(rhs.m_dimensionSizes),
 
   51   while (it != rhs.
m_data.end())
 
   53     m_data[it->first] = it->second->clone();
 
   73     while (it != rhs.
m_data.end())
 
   75       m_data[it->first] = it->second->clone();
 
  103   assert(i < getDimension());
 
  105   return m_dimensionSizes[i];
 
  110   assert(pos.size() == getDimension());
 
  113   for (std::size_t i = 0; i < getDimension(); i++)
 
  114     m_dimensionSizes[i] = std::max(m_dimensionSizes[i], pos[i] + 1);
 
  124   assert(i.size() == getDimension());
 
  131   assert(i.size() == getDimension());
 
  138   return new Array(*
this);
 
  143   std::ostringstream output;
 
  145   std::size_t total_size = 1;
 
  147   std::vector<std::size_t> products_back (getDimension(), 1);
 
  149   std::vector<std::size_t> products_front (getDimension(), 1);
 
  151   for (std::size_t i = 0; i < getDimension(); i++)
 
  153     total_size *= getDimensionSize(i);
 
  155     for (std::size_t f = i + 1; f < getDimension(); f++)
 
  156       products_front[i] *= getDimensionSize(f);
 
  158     for (std::size_t b = 0; b < i; b++)
 
  159       products_back[i] *= getDimensionSize(b);
 
  162   std::vector<std::vector<std::size_t> > poses(total_size, std::vector<std::size_t>(getDimension(), 0));
 
  164   for (std::size_t ii = 0; ii < getDimension(); ii++)
 
  166     std::size_t i = getDimension() - ii - 1;
 
  169     for (std::size_t j = 0; j < products_back[i]; j++)
 
  170       for (std::size_t k = 0; k < getDimensionSize(i); k++)
 
  171         for (std::size_t l = 0; l < products_front[i]; l++)
 
  177   for (std::size_t i = 0; i < poses.size(); i++)
 
  179     std::map<std::vector<std::size_t>, 
te::dt::AbstractData*>::const_iterator it = m_data.find(poses[i]);
 
  181     if(it != m_data.end())
 
  182       output << it->second->
toString() << 
" ";
 
std::size_t m_dimension
The number of dimensions. 
 
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
 
Array & operator=(const Array &rhs)
Assignment operator. 
 
AbstractData * clone() const 
It creates a new clone of the array. 
 
Class for dealing with arrays of abstract data. 
 
virtual std::string toString() const =0
It returns the data value in a string notation. 
 
void insert(te::dt::AbstractData *data, const std::vector< std::size_t > &pos)
Inserts data into specified position. 
 
int m_type
The data type of this array. 
 
std::size_t getDimensionSize(std::size_t i) const 
Gets the number of elements in the i-th dimension. 
 
std::vector< std::size_t > m_dimensionSizes
The vector of sizes for the dimensions. 
 
int getElementsTypeCode()
Returns the data type of the elements of the array. 
 
A base class for values that can be retrieved from the data access module. 
 
Array(std::size_t d, int t)
Multi-dimensional array constructor. 
 
te::dt::AbstractData * getData(const std::vector< std::size_t > &i)
Returns data from specified position. 
 
std::size_t getDimension() const 
Returns the numbe of dimensions of the array. 
 
std::map< std::vector< std::size_t >, te::dt::AbstractData * > m_data
A map from positions to data. 
 
std::string toString() const 
Return a string with all the data inside array. 
 
The type for variable-length multidimensional arrays. 
 
te::dt::AbstractData & operator[](const std::vector< std::size_t > &i)
Access data in i index. 
 
V * GetPValue(const std::map< K, V * > &m, const K &k)
It finds for a given key in the map and returns a pointer if something is found or NULL otherwise...