All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataTypeCapabilities.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/dataaccess/datasource/DataTypeCapabilities.cpp
22 
23  \brief A class that represents the supported data types of a specific data source.
24 */
25 
26 // TerraLib
27 #include "DataTypeCapabilities.h"
28 
30 {
31  m_types[te::dt::BIT_TYPE] = false;
32  m_types[te::dt::CHAR_TYPE] = false;
33  m_types[te::dt::UCHAR_TYPE] = false;
34  m_types[te::dt::INT16_TYPE] = false;
36  m_types[te::dt::INT32_TYPE] = false;
38  m_types[te::dt::INT64_TYPE] = false;
41  m_types[te::dt::FLOAT_TYPE] = false;
48  m_types[te::dt::ARRAY_TYPE] = false;
52  m_types[te::dt::XML_TYPE] = false;
53 
54  // No listed on TerraLib Wiki
60 }
61 
63 {
64 }
65 
67 {
68  return supports(te::dt::BIT_TYPE);
69 }
70 
72 {
73  setSupport(te::dt::BIT_TYPE, support);
74 }
75 
77 {
78  return supports(te::dt::CHAR_TYPE);
79 }
80 
82 {
83  setSupport(te::dt::CHAR_TYPE, support);
84 }
85 
87 {
88  return supports(te::dt::UCHAR_TYPE);
89 }
90 
92 {
93  setSupport(te::dt::UCHAR_TYPE, support);
94 }
95 
97 {
98  return supports(te::dt::INT16_TYPE);
99 }
100 
102 {
103  setSupport(te::dt::INT16_TYPE, support);
104 }
105 
107 {
108  return supports(te::dt::UINT16_TYPE);
109 }
110 
112 {
113  setSupport(te::dt::UINT16_TYPE, support);
114 }
115 
117 {
118  return supports(te::dt::INT32_TYPE);
119 }
120 
122 {
123  setSupport(te::dt::INT32_TYPE, support);
124 }
125 
127 {
128  return supports(te::dt::UINT32_TYPE);
129 }
130 
132 {
133  setSupport(te::dt::UINT32_TYPE, support);
134 }
135 
137 {
138  return supports(te::dt::INT64_TYPE);
139 }
140 
142 {
143  setSupport(te::dt::INT64_TYPE, support);
144 }
145 
147 {
148  return supports(te::dt::UINT64_TYPE);
149 }
150 
152 {
153  setSupport(te::dt::UINT64_TYPE, support);
154 }
155 
157 {
158  return supports(te::dt::BOOLEAN_TYPE);
159 }
160 
162 {
163  setSupport(te::dt::BOOLEAN_TYPE, support);
164 }
165 
167 {
168  return supports(te::dt::FLOAT_TYPE);
169 }
170 
172 {
173  setSupport(te::dt::FLOAT_TYPE, support);
174 }
175 
177 {
178  return supports(te::dt::DOUBLE_TYPE);
179 }
180 
182 {
183  setSupport(te::dt::DOUBLE_TYPE, support);
184 }
185 
187 {
188  return supports(te::dt::NUMERIC_TYPE);
189 }
190 
192 {
193  setSupport(te::dt::NUMERIC_TYPE, support);
194 }
195 
197 {
198  return supports(te::dt::STRING_TYPE);
199 }
200 
202 {
203  setSupport(te::dt::STRING_TYPE, support);
204 }
205 
207 {
208  return supports(te::dt::BYTE_ARRAY_TYPE);
209 }
210 
212 {
213  setSupport(te::dt::BYTE_ARRAY_TYPE, support);
214 }
215 
217 {
218  return supports(te::dt::GEOMETRY_TYPE);
219 }
220 
222 {
223  setSupport(te::dt::GEOMETRY_TYPE, support);
224 }
225 
227 {
228  return supports(te::dt::DATETIME_TYPE);
229 }
230 
232 {
233  setSupport(te::dt::DATETIME_TYPE, support);
234 }
235 
237 {
238  return supports(te::dt::ARRAY_TYPE);
239 }
240 
242 {
243  setSupport(te::dt::ARRAY_TYPE, support);
244 }
245 
247 {
248  return supports(te::dt::COMPOSITE_TYPE);
249 }
250 
252 {
253  setSupport(te::dt::COMPOSITE_TYPE, support);
254 }
255 
257 {
258  return supports(te::dt::RASTER_TYPE);
259 }
260 
262 {
263  setSupport(te::dt::RASTER_TYPE, support);
264 }
265 
267 {
268  return supports(te::dt::DATASET_TYPE);
269 }
270 
272 {
273  setSupport(te::dt::DATASET_TYPE, support);
274 }
275 
277 {
278  return supports(te::dt::XML_TYPE);
279 }
280 
282 {
283  setSupport(te::dt::XML_TYPE, support);
284 }
285 
287 {
288  return supports(te::dt::CINT16_TYPE);
289 }
290 
292 {
293  setSupport(te::dt::CINT16_TYPE, support);
294 }
295 
297 {
298  return supports(te::dt::CINT32_TYPE);
299 }
300 
302 {
303  setSupport(te::dt::CINT32_TYPE, support);
304 }
305 
307 {
308  return supports(te::dt::CFLOAT_TYPE);
309 }
310 
312 {
313  setSupport(te::dt::CFLOAT_TYPE, support);
314 }
315 
317 {
318  return supports(te::dt::CDOUBLE_TYPE);
319 }
320 
322 {
323  setSupport(te::dt::CDOUBLE_TYPE, support);
324 }
325 
327 {
328  return supports(te::dt::POLYMORPHIC_TYPE);
329 }
330 
332 {
333  setSupport(te::dt::POLYMORPHIC_TYPE, support);
334 }
335 
336 bool te::da::DataTypeCapabilities::supports(const int& type) const
337 {
338  std::map<int, bool>::const_iterator it = m_types.find(type);
339  if(it != m_types.end())
340  return it->second;
341 
342  return false;
343 }
344 
345 void te::da::DataTypeCapabilities::setSupport(const int& type, const bool& support)
346 {
347  m_types[type] = support;
348 }
349 
351 {
352  std::map<int, bool>::iterator it;
353  for(it = m_types.begin(); it != m_types.end(); ++it)
354  it->second = true;
355 }
356 
357 void te::da::DataTypeCapabilities::addHint(const int& type, const int& hint)
358 {
359  m_hints[type] = hint;
360 }
361 
362 int te::da::DataTypeCapabilities::getHint(const int& type) const
363 {
364  std::map<int, int>::const_iterator it = m_hints.find(type);
365 
366  if(it != m_hints.end())
367  return it->second;
368 
369  return te::dt::UNKNOWN_TYPE;
370 }
void setSupportFloat(const bool &support)
void setSupportString(const bool &support)
void setSupportBoolean(const bool &support)
int getHint(const int &type) const
void setSupportGeometry(const bool &support)
void setSupportNumeric(const bool &support)
void setSupportInt64(const bool &support)
void setSupport(const int &type, const bool &support)
void setSupportDouble(const bool &support)
void setSupportByteArray(const bool &support)
void setSupportUInt16(const bool &support)
void setSupportBit(const bool &support)
void setSupportUChar(const bool &support)
void setSupportComposite(const bool &support)
void setSupportChar(const bool &support)
void setSupportRaster(const bool &support)
void setSupportPolymorphic(const bool &support)
void setSupportCFloat(const bool &support)
void setSupportCInt32(const bool &support)
void setSupportUInt64(const bool &support)
void setSupportInt32(const bool &support)
void setSupportXML(const bool &support)
bool supports(const int &type) const
std::map< int, bool > m_types
A map that indicates the supported data types.
void setSupportInt16(const bool &support)
void setSupportDateTime(const bool &support)
void setSupportDataset(const bool &support)
void addHint(const int &type, const int &hint)
void setSupportArray(const bool &support)
A class that represents the supported data types of a specific data source.
void setSupportCDouble(const bool &support)
void setSupportUInt32(const bool &support)
void setSupportCInt16(const bool &support)