All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Utils.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/datatype/Utils.cpp
22 
23  \brief Utilitary function for data type module.
24 */
25 
26 // TerraLib
27 #include "CompositeProperty.h"
28 #include "Property.h"
29 #include "Utils.h"
30 
31 void te::dt::GetPropertiesPosition(const std::vector<Property*>& properties,
32  const CompositeProperty* cp,
33  std::vector<std::size_t>& poslist)
34 {
35  const std::size_t size = properties.size();
36 
37  for(std::size_t i = 0; i < size; ++i)
38  poslist.push_back(cp->getPropertyPosition(properties[i]));
39 }
40 
41 int te::dt::Convert2Terralib(const std::string& dataType)
42 {
43  if(dataType == "VOID_TYPE")
44  return te::dt::VOID_TYPE;
45  else if(dataType == "BIT_TYPE")
46  return te::dt::BIT_TYPE;
47  else if(dataType == "CHAR_TYPE")
48  return te::dt::CHAR_TYPE;
49  else if(dataType == "UCHAR_TYPE")
50  return te::dt::UCHAR_TYPE;
51  else if(dataType == "INT16_TYPE")
52  return te::dt::INT16_TYPE;
53  else if(dataType == "INT32_TYPE")
54  return te::dt::INT32_TYPE;
55  else if(dataType == "UINT32_TYPE")
56  return te::dt::UINT32_TYPE;
57  else if(dataType == "INT64_TYPE")
58  return te::dt::INT64_TYPE;
59  else if(dataType == "UINT64_TYPE")
60  return te::dt::UINT64_TYPE;
61  else if(dataType == "BOOLEAN_TYPE")
62  return te::dt::BOOLEAN_TYPE;
63  else if(dataType == "FLOAT_TYPE")
64  return te::dt::FLOAT_TYPE;
65  else if(dataType == "DOUBLE_TYPE")
66  return te::dt::DOUBLE_TYPE;
67  else if(dataType == "NUMERIC_TYPE")
68  return te::dt::NUMERIC_TYPE;
69  else if(dataType == "STRING_TYPE")
70  return te::dt::STRING_TYPE;
71  else if(dataType == "BYTE_ARRAY_TYPE")
73  else if(dataType == "GEOMETRY_TYPE")
74  return te::dt::GEOMETRY_TYPE;
75  else if(dataType == "DATETIME_TYPE")
76  return te::dt::DATETIME_TYPE;
77  else if(dataType == "ARRAY_TYPE")
78  return te::dt::ARRAY_TYPE;
79  else if(dataType == "COMPOSITE_TYPE")
81  else if(dataType == "DATASET_TYPE")
82  return te::dt::DATASET_TYPE;
83  else if(dataType == "RASTER_TYPE")
84  return te::dt::RASTER_TYPE;
85  else if(dataType == "CINT16_TYPE")
86  return te::dt::UNKNOWN_TYPE;
87  else if(dataType == "CINT32_TYPE")
88  return te::dt::CINT32_TYPE;
89  else if(dataType == "CFLOAT_TYPE")
90  return te::dt::CFLOAT_TYPE;
91  else if(dataType == "CDOUBLE_TYPE")
92  return te::dt::CDOUBLE_TYPE;
93  else if(dataType == "XML_TYPE")
94  return te::dt::XML_TYPE;
95  else if(dataType == "DATASETITEM_TYPE")
97  else if(dataType == "POLYMORPHIC_TYPE")
99  else if(dataType == "R4BITS_TYPE")
100  return te::dt::UNKNOWN_TYPE;
101  else if(dataType == "R4BITS_TYPE")
102  return te::dt::UNKNOWN_TYPE;
103  else if(dataType == "R2BITS_TYPE")
104  return te::dt::R2BITS_TYPE;
105  else if(dataType == "R1BIT_TYPE")
106  return te::dt::R1BIT_TYPE;
107  else
108  return te::dt::UNKNOWN_TYPE;
109 }
TEDATATYPEEXPORT int Convert2Terralib(const std::string &dataType)
It convert a string to a DataType.
Definition: Utils.cpp:41
Utilitary function for data type module.
A base class for a compound properties (non-atomic properties).
TEDATATYPEEXPORT void GetPropertiesPosition(const std::vector< Property * > &properties, const CompositeProperty *cp, std::vector< std::size_t > &poslist)
It creates a list with the properties position in the composite property.
Definition: Utils.cpp:31
std::size_t getPropertyPosition(const std::string &name) const
It returns the property position based on its name.
A base class for a compound property (non-atomic properties).
It models a property definition.