BooleanConverters.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/BooleanConverters.h
22 
23  \brief A set of function that convert an Boolean type to other types.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_BOOLEANCONVERTERS_H
27 #define __TERRALIB_DATATYPE_INTERNAL_BOOLEANCONVERTERS_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 Boolean Methods
40  * Methods related to Boolean conversion.
41  */
42  //@{
43 
44  /*!
45  \brief It converts an Boolean 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 a Boolean type.
52  */
53  AbstractData* BooleanToCharConverter(AbstractData* d) throw(Exception);
54 
55  /*!
56  \brief It converts an Boolean 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 a Boolean type.
63  */
64  AbstractData* BooleanToUCharConverter(AbstractData* d) throw(Exception);
65 
66  /*!
67  \brief It converts an Boolean 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 a Boolean type.
74  */
75  AbstractData* BooleanToInt16Converter(AbstractData* d) throw(Exception);
76 
77  /*!
78  \brief It converts an Boolean 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 a Boolean type.
85  */
86  AbstractData* BooleanToUInt16Converter(AbstractData* d) throw(Exception);
87 
88  /*!
89  \brief It converts an Boolean data value to a Int32 data value.
90 
91  \param d The input data value.
92 
93  \return A new data value converted to 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 a Boolean type.
96  */
97  AbstractData* BooleanToInt32Converter(AbstractData* d) throw(Exception);
98 
99  /*!
100  \brief It converts an Boolean data value to an unsigned Int32 data value.
101 
102  \param d The input data value.
103 
104  \return A new data value converted to unsigned Int32 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 a Boolean type.
107  */
108  AbstractData* BooleanToUInt32Converter(AbstractData* d) throw(Exception);
109 
110  /*!
111  \brief It converts an Boolean data value to a Int64 data value.
112 
113  \param d The input data value.
114 
115  \return A new data value converted to 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 a Boolean type.
118  */
119  AbstractData* BooleanToInt64Converter(AbstractData* d) throw(Exception);
120 
121  /*!
122  \brief It converts an Boolean data value to an unsigned Int64 data value.
123 
124  \param d The input data value.
125 
126  \return A new data value converted to unsigned Int64 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 a Boolean type.
129  */
130  AbstractData* BooleanToUInt64Converter(AbstractData* d) throw(Exception);
131 
132  /*!
133  \brief It converts an Boolean data value to a float data 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 a Boolean type.
140  */
141  AbstractData* BooleanToFloatConverter(AbstractData* d) throw(Exception);
142 
143  /*!
144  \brief It converts an Boolean data value to a double data 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 a Boolean type.
151  */
152  AbstractData* BooleanToDoubleConverter(AbstractData* d) throw(Exception);
153 
154  /*!
155  \brief It converts an Boolean data value to a 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 a Boolean type.
162  */
163  AbstractData* BooleanToNumericConverter(AbstractData* d) throw(Exception);
164 
165  /*!
166  \brief It converts an Boolean 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 a Boolean type.
173  */
174  AbstractData* BooleanToStringConverter(AbstractData* d) throw(Exception);
175 
176  /*!
177  \brief Auxiliary method that asserts that the given data is an Boolean type.
178 
179  \param d The input data value.
180 
181  \exception Exception It throws an exception if the input abstract data is not a Boolean type.
182  */
183  void AssertBoolean(AbstractData* d) throw(Exception);
184 
185  //@}
186 
187  } // end namespace dt
188 } // end namespace te
189 
190 #endif // __TERRALIB_DATATYPE_INTERNAL_BOOLEANCONVERTERS_H
AbstractData * BooleanToCharConverter(AbstractData *d)
It converts an Boolean data value to a char data value.
AbstractData * BooleanToInt64Converter(AbstractData *d)
It converts an Boolean data value to a Int64 data value.
An exception class for the DataType module.
AbstractData * BooleanToDoubleConverter(AbstractData *d)
It converts an Boolean data value to a double data value.
AbstractData * BooleanToUInt32Converter(AbstractData *d)
It converts an Boolean data value to an unsigned Int32 data value.
void AssertBoolean(AbstractData *d)
Auxiliary method that asserts that the given data is an Boolean type.
AbstractData * BooleanToUInt16Converter(AbstractData *d)
It converts an Boolean data value to an unsigned Int16 data value.
AbstractData * BooleanToInt16Converter(AbstractData *d)
It converts an Boolean data value to a Int16 data value.
AbstractData * BooleanToStringConverter(AbstractData *d)
It converts an Boolean data value to a string data value.
URI C++ Library.
AbstractData * BooleanToFloatConverter(AbstractData *d)
It converts an Boolean data value to a float data value.
AbstractData * BooleanToUInt64Converter(AbstractData *d)
It converts an Boolean data value to an unsigned Int64 data value.
AbstractData * BooleanToNumericConverter(AbstractData *d)
It converts an Boolean data value to a Numeric data value.
AbstractData * BooleanToInt32Converter(AbstractData *d)
It converts an Boolean data value to a Int32 data value.
AbstractData * BooleanToUCharConverter(AbstractData *d)
It converts an Boolean data value to an unsigned char data value.