IntegerConverters.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/datatype/IntegerConverters.h
22 
23  \brief A set of function that convert an Integer type to other types.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_INTEGERCONVERTERS_H
27 #define __TERRALIB_DATATYPE_INTERNAL_INTEGERCONVERTERS_H
28 
29 // TerraLib
30 #include "Exception.h"
31 #include "Config.h"
32 
33 namespace te
34 {
35  namespace dt
36  {
37 // Forward declarations
38  class AbstractData;
39 
40  /** @name Int32 Methods
41  * Methods related to Int32 conversion.
42  */
43  //@{
44 
45  /*!
46  \brief It converts an Int32 data value to a char data value.
47 
48  \param d The input data value.
49 
50  \return A new data value converted to char data type. The caller will take the ownership of the returned data.
51 
52  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
53  */
54  TEDATATYPEEXPORT AbstractData* Int32ToCharConverter(AbstractData* d) throw(Exception);
55 
56  /*!
57  \brief It converts an Int32 data value to an unsigned char data value.
58 
59  \param d The input data value.
60 
61  \return A new data value converted to unsigned char data type. The caller will take the ownership of the returned data.
62 
63  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
64  */
65  TEDATATYPEEXPORT AbstractData* Int32ToUCharConverter(AbstractData* d) throw(Exception);
66 
67  /*!
68  \brief It converts an Int32 data value to a Int16 data value.
69 
70  \param d The input data value.
71 
72  \return A new data value converted to Int16 data type. The caller will take the ownership of the returned data.
73 
74  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
75  */
76  TEDATATYPEEXPORT AbstractData* Int32ToInt16Converter(AbstractData* d) throw(Exception);
77 
78  /*!
79  \brief It converts an Int32 data value to an unsigned Int16 data value.
80 
81  \param d The input data value.
82 
83  \return A new data value converted to unsigned Int16 data type. The caller will take the ownership of the returned data.
84 
85  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
86  */
87  TEDATATYPEEXPORT AbstractData* Int32ToUInt16Converter(AbstractData* d) throw(Exception);
88 
89  /*!
90  \brief It converts an Int32 data value to an unsigned Int32 data value.
91 
92  \param d The input data value.
93 
94  \return A new data value converted to unsigned Int32 data type. The caller will take the ownership of the returned data.
95 
96  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
97  */
98  TEDATATYPEEXPORT AbstractData* Int32ToUInt32Converter(AbstractData* d) throw(Exception);
99 
100  /*!
101  \brief It converts an Int32 data value to a Int64 data value.
102 
103  \param d The input data value.
104 
105  \return A new data value converted to Int64 data type. The caller will take the ownership of the returned data.
106 
107  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
108  */
109  TEDATATYPEEXPORT AbstractData* Int32ToInt64Converter(AbstractData* d) throw(Exception);
110 
111  /*!
112  \brief It converts an Int32 data value to an unsigned Int64 data value.
113 
114  \param d The input data value.
115 
116  \return A new data value converted to unsigned Int64 data type. The caller will take the ownership of the returned data.
117 
118  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
119  */
120  TEDATATYPEEXPORT AbstractData* Int32ToUInt64Converter(AbstractData* d) throw(Exception);
121 
122  /*!
123  \brief It converts an Int32 data value to a boolean data value.
124 
125  \param d The input data value.
126 
127  \return A new data value converted to boolean data type. The caller will take the ownership of the returned data.
128 
129  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
130  */
131  TEDATATYPEEXPORT AbstractData* Int32ToBooleanConverter(AbstractData* d) throw(Exception);
132 
133  /*!
134  \brief It converts an Int32 data value to a float value.
135 
136  \param d The input data value.
137 
138  \return A new data value converted to float data type. The caller will take the ownership of the returned data.
139 
140  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
141  */
142  TEDATATYPEEXPORT AbstractData* Int32ToFloatConverter(AbstractData* d) throw(Exception);
143 
144  /*!
145  \brief It converts an Int32 data value to a double value.
146 
147  \param d The input data value.
148 
149  \return A new data value converted to double data type. The caller will take the ownership of the returned data.
150 
151  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
152  */
153  TEDATATYPEEXPORT AbstractData* Int32ToDoubleConverter(AbstractData* d) throw(Exception);
154 
155  /*!
156  \brief It converts an Int32 data value to Numeric data value.
157 
158  \param d The input data value.
159 
160  \return A new data value converted to Numeric data type. The caller will take the ownership of the returned data.
161 
162  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
163  */
164  TEDATATYPEEXPORT AbstractData* Int32ToNumericConverter(AbstractData* d) throw(Exception);
165 
166  /*!
167  \brief It converts an Int32 data value to a string data value.
168 
169  \param d The input data value.
170 
171  \return A new data value converted to string data type. The caller will take the ownership of the returned data.
172 
173  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
174  */
175  TEDATATYPEEXPORT AbstractData* Int32ToStringConverter(AbstractData* d) throw(Exception);
176 
177  /*!
178  \brief Auxiliary method that asserts that the given data is an Int32 type.
179 
180  \param d The input data value.
181 
182  \exception Exception It throws an exception if the input abstract data is not an Int32 type.
183  */
184  TEDATATYPEEXPORT void AssertInt32(AbstractData* d) throw(Exception);
185 
186  //@}
187 
188  /** @name UInt32 Methods
189  * Methods related to unsigned Int32 conversion.
190  */
191  //@{
192 
193  /*!
194  \brief It converts an unsigned Int32 data value to a char data value.
195 
196  \param d The input data value.
197 
198  \return A new data value converted to char data type. The caller will take the ownership of the returned data.
199 
200  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
201  */
202  TEDATATYPEEXPORT AbstractData* UInt32ToCharConverter(AbstractData* d) throw(Exception);
203 
204  /*!
205  \brief It converts an unsigned Int32 data value to an unsigned char data value.
206 
207  \param d The input data value.
208 
209  \return A new data value converted to unsigned char data type. The caller will take the ownership of the returned data.
210 
211  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
212  */
213  TEDATATYPEEXPORT AbstractData* UInt32ToUCharConverter(AbstractData* d) throw(Exception);
214 
215  /*!
216  \brief It converts an unsigned Int32 data value to a Int16 data value.
217 
218  \param d The input data value.
219 
220  \return A new data value converted to Int16 data type. The caller will take the ownership of the returned data.
221 
222  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
223  */
224  TEDATATYPEEXPORT AbstractData* UInt32ToInt16Converter(AbstractData* d) throw(Exception);
225 
226  /*!
227  \brief It converts an unsigned Int32 data value to an unsigned Int16 data value.
228 
229  \param d The input data value.
230 
231  \return A new data value converted to unsigned Int16 data type. The caller will take the ownership of the returned data.
232 
233  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
234  */
235  TEDATATYPEEXPORT AbstractData* UInt32ToUInt16Converter(AbstractData* d) throw(Exception);
236 
237  /*!
238  \brief It converts an unsigned Int32 data value to an Int32 data value.
239 
240  \param d The input data value.
241 
242  \return A new data value converted to Int32 data type. The caller will take the ownership of the returned data.
243 
244  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
245  */
246  TEDATATYPEEXPORT AbstractData* UInt32ToInt32Converter(AbstractData* d) throw(Exception);
247 
248  /*!
249  \brief It converts an unsigned Int32 data value to a Int64 data value.
250 
251  \param d The input data value.
252 
253  \return A new data value converted to Int64 data type. The caller will take the ownership of the returned data.
254 
255  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
256  */
257  TEDATATYPEEXPORT AbstractData* UInt32ToInt64Converter(AbstractData* d) throw(Exception);
258 
259  /*!
260  \brief It converts an unsigned Int32 data value to an unsigned Int64 data value.
261 
262  \param d The input data value.
263 
264  \return A new data value converted to unsigned Int64 data type. The caller will take the ownership of the returned data.
265 
266  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
267  */
268  TEDATATYPEEXPORT AbstractData* UInt32ToUInt64Converter(AbstractData* d) throw(Exception);
269 
270  /*!
271  \brief It converts an unsigned Int32 data value to a boolean data value.
272 
273  \param d The input data value.
274 
275  \return A new data value converted to boolean data type. The caller will take the ownership of the returned data.
276 
277  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
278  */
279  TEDATATYPEEXPORT AbstractData* UInt32ToBooleanConverter(AbstractData* d) throw(Exception);
280 
281  /*!
282  \brief It converts an unsigned Int32 data value to a float value.
283 
284  \param d The input data value.
285 
286  \return A new data value converted to float data type. The caller will take the ownership of the returned data.
287 
288  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
289  */
290  TEDATATYPEEXPORT AbstractData* UInt32ToFloatConverter(AbstractData* d) throw(Exception);
291 
292  /*!
293  \brief It converts an unsigned Int32 data value to a double value.
294 
295  \param d The input data value.
296 
297  \return A new data value converted to double data type. The caller will take the ownership of the returned data.
298 
299  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
300  */
301  TEDATATYPEEXPORT AbstractData* UInt32ToDoubleConverter(AbstractData* d) throw(Exception);
302 
303  /*!
304  \brief It converts an unsigned Int32 data value to Numeric data value.
305 
306  \param d The input data value.
307 
308  \return A new data value converted to Numeric data type. The caller will take the ownership of the returned data.
309 
310  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
311  */
312  TEDATATYPEEXPORT AbstractData* UInt32ToNumericConverter(AbstractData* d) throw(Exception);
313 
314  /*!
315  \brief It converts an unsigned Int32 data value to a string data value.
316 
317  \param d The input data value.
318 
319  \return A new data value converted to string data type. The caller will take the ownership of the returned data.
320 
321  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
322  */
323  TEDATATYPEEXPORT AbstractData* UInt32ToStringConverter(AbstractData* d) throw(Exception);
324 
325  /*!
326  \brief Auxiliary method that asserts that the given data is an unsigned Int32 type.
327 
328  \param d The input data value.
329 
330  \exception Exception It throws an exception if the input abstract data is not an unsigned Int32 type.
331  */
332  TEDATATYPEEXPORT void AssertUInt32(AbstractData* d) throw(Exception);
333 
334  //@}
335 
336  } // end namespace dt
337 } // end namespace te
338 
339 #endif // __TERRALIB_DATATYPE_INTERNAL_INTEGERCONVERTERS_H
TEDATATYPEEXPORT AbstractData * UInt32ToInt16Converter(AbstractData *d)
It converts an unsigned Int32 data value to a Int16 data value.
TEDATATYPEEXPORT AbstractData * UInt32ToNumericConverter(AbstractData *d)
It converts an unsigned Int32 data value to Numeric data value.
An exception class for the DataType module.
TEDATATYPEEXPORT void AssertInt32(AbstractData *d)
Auxiliary method that asserts that the given data is an Int32 type.
TEDATATYPEEXPORT AbstractData * Int32ToBooleanConverter(AbstractData *d)
It converts an Int32 data value to a boolean data value.
TEDATATYPEEXPORT AbstractData * UInt32ToFloatConverter(AbstractData *d)
It converts an unsigned Int32 data value to a float value.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
TEDATATYPEEXPORT void AssertUInt32(AbstractData *d)
Auxiliary method that asserts that the given data is an unsigned Int32 type.
Configuration flags for the DataType module of TerraLib.
TEDATATYPEEXPORT AbstractData * Int32ToDoubleConverter(AbstractData *d)
It converts an Int32 data value to a double value.
TEDATATYPEEXPORT AbstractData * UInt32ToStringConverter(AbstractData *d)
It converts an unsigned Int32 data value to a string data value.
URI C++ Library.
TEDATATYPEEXPORT AbstractData * Int32ToStringConverter(AbstractData *d)
It converts an Int32 data value to a string data value.
TEDATATYPEEXPORT AbstractData * UInt32ToDoubleConverter(AbstractData *d)
It converts an unsigned Int32 data value to a double value.
TEDATATYPEEXPORT AbstractData * UInt32ToInt32Converter(AbstractData *d)
It converts an unsigned Int32 data value to an Int32 data value.
TEDATATYPEEXPORT AbstractData * Int32ToCharConverter(AbstractData *d)
It converts an Int32 data value to a char data value.
TEDATATYPEEXPORT AbstractData * Int32ToNumericConverter(AbstractData *d)
It converts an Int32 data value to Numeric data value.
TEDATATYPEEXPORT AbstractData * UInt32ToCharConverter(AbstractData *d)
It converts an unsigned Int32 data value to a char data value.
TEDATATYPEEXPORT AbstractData * Int32ToUCharConverter(AbstractData *d)
It converts an Int32 data value to an unsigned char data value.
TEDATATYPEEXPORT AbstractData * Int32ToInt16Converter(AbstractData *d)
It converts an Int32 data value to a Int16 data value.
TEDATATYPEEXPORT AbstractData * UInt32ToUInt16Converter(AbstractData *d)
It converts an unsigned Int32 data value to an unsigned Int16 data value.
TEDATATYPEEXPORT AbstractData * UInt32ToBooleanConverter(AbstractData *d)
It converts an unsigned Int32 data value to a boolean data value.
TEDATATYPEEXPORT AbstractData * Int32ToUInt16Converter(AbstractData *d)
It converts an Int32 data value to an unsigned Int16 data value.
TEDATATYPEEXPORT AbstractData * UInt32ToUInt64Converter(AbstractData *d)
It converts an unsigned Int32 data value to an unsigned Int64 data value.
TEDATATYPEEXPORT AbstractData * UInt32ToUCharConverter(AbstractData *d)
It converts an unsigned Int32 data value to an unsigned char data value.
TEDATATYPEEXPORT AbstractData * Int32ToUInt64Converter(AbstractData *d)
It converts an Int32 data value to an unsigned Int64 data value.
TEDATATYPEEXPORT AbstractData * Int32ToFloatConverter(AbstractData *d)
It converts an Int32 data value to a float value.
TEDATATYPEEXPORT AbstractData * UInt32ToInt64Converter(AbstractData *d)
It converts an unsigned Int32 data value to a Int64 data value.
TEDATATYPEEXPORT AbstractData * Int32ToInt64Converter(AbstractData *d)
It converts an Int32 data value to a Int64 data value.
TEDATATYPEEXPORT AbstractData * Int32ToUInt32Converter(AbstractData *d)
It converts an Int32 data value to an unsigned Int32 data value.