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