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 
65 {
66  return supports(te::dt::BIT_TYPE);
67 }
68 
70 {
71  setSupport(te::dt::BIT_TYPE, support);
72 }
73 
75 {
77 }
78 
80 {
81  setSupport(te::dt::CHAR_TYPE, support);
82 }
83 
85 {
87 }
88 
90 {
92 }
93 
95 {
97 }
98 
100 {
101  setSupport(te::dt::INT16_TYPE, support);
102 }
103 
105 {
107 }
108 
110 {
112 }
113 
115 {
117 }
118 
120 {
121  setSupport(te::dt::INT32_TYPE, support);
122 }
123 
125 {
127 }
128 
130 {
132 }
133 
135 {
137 }
138 
140 {
141  setSupport(te::dt::INT64_TYPE, support);
142 }
143 
145 {
147 }
148 
150 {
152 }
153 
155 {
157 }
158 
160 {
162 }
163 
165 {
167 }
168 
170 {
171  setSupport(te::dt::FLOAT_TYPE, support);
172 }
173 
175 {
177 }
178 
180 {
182 }
183 
185 {
187 }
188 
190 {
192 }
193 
195 {
197 }
198 
200 {
202 }
203 
205 {
207 }
208 
210 {
212 }
213 
215 {
217 }
218 
220 {
222 }
223 
225 {
227 }
228 
230 {
232 }
233 
235 {
237 }
238 
240 {
241  setSupport(te::dt::ARRAY_TYPE, support);
242 }
243 
245 {
247 }
248 
250 {
252 }
253 
255 {
257 }
258 
260 {
262 }
263 
265 {
267 }
268 
270 {
272 }
273 
275 {
276  return supports(te::dt::XML_TYPE);
277 }
278 
280 {
281  setSupport(te::dt::XML_TYPE, support);
282 }
283 
285 {
287 }
288 
290 {
292 }
293 
295 {
297 }
298 
300 {
302 }
303 
305 {
307 }
308 
310 {
312 }
313 
315 {
317 }
318 
320 {
322 }
323 
325 {
327 }
328 
330 {
332 }
333 
334 bool te::da::DataTypeCapabilities::supports(const int& type) const
335 {
336  std::map<int, bool>::const_iterator it = m_types.find(type);
337  if(it != m_types.end())
338  return it->second;
339 
340  return false;
341 }
342 
343 void te::da::DataTypeCapabilities::setSupport(const int& type, const bool& support)
344 {
345  m_types[type] = support;
346 }
347 
349 {
350  std::map<int, bool>::iterator it;
351  for(it = m_types.begin(); it != m_types.end(); ++it)
352  it->second = true;
353 }
354 
355 void te::da::DataTypeCapabilities::addHint(const int& type, const int& hint)
356 {
357  m_hints[type] = hint;
358 }
359 
360 int te::da::DataTypeCapabilities::getHint(const int& type) const
361 {
362  std::map<int, int>::const_iterator it = m_hints.find(type);
363 
364  if(it != m_hints.end())
365  return it->second;
366 
367  return te::dt::UNKNOWN_TYPE;
368 }
void setSupportFloat(const bool &support)
void setSupportString(const bool &support)
void setSupportBoolean(const bool &support)
~DataTypeCapabilities()
Destructor.
int getHint(const int &type) const
void setSupportGeometry(const bool &support)
void setSupportNumeric(const bool &support)
std::map< int, int > m_hints
A map that indicates a type hint to a given type.
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)