DataSetItem.h
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/DataSetItem.h
22 
23  \brief An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
24 */
25 
26 #ifndef __TERRALIB_MEMORY_INTERNAL_DATASETITEM_H
27 #define __TERRALIB_MEMORY_INTERNAL_DATASETITEM_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 #include "../dataaccess/dataset/DataSetItem.h"
33 
34 // Forward declarations
35 namespace te { namespace dt { class AbstractData; class Array; class ByteArray; class DateTime; } }
36 namespace te { namespace gm { class Geometry; } }
37 namespace te { namespace rst { class Raster; } }
38 
39 namespace te
40 {
41  namespace da
42  {
43 // Forward declaration
44  class DataSet;
45  }
46 
47  namespace mem
48  {
49  /*!
50  \class DataSetItem
51 
52  \brief An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
53  */
55  {
56  public:
57 
58  explicit DataSetItem(const std::vector<std::string>& vecNames, const std::vector<int>& vecTypes);
59 
60  /*!
61  \brief It creates a new item having the same schema as the parent dataset.
62 
63  \param parent The dataset to which this item is associated.
64 
65  \note The dataset item will NOT take the ownership of the given pointer.
66  */
67  explicit DataSetItem(const te::da::DataSet* dataSet);
68 
69  /*!
70  \brief It creates a new item having the same schema as the dataset type.
71 
72  \param parent The dataset to which this item is associated.
73 
74  \note The dataset item will NOT take the ownership of the given pointer.
75  */
76  explicit DataSetItem(const te::da::DataSetType* dataSetType);
77 
78  /*!
79  \brief It creates a new item by cloning the values in the source item (rhs).
80 
81  \param rhs The right-hand-side object to copy its values.
82  */
83  explicit DataSetItem(const DataSetItem& rhs);
84 
85  /*! \brief Destructor. */
86  virtual ~DataSetItem();
87 
88  /*!
89  \brief Assignment operator.
90 
91  It copies the values from the rhs item.
92 
93  \param rhs The right-hand-side ibject to copy its values.
94 
95  \return A reference to this item.
96 
97  \pre The rhs item must be of a compatible type with the item being assigned.
98  */
99 
101 
102  /*!
103  \brief It returns a clone of the DataSetItem.
104  */
105  virtual te::da::DataSetItem* clone() const override;
106 
107  /*!
108  \brief It sets the value of the i-th property.
109  */
110  void setChar(std::size_t i, char value);
111 
112  /*!
113  \brief It sets the value of the property, indicating its name.
114  */
115  void setChar(const std::string& name, char value);
116 
117  /*!
118  \brief It sets the value of the i-th property.
119  */
120  void setUChar(std::size_t i, unsigned char value);
121 
122  /*!
123  \brief It sets the value of the property, indicating its name.
124  */
125  void setUChar(const std::string& name, unsigned char value);
126 
127  /*!
128  \brief It sets the value of the i-th property.
129  */
130  void setInt16(std::size_t i, boost::int16_t value);
131 
132  /*!
133  \brief It sets the value of the property, indicating its name.
134  */
135  void setInt16(const std::string& name, boost::int16_t value);
136 
137  /*!
138  \brief It sets the value of the i-th property.
139  */
140  void setInt32(std::size_t i, boost::int32_t value);
141 
142  /*!
143  \brief It sets the value of the property, indicating its name.
144  */
145  void setInt32(const std::string& name, boost::int32_t value);
146 
147  /*!
148  \brief It sets the value of the i-th property.
149  */
150  void setInt64(std::size_t i, boost::int64_t value);
151 
152  /*!
153  \brief It sets the value of the property, indicating its name.
154  */
155  void setInt64(const std::string& name, boost::int64_t value);
156 
157  /*!
158  \brief It sets the value of the i-th property.
159  */
160  void setBool(std::size_t i, bool value);
161 
162  /*!
163  \brief It sets the value of the property, indicating its name.
164  */
165  void setBool(const std::string& name, bool value);
166 
167 
168  /*!
169  \brief It sets the value of the i-th property.
170  */
171  void setFloat(std::size_t i, float value);
172 
173  /*!
174  \brief It sets the value of the property, indicating its name.
175  */
176  void setFloat(const std::string& name, float value);
177 
178  /*!
179  \brief It sets the value of the i-th property.
180  */
181  void setDouble(std::size_t i, double value);
182 
183  /*!
184  \brief It sets the value of the property, indicating its name.
185  */
186  void setDouble(const std::string& name, double value);
187 
188  /*!
189  \brief It sets the value of the i-th property.
190  */
191  void setNumeric(std::size_t i, const std::string& value);
192 
193  /*!
194  \brief It sets the value of the property, indicating its name.
195  */
196  void setNumeric(const std::string& name, const std::string& value);
197 
198  /*!
199  \brief It sets the value of the i-th property.
200  */
201  void setString(std::size_t i, const std::string& value);
202 
203  /*!
204  \brief It sets the value of the property, indicating its name.
205  */
206  void setString(const std::string& name, const std::string& value);
207 
208  /*!
209  \brief It sets the value of the i-th property.
210 
211  \note It will take the ownership of the given pointer.
212  */
213  void setByteArray(std::size_t i, te::dt::ByteArray* value);
214 
215  /*!
216  \brief It sets the value of the property, indicating its name.
217 
218  \note It will take the ownership of the given pointer.
219  */
220  void setByteArray(const std::string& name, te::dt::ByteArray* value);
221 
222  /*!
223  \brief It sets the value of the i-th property.
224 
225  \note It will take the ownership of the given pointer.
226  */
227  void setGeometry(std::size_t i, te::gm::Geometry* value);
228 
229  /*!
230  \brief It sets the value of the property, indicating its name.
231 
232  \note It will take the ownership of the given pointer.
233  */
234  void setGeometry(const std::string& name, te::gm::Geometry* value);
235 
236  /*!
237  \brief It sets the value of the i-th property.
238 
239  \note It will take the ownership of the given pointer.
240  */
241  void setRaster(std::size_t i, te::rst::Raster* value);
242 
243  /*!
244  \brief It sets the value of the property, indicating its name.
245  */
246  void setRaster(const std::string& name, te::rst::Raster* value);
247 
248  /*!
249  \brief It sets the value of the i-th property.
250 
251  \note It will take the ownership of the given pointer.
252  */
253  void setDateTime(std::size_t i, te::dt::DateTime* value);
254 
255  /*!
256  \brief It sets the value of the property, indicating its name.
257 
258  \note It will take the ownership of the given pointer.
259  */
260  void setDateTime(const std::string& name, te::dt::DateTime* value);
261 
262  /*!
263  \brief It sets the value of the i-th property.
264 
265  \note It will take the ownership of the given pointer.
266  */
267  void setValue(std::size_t i, te::dt::AbstractData* value);
268 
269  /*!
270  \brief It sets the value of the property, indicating its name.
271 
272  \note It will take the ownership of the given pointer.
273  */
274  void setValue(const std::string& name, te::dt::AbstractData* value);
275 
276  /*!
277  \brief Copies the values from the source dataSet item to the destination dataSet item by matching the column names. If a column from the source does not exist in the destination, it will not be copied
278  */
279  void copyValuesFrom(const te::da::DataSetItem* source, bool copyGeometries = true);
280  };
281  } // end namespace mem
282 } // end namespace te
283 
284 #endif // __TERRALIB_MEMORY_INTERNAL_DATASETITEM_H
te::dt::ByteArray
A class for representing binary data.
Definition: ByteArray.h:52
te::mem::DataSetItem::setDouble
void setDouble(const std::string &name, double value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setInt16
void setInt16(std::size_t i, boost::int16_t value)
It sets the value of the i-th property.
te::mem::DataSetItem::setChar
void setChar(std::size_t i, char value)
It sets the value of the i-th property.
te::mem::DataSetItem::setDateTime
void setDateTime(std::size_t i, te::dt::DateTime *value)
It sets the value of the i-th property.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::mem::DataSetItem::setNumeric
void setNumeric(std::size_t i, const std::string &value)
It sets the value of the i-th property.
te::mem::DataSetItem::setString
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
te::mem::DataSetItem::setBool
void setBool(const std::string &name, bool value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setString
void setString(const std::string &name, const std::string &value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::operator=
DataSetItem & operator=(const DataSetItem &rhs)
Assignment operator.
te::rst::Raster
An abstract class for raster data strucutures.
Definition: Raster.h:72
te::mem::DataSetItem::setInt32
void setInt32(const std::string &name, boost::int32_t value)
It sets the value of the property, indicating its name.
te::dt::DateTime
Definition: DateTime.h:56
te::mem::DataSetItem::setGeometry
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
te::mem::DataSetItem::copyValuesFrom
void copyValuesFrom(const te::da::DataSetItem *source, bool copyGeometries=true)
Copies the values from the source dataSet item to the destination dataSet item by matching the column...
te::mem::DataSetItem::setDateTime
void setDateTime(const std::string &name, te::dt::DateTime *value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setChar
void setChar(const std::string &name, char value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::DataSetItem
DataSetItem(const te::da::DataSet *dataSet)
It creates a new item having the same schema as the parent dataset.
te::mem::DataSetItem::setDouble
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
te::mem::DataSetItem::setInt64
void setInt64(std::size_t i, boost::int64_t value)
It sets the value of the i-th property.
te::mem::DataSetItem::DataSetItem
DataSetItem(const std::vector< std::string > &vecNames, const std::vector< int > &vecTypes)
te::mem::DataSetItem::setRaster
void setRaster(const std::string &name, te::rst::Raster *value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setUChar
void setUChar(std::size_t i, unsigned char value)
It sets the value of the i-th property.
te::mem::DataSetItem::setNumeric
void setNumeric(const std::string &name, const std::string &value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::DataSetItem
DataSetItem(const te::da::DataSetType *dataSetType)
It creates a new item having the same schema as the dataset type.
te::mem::DataSetItem::setInt32
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
te::mem::DataSetItem
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
Definition: DataSetItem.h:55
te::mem::DataSetItem::setInt16
void setInt16(const std::string &name, boost::int16_t value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setInt64
void setInt64(const std::string &name, boost::int64_t value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setBool
void setBool(std::size_t i, bool value)
It sets the value of the i-th property.
te::mem::DataSetItem::clone
virtual te::da::DataSetItem * clone() const override
It returns a clone of the DataSetItem.
te::dt::AbstractData
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:56
TEMEMORYEXPORT
#define TEMEMORYEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:84
te::mem::DataSetItem::setRaster
void setRaster(std::size_t i, te::rst::Raster *value)
It sets the value of the i-th property.
te::mem::DataSetItem::setByteArray
void setByteArray(const std::string &name, te::dt::ByteArray *value)
It sets the value of the property, indicating its name.
te::da::DataSetItem
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
Definition: DataSetItem.h:59
te::mem::DataSetItem::setValue
void setValue(const std::string &name, te::dt::AbstractData *value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::~DataSetItem
virtual ~DataSetItem()
Destructor.
te::da::DataSet
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:114
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::mem::DataSetItem::setGeometry
void setGeometry(const std::string &name, te::gm::Geometry *value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setFloat
void setFloat(const std::string &name, float value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setFloat
void setFloat(std::size_t i, float value)
It sets the value of the i-th property.
te::da::DataSetType
A class that models the description of a dataset.
Definition: DataSetType.h:73
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::mem::DataSetItem::DataSetItem
DataSetItem(const DataSetItem &rhs)
It creates a new item by cloning the values in the source item (rhs).
te::mem::DataSetItem::setByteArray
void setByteArray(std::size_t i, te::dt::ByteArray *value)
It sets the value of the i-th property.
te::mem::DataSetItem::setUChar
void setUChar(const std::string &name, unsigned char value)
It sets the value of the property, indicating its name.
te::mem::DataSetItem::setValue
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.