All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataSet.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/memory/DataSet.cpp
22 
23  \brief Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver.
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "../common/Translator.h"
29 #include "../dataaccess/dataset/DataSetType.h"
30 #include "../dataaccess/utils/Utils.h"
31 #include "../datatype/ByteArray.h"
32 #include "../datatype/DataType.h"
33 #include "../datatype/Property.h"
34 #include "../datatype/SimpleData.h"
35 #include "../datatype/StringProperty.h"
36 #include "../datatype/Utils.h"
37 #include "../geometry/Envelope.h"
38 #include "../geometry/Geometry.h"
39 #include "../geometry/Utils.h"
40 #include "DataSet.h"
41 #include "DataSetItem.h"
42 #include "Exception.h"
43 
44 // STL
45 #include <limits>
46 
48  : m_items(new boost::ptr_vector<DataSetItem>),
49  m_i(-1)
50 {
52 
53  // Fill char-encodings
54  for(std::size_t i = 0; i < dt->size(); ++i)
55  {
56  te::dt::StringProperty* p = dynamic_cast<te::dt::StringProperty*>(dt->getProperty(i));
57  if(p != 0)
58  m_encodings[i] = p->getCharEncoding();
59  }
60 }
61 
63  : m_items(new boost::ptr_vector<DataSetItem>),
64  m_i(-1)
65 {
67 
68  // Fill char-encodings
69  for(std::size_t i = 0; i < m_ptypes.size(); ++i)
72 
73  copy(rhs, 0);
74 }
75 
76 te::mem::DataSet::DataSet(const DataSet& rhs, const bool deepCopy)
77  : m_items(new boost::ptr_vector<DataSetItem>),
78  m_i(-1)
79 {
81 
82  // Fill char-encodings
83  for(std::size_t i = 0; i < m_ptypes.size(); ++i)
86 
87  if(deepCopy)
88  m_items.reset(new boost::ptr_vector<DataSetItem>(*(rhs.m_items)));
89  else
90  m_items = rhs.m_items;
91 }
92 
93 te::mem::DataSet::DataSet(te::da::DataSet& rhs, const std::vector<std::size_t>& properties, std::size_t limit)
94  : m_items(new boost::ptr_vector<DataSetItem>),
95  m_i(-1)
96 {
97  for(std::size_t i = 0; i != properties.size(); ++i)
98  {
99  int ptype = rhs.getPropertyDataType(properties[i]);
100 
101  m_pnames.push_back(rhs.getPropertyName(properties[i]));
102  m_ptypes.push_back(ptype);
103  if(ptype == te::dt::STRING_TYPE)
104  m_encodings[properties[i]] = rhs.getPropertyCharEncoding(properties[i]);
105  }
106 
107  copy(rhs, properties, limit);
108 }
109 
111 {
112 }
113 
115 {
116  m_items->clear();
117 }
118 
119 void te::mem::DataSet::copy(te::da::DataSet& src, std::size_t limit)
120 {
121  std::vector<std::size_t> properties;
122 
123  const std::size_t np = src.getNumProperties();
124 
125  for(std::size_t i = 0; i != np; ++i)
126  properties.push_back(i);
127 
128  copy(src, properties, limit);
129 }
130 
131 void te::mem::DataSet::copy(te::da::DataSet& src, const std::vector<std::size_t>& properties, std::size_t limit)
132 {
133  bool unlimited = true;
134 
135  if(limit == 0)
136  {
137  limit = std::numeric_limits<std::size_t>::max();
138  }
139  else
140  {
141  m_items->reserve(m_items->size() + limit);
142  unlimited = false;
143  }
144 
145  std::size_t i = 0;
146 
147  const std::size_t nproperties = properties.size();
148 
149  while(src.moveNext() && (i < limit))
150  {
151  std::auto_ptr<DataSetItem> item(new DataSetItem(this));
152 
153  for(std::size_t c = 0; c < nproperties; ++c)
154  {
155  if(!src.isNull(properties[c]))
156  item->setValue(c, src.getValue(properties[c]).release());
157  else
158  item->setValue(c, 0);
159  }
160 
161  m_items->push_back(item.release());
162 
163  ++i;
164  }
165 
166  //src.moveBeforeFirst();
167 
168  if(!unlimited & (i < limit))
169  throw Exception(TE_TR("The source dataset has few items than requested copy limit!"));
170 }
171 
173 {
174  m_items->push_back(item);
175 }
176 
178 {
179  m_items->erase(m_items->begin() + m_i);
180 }
181 
183 {
184  const std::size_t nitems = m_items->size();
185 
186  for(std::size_t i = 0; i < nitems; ++i)
187  {
188  if(&(m_items->operator[](i)) == item)
189  {
190  m_items->erase(m_items->begin() + i);
191  break;
192  }
193  }
194 
195  throw Exception(TE_TR("Item not found in the dataset!"));
196 }
197 
198 void te::mem::DataSet::add(const std::string& propertyName, std::size_t propertyType, const te::dt::AbstractData* defaultValue)
199 {
200  m_pnames.push_back(propertyName);
201  m_ptypes.push_back(propertyType);
202 
203  const std::size_t nitems = m_items->size();
204 
205  for(std::size_t i = 0; i < nitems; ++i)
206  m_items->operator[](i).m_data.push_back(defaultValue ? defaultValue->clone() : 0);
207 }
208 
209 void te::mem::DataSet::drop(std::size_t pos)
210 {
211  const std::size_t nitems = m_items->size();
212 
213  for(std::size_t i = 0; i < nitems; ++i)
214  m_items->operator[](i).m_data.erase( m_items->operator[](i).m_data.begin() + pos);
215 
216  m_pnames.erase(m_pnames.begin() + pos);
217  m_ptypes.erase(m_ptypes.begin() + pos);
218 }
219 
221 {
222  //std::size_t propPos = m_dt->getPropertyPosition(prop);
223 
224  //const std::size_t nitems = m_items->size();
225 
226  //for(std::size_t i = 0; i < nitems; ++i)
227  // m_items->operator[](i).m_data.replace(m_items->operator[](i).m_data.begin() + propPos, 0);
228  throw Exception("No implemented yet!");
229 }
230 
232 {
233  return te::common::RANDOM;
234 }
235 
237 {
238  return te::common::RWAccess;
239 }
240 
241 std::auto_ptr<te::gm::Envelope> te::mem::DataSet::getExtent(std::size_t i)
242 {
243  std::auto_ptr<te::gm::Envelope> mbr(new te::gm::Envelope);
244 
245  const std::size_t nitems = m_items->size();
246 
247  for(std::size_t ii = 0; ii < nitems; ++ii)
248  {
249  std::auto_ptr<te::gm::Geometry> geom((*m_items)[ii].getGeometry(i));
250 
251  mbr->Union(*(geom->getMBR()));
252  }
253 
254  return mbr;
255 }
256 
258 {
259  return m_pnames.size();
260 }
261 
262 int te::mem::DataSet::getPropertyDataType(std::size_t pos) const
263 {
264  return m_ptypes[pos];
265 }
266 
267 void te::mem::DataSet::setPropertyDataType(int dt, std::size_t pos)
268 {
269  m_ptypes[pos] = dt;
270 }
271 
272 std::string te::mem::DataSet::getPropertyName(std::size_t pos) const
273 {
274  return m_pnames[pos];
275 }
276 
277 void te::mem::DataSet::setPropertyName(const std::string& name, std::size_t pos)
278 {
279  m_pnames[pos] = name;
280 }
281 
283 {
284  if (m_encodings.size()== 0) return te::common::UNKNOWN_CHAR_ENCODING;
285  std::map<int, te::common::CharEncoding>::const_iterator it = m_encodings.find(i);
286  assert(it != m_encodings.end());
287 
288  return it->second;
289 }
290 
291 std::string te::mem::DataSet::getDatasetNameOfProperty(std::size_t /*pos*/) const
292 {
293  throw Exception("No implemented yet!");
294 }
295 
297 {
298  return (*m_items)[m_i].clone().get();
299 }
300 
302 {
303  return m_items->empty();
304 }
305 
307 {
308  return false;
309 }
310 
311 std::size_t te::mem::DataSet::size() const
312 {
313  return m_items->size();
314 }
315 
317 {
318  ++m_i;
319  return m_i < static_cast<int>(m_items->size());
320 }
321 
323 {
324  --m_i;
325  return m_i > 0;
326 }
327 
329 {
330  m_i = -1;
331  return true;
332 }
333 
335 {
336  m_i = 0;
337  return true;
338 }
339 
341 {
342  m_i = m_items->size() - 1;
343  return m_i < static_cast<int>(m_items->size());
344 }
345 
346 bool te::mem::DataSet::move(std::size_t i)
347 {
348  m_i = i;
349  return m_i < static_cast<int>(m_items->size());
350 }
351 
353 {
354  return m_i == 0;
355 }
356 
358 {
359  return m_i < 0;
360 }
361 
363 {
364  return m_i == (static_cast<int>(m_items->size()) - 1);
365 }
366 
368 {
369  return m_i > static_cast<int>(m_items->size());
370 }
371 
372 char te::mem::DataSet::getChar(std::size_t i) const
373 {
374  return (*m_items)[m_i].getChar(i);
375 }
376 
377 void te::mem::DataSet::setChar(std::size_t i, char value)
378 {
379  (*m_items)[m_i].setChar(i, value);
380 }
381 
382 void te::mem::DataSet::setChar(const std::string& name, char value)
383 {
384  (*m_items)[m_i].setChar(name, value);
385 }
386 
387 unsigned char te::mem::DataSet::getUChar(std::size_t i) const
388 {
389  return (*m_items)[m_i].getUChar(i);
390 }
391 
392 void te::mem::DataSet::setUChar(std::size_t i, unsigned char value)
393 {
394  (*m_items)[m_i].setUChar(i, value);
395 }
396 
397 void te::mem::DataSet::setUChar(const std::string& name, unsigned char value)
398 {
399  (*m_items)[m_i].setUChar(name, value);
400 }
401 
402 boost::int16_t te::mem::DataSet::getInt16(std::size_t i) const
403 {
404  return (*m_items)[m_i].getInt16(i);
405 }
406 
407 void te::mem::DataSet::setInt16(std::size_t i, boost::int16_t value)
408 {
409  (*m_items)[m_i].setInt16(i, value);
410 }
411 
412 void te::mem::DataSet::setInt16(const std::string& name, boost::int16_t value)
413 {
414  (*m_items)[m_i].setInt16(name, value);
415 }
416 
417 boost::int32_t te::mem::DataSet::getInt32(std::size_t i) const
418 {
419  return (*m_items)[m_i].getInt32(i);
420 }
421 
422 void te::mem::DataSet::setInt32(std::size_t i, boost::int32_t value)
423 {
424  (*m_items)[m_i].setInt32(i, value);
425 }
426 
427 void te::mem::DataSet::setInt32(const std::string& name, boost::int32_t value)
428 {
429  (*m_items)[m_i].setInt32(name, value);
430 }
431 
432 boost::int64_t te::mem::DataSet::getInt64(std::size_t i) const
433 {
434  return (*m_items)[m_i].getInt64(i);
435 }
436 
437 void te::mem::DataSet::setInt64(std::size_t i, boost::int64_t value)
438 {
439  (*m_items)[m_i].setInt64(i, value);
440 }
441 
442 void te::mem::DataSet::setInt64(const std::string& name, boost::int64_t value)
443 {
444  (*m_items)[m_i].setInt64(name, value);
445 }
446 
447 bool te::mem::DataSet::getBool(std::size_t i) const
448 {
449  return (*m_items)[m_i].getBool(i);
450 }
451 
452 void te::mem::DataSet::setBool(std::size_t i, bool value)
453 {
454  (*m_items)[m_i].setBool(i, value);
455 }
456 
457 void te::mem::DataSet::setBool(const std::string& name, bool value)
458 {
459  (*m_items)[m_i].setBool(name, value);
460 }
461 
462 float te::mem::DataSet::getFloat(std::size_t i) const
463 {
464  return (*m_items)[m_i].getFloat(i);
465 }
466 
467 void te::mem::DataSet::setFloat(std::size_t i, float value)
468 {
469  (*m_items)[m_i].setFloat(i, value);
470 }
471 
472 void te::mem::DataSet::setFloat(const std::string& name, float value)
473 {
474  (*m_items)[m_i].setFloat(name, value);
475 }
476 
477 double te::mem::DataSet::getDouble(std::size_t i) const
478 {
479  return (*m_items)[m_i].getDouble(i);
480 }
481 
482 void te::mem::DataSet::setDouble(std::size_t i, double value)
483 {
484  (*m_items)[m_i].setDouble(i, value);
485 }
486 
487 void te::mem::DataSet::setDouble(const std::string& name, double value)
488 {
489  (*m_items)[m_i].setDouble(name, value);
490 }
491 
492 std::string te::mem::DataSet::getNumeric(std::size_t i) const
493 {
494  return (*m_items)[m_i].getNumeric(i);
495 }
496 
497 void te::mem::DataSet::setNumeric(std::size_t i, const std::string& value)
498 {
499  (*m_items)[m_i].setNumeric(i, value);
500 }
501 
502 void te::mem::DataSet::setNumeric(const std::string& name, const std::string& value)
503 {
504  (*m_items)[m_i].setNumeric(name, value);
505 }
506 
507 std::string te::mem::DataSet::getString(std::size_t i) const
508 {
509  return (*m_items)[m_i].getString(i);
510 }
511 
512 void te::mem::DataSet::setString(std::size_t i, const std::string& value)
513 {
514  (*m_items)[m_i].setString(i, value);
515 }
516 
517 void te::mem::DataSet::setString(const std::string& name, const std::string& value)
518 {
519  (*m_items)[m_i].setString(name, value);
520 }
521 
522 std::auto_ptr<te::dt::ByteArray> te::mem::DataSet::getByteArray(std::size_t i) const
523 {
524  return (*m_items)[m_i].getByteArray(i);
525 }
526 
528 {
529  (*m_items)[m_i].setByteArray(i, value);
530 }
531 
532 void te::mem::DataSet::setByteArray(const std::string& name, te::dt::ByteArray* value)
533 {
534  (*m_items)[m_i].setByteArray(name, value);
535 }
536 
537 std::auto_ptr<te::gm::Geometry> te::mem::DataSet::getGeometry(std::size_t i) const
538 {
539  return (*m_items)[m_i].getGeometry(i);
540 }
541 
543 {
544  (*m_items)[m_i].setGeometry(i, value);
545 }
546 
547 void te::mem::DataSet::setGeometry(const std::string& name, te::gm::Geometry* value)
548 {
549  (*m_items)[m_i].setGeometry(name, value);
550 }
551 
552 std::auto_ptr<te::rst::Raster> te::mem::DataSet::getRaster(std::size_t i) const
553 {
554  return (*m_items)[m_i].getRaster(i);
555 }
556 
557 void te::mem::DataSet::setRaster(std::size_t i, te::rst::Raster* value)
558 {
559  (*m_items)[m_i].setRaster(i, value);
560 }
561 
562 void te::mem::DataSet::setRaster(const std::string& name, te::rst::Raster* value)
563 {
564  (*m_items)[m_i].setRaster(name, value);
565 }
566 
567 std::auto_ptr<te::dt::DateTime> te::mem::DataSet::getDateTime(std::size_t i) const
568 {
569  return std::auto_ptr<te::dt::DateTime>((*m_items)[m_i].getDateTime(i));
570 }
571 
573 {
574  (*m_items)[m_i].setDateTime(i, value);
575 }
576 
577 void te::mem::DataSet::setDateTime(const std::string& name, te::dt::DateTime* value)
578 {
579  (*m_items)[m_i].setDateTime(name, value);
580 }
581 
582 std::auto_ptr<te::dt::Array> te::mem::DataSet::getArray(std::size_t i) const
583 {
584  return std::auto_ptr<te::dt::Array>(0);
585 }
586 
587 std::auto_ptr<te::dt::AbstractData> te::mem::DataSet::getValue(std::size_t i) const
588 {
589  return (*m_items)[m_i].getValue(i);
590 }
591 
593 {
594  (*m_items)[m_i].setValue(i, value);
595 }
596 
597 void te::mem::DataSet::setValue(const std::string& name, te::dt::AbstractData* ad)
598 {
599  (*m_items)[m_i].setValue(name, ad);
600 }
601 
602 bool te::mem::DataSet::isNull(std::size_t i) const
603 {
604  return (*m_items)[m_i].isNull(i);
605 }
std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
Definition: DataSet.cpp:567
Property * getProperty(std::size_t i) const
It returns the i-th property.
std::size_t size() const
It returns the collection size, if it is known.
Definition: DataSet.cpp:311
void setString(std::size_t i, const std::string &value)
Definition: DataSet.cpp:512
boost::shared_ptr< boost::ptr_vector< DataSetItem > > m_items
The list of dataset items.
Definition: DataSet.h:384
bool move(std::size_t i)
It moves the dataset internal pointer to a given position.
Definition: DataSet.cpp:346
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
Definition: DataSet.cpp:537
boost::int16_t getInt16(std::size_t i) const
Method for retrieving a 16-bit integer attribute value (2 bytes long).
Definition: DataSet.cpp:402
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
Definition: DataSet.cpp:367
te::common::CharEncoding getCharEncoding() const
It returns the string property character encoding.
CharEncoding
Supported charsets (character encoding).
void setByteArray(std::size_t i, te::dt::ByteArray *value)
Definition: DataSet.cpp:527
A class that models the description of a dataset.
Definition: DataSetType.h:72
te::common::TraverseType getTraverseType() const
It returns the traverse type associated to the dataset.
Definition: DataSet.cpp:231
te::common::AccessPolicy getAccessPolicy() const
It returns the read and write permission associated to the dataset.
Definition: DataSet.cpp:236
DataSet()
Default constructor.
Definition: DataSet.h:117
void setInt16(std::size_t i, boost::int16_t value)
Definition: DataSet.cpp:407
bool isAtEnd() const
It tells if the dataset internal pointer is on the last element of the collection.
Definition: DataSet.cpp:362
bool isConnected() const
It returns true if the dataset is connected and false if it is disconnected. A dataset can be connect...
Definition: DataSet.cpp:306
bool getBool(std::size_t i) const
Method for retrieving a boolean attribute value.
Definition: DataSet.cpp:447
void setInt32(std::size_t i, boost::int32_t value)
Definition: DataSet.cpp:422
bool moveFirst()
It moves the internal pointer to the first item in the collection.
Definition: DataSet.cpp:334
std::string getString(std::size_t i) const
Method for retrieving a string value attribute.
Definition: DataSet.cpp:507
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:347
std::map< int, te::common::CharEncoding > m_encodings
The list of string properties char-encoding.
Definition: DataSet.h:387
An exception class for the TerraLib In-Memory Data Access driver.
int getPropertyDataType(std::size_t pos) const
It returns the underlying data type of the property at position pos.
Definition: DataSet.cpp:262
bool isNull(std::size_t i) const
It checks if the attribute value is NULL.
Definition: DataSet.cpp:602
bool isEmpty() const
It returns true if the collection is empty.
Definition: DataSet.cpp:301
It models a property definition.
Definition: Property.h:59
std::vector< int > m_ptypes
The list of property types.
Definition: DataSet.h:386
void drop(std::size_t pos)
It drops a property from the dataset.
Definition: DataSet.cpp:209
std::auto_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
Definition: DataSet.cpp:587
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
Definition: DataSet.cpp:172
std::auto_ptr< DataSetItem > clone() const
It returns a clone of the DataSetItem.
Definition: DataSetItem.cpp:94
~DataSet()
Destructor.
Definition: DataSet.cpp:110
void setInt64(std::size_t i, boost::int64_t value)
Definition: DataSet.cpp:437
std::string getDatasetNameOfProperty(std::size_t pos) const
It returns the underlying dataset name of the property at position pos.
Definition: DataSet.cpp:291
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
void setValue(std::size_t i, te::dt::AbstractData *value)
Definition: DataSet.cpp:592
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:53
float getFloat(std::size_t i) const
Method for retrieving a float attribute value.
Definition: DataSet.cpp:462
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
std::auto_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
Definition: DataSet.cpp:522
boost::int32_t getInt32(std::size_t i) const
Method for retrieving a 32-bit integer attribute value (4 bytes long).
Definition: DataSet.cpp:417
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
virtual te::common::CharEncoding getPropertyCharEncoding(std::size_t i) const =0
It returns the property character encoding at position pos.
bool moveLast()
It sets the dataset internal pointer to the last item in the collection.
Definition: DataSet.cpp:340
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
Definition: DataSet.cpp:241
bool isBeforeBegin() const
It tells if the dataset internal pointer is in a position before the first element of the collection ...
Definition: DataSet.cpp:357
std::vector< std::string > m_pnames
The list of property names.
Definition: DataSet.h:385
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
The type for string types: FIXED_STRING, VAR_STRING or STRING.
std::size_t size() const
It returns the number of properties of the CompositeProperty.
void setNumeric(std::size_t i, const std::string &value)
Definition: DataSet.cpp:497
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
void remove()
It removes the current dataset item.
Definition: DataSet.cpp:177
void setDateTime(std::size_t i, te::dt::DateTime *value)
Definition: DataSet.cpp:572
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
void setFloat(std::size_t i, float value)
Definition: DataSet.cpp:467
bool isAtBegin() const
It tells if the dataset internal pointer is on the first element of the collection or not...
Definition: DataSet.cpp:352
DataSetItem * getItem() const
Definition: DataSet.cpp:296
std::auto_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
Definition: DataSet.cpp:552
std::string getNumeric(std::size_t i) const
Method for retrieving a numeric attribute value.
Definition: DataSet.cpp:492
unsigned char getUChar(std::size_t i) const
Method for retrieving an unsigned character attribute value (1 byte long).
Definition: DataSet.cpp:387
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
Definition: DataSet.cpp:328
bool moveNext()
It moves the internal pointer to the next item of the collection.
Definition: DataSet.cpp:316
void setGeometry(std::size_t i, te::gm::Geometry *value)
Definition: DataSet.cpp:542
boost::int64_t getInt64(std::size_t i) const
Method for retrieving a 64-bit integer attribute value (8 bytes long).
Definition: DataSet.cpp:432
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
Definition: DataSetItem.h:56
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
void copy(te::da::DataSet &src, std::size_t limit=0)
It copies up to limit items from the source dataset.
Definition: DataSet.cpp:119
std::string getPropertyName(std::size_t pos) const
It returns the property name at position pos.
Definition: DataSet.cpp:272
void update(te::dt::Property *prop)
It update a property from the dataset.
Definition: DataSet.cpp:220
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
Definition: DataSet.cpp:477
char getChar(std::size_t i) const
Method for retrieving a signed character attribute value (1 byte long).
Definition: DataSet.cpp:372
void setChar(std::size_t i, char value)
Definition: DataSet.cpp:377
void clear()
It clears all the dataset items.
Definition: DataSet.cpp:114
te::common::CharEncoding getPropertyCharEncoding(std::size_t i) const
It returns the property character encoding at position pos.
Definition: DataSet.cpp:282
void setBool(std::size_t i, bool value)
Definition: DataSet.cpp:452
void setUChar(std::size_t i, unsigned char value)
Definition: DataSet.cpp:392
bool movePrevious()
It moves the internal pointer to the previous item of the collection.
Definition: DataSet.cpp:322
virtual AbstractData * clone() const =0
It returns a clone of this object.
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
void setRaster(std::size_t i, te::rst::Raster *value)
Definition: DataSet.cpp:557
void setPropertyName(const std::string &name, std::size_t pos)
Definition: DataSet.cpp:277
std::auto_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
Definition: DataSet.cpp:582
void setDouble(std::size_t i, double value)
Definition: DataSet.cpp:482
virtual std::auto_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
Definition: DataSet.cpp:151
A class for representing binary data.
Definition: ByteArray.h:51
void setPropertyDataType(int dt, std::size_t pos)
Definition: DataSet.cpp:267
TEDATAACCESSEXPORT void GetPropertyInfo(const DataSetType *const dt, std::vector< std::string > &pnames, std::vector< int > &ptypes)
Definition: Utils.cpp:598
std::size_t getNumProperties() const
It returns the number of properties that composes an item of the dataset.
Definition: DataSet.cpp:257