Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Types.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2015.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Oliver Kohlbacher $
32 // $Authors: Marc Sturm, Clemens Groepl $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_CONCEPT_TYPES_H
36 #define OPENMS_CONCEPT_TYPES_H
37 
38 #include <OpenMS/config.h>
39 
40 #include <ctime>
41 #include <cstddef> // for size_t & ptrdiff_t
42 #include <limits>
43 
44 // If possible use the ISO C99-compliant header stdint.h
45 // to define the portable integer types.
46 #ifdef OPENMS_HAS_STDINT_H
47 #include <stdint.h>
48 #endif
49 
50 namespace OpenMS
51 {
57  typedef OPENMS_INT32_TYPE Int32;
58 
64  typedef OPENMS_INT64_TYPE Int64;
65 
72 
80  typedef time_t Time;
81 
87  //typedef size_t UInt;
88  typedef unsigned int UInt;
89 
95  //typedef OPENMS_SIZE_T_SIGNED Int;
96  typedef int Int;
97 
105  typedef OPENMS_BYTE_TYPE Byte;
106 
115 
121  typedef size_t Size;
122 
128  typedef ptrdiff_t SignedSize;
129 
130  enum ASCII
131  {
133  ASCII__BELL = '\a',
141 
148  };
149 
151 
194 
195 
201  template <typename FloatingPointType>
202  inline Int writtenDigits(const FloatingPointType& /* unused */ = FloatingPointType());
203 
205  template <>
206  inline Int writtenDigits<float>(const float&)
207  {
208  return std::numeric_limits<float>::digits10;
209  }
210 
212  template <>
213  inline Int writtenDigits<double>(const double&)
214  {
215  return std::numeric_limits<double>::digits10;
216  }
217 
219  template <>
220  inline Int writtenDigits<int>(const int&)
221  {
222  return std::numeric_limits<int>::digits10;
223  }
224 
226  template <>
227  inline Int writtenDigits<unsigned int>(const unsigned int&)
228  {
229  return std::numeric_limits<unsigned int>::digits10;
230  }
231 
233  template <>
234  inline Int writtenDigits<long int>(const long int&)
235  {
236  return std::numeric_limits<int>::digits10;
237  }
238 
240  template <>
241  inline Int writtenDigits<unsigned long int>(const unsigned long int&)
242  {
243  return std::numeric_limits<unsigned int>::digits10;
244  }
245 
246  class DataValue;
248  template <>
250  {
251  return std::numeric_limits<double>::digits10;
252  }
253 
254  /*
255  META-COMMENT: DO NOT INTRODUCE ANY LINEBREAKS BELOW IN
256  "<code>std::numeric_limits<long double>::digits10 == 18</code>".
257  The doxygen parser (version 1.5.5) will get confused! (Clemens)
258  */
259 
271  template <>
272  inline Int writtenDigits<long double>(const long double&)
273  {
274 #ifndef OPENMS_WINDOWSPLATFORM
275  return std::numeric_limits<long double>::digits10;
276 
277 #else
278  return std::numeric_limits<double>::digits10;
279 
280 #endif
281  }
282 
287  template <typename FloatingPointType>
288  inline Int writtenDigits(const FloatingPointType& /* unused */)
289  {
290  return 6;
291  }
292 
293  namespace Internal
294  {
301  extern OPENMS_DLLAPI const char* OpenMS_locale;
302  }
303 
304 } // namespace OpenMS
305 
306 #endif // OPENMS_CONCEPT_TYPES_H
Definition: Types.h:132
Int writtenDigits< DataValue >(const DataValue &)
DataValue will be printed like double.
Definition: Types.h:249
Definition: Types.h:145
unsigned int UInt
Unsigned integer type.
Definition: Types.h:88
Definition: Types.h:144
Definition: Types.h:138
Int writtenDigits(const FloatingPointType &=FloatingPointType())
Number of digits commonly used for writing a floating point type (a.k.a. precision). Specializations are defined for float, double, long double.
Definition: Types.h:288
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:128
const char * OpenMS_locale
Definition: Types.h:147
Definition: Types.h:136
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Definition: Types.h:133
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:57
Int writtenDigits< float >(const float &)
Number of digits commonly used for writing a float (a.k.a. precision).
Definition: Types.h:206
Definition: Types.h:134
Definition: Types.h:140
Int writtenDigits< int >(const int &)
We do not want to bother people who unintentionally provide an int argument to this.
Definition: Types.h:220
Definition: Types.h:135
Int writtenDigits< long int >(const long int &)
We do not want to bother people who unintentionally provide a long int argument to this...
Definition: Types.h:234
OPENMS_INT32_TYPE Int32
Signed integer type (32bit)
Definition: Types.h:57
ASCII
Definition: Types.h:130
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:71
Definition: Types.h:142
Definition: Types.h:143
Definition: Types.h:137
Int writtenDigits< unsigned long int >(const unsigned long int &)
We do not want to bother people who unintentionally provide an unsigned long int argument to this...
Definition: Types.h:241
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:121
Int writtenDigits< unsigned int >(const unsigned int &)
We do not want to bother people who unintentionally provide an unsigned int argument to this...
Definition: Types.h:227
OPENMS_INT64_TYPE Int64
Signed integer type (64bit)
Definition: Types.h:64
OPENMS_BYTE_TYPE Byte
Byte type.
Definition: Types.h:105
Definition: Types.h:146
Int writtenDigits< double >(const double &)
Number of digits commonly used for writing a double (a.k.a. precision).
Definition: Types.h:213
int Int
Signed integer type.
Definition: Types.h:96
Int writtenDigits< long double >(const long double &)
Number of digits commonly used for writing a long double (a.k.a. precision). ...
Definition: Types.h:272
time_t Time
Time type.
Definition: Types.h:80
OPENMS_UINT64_TYPE UID
A unique object ID (as unsigned 64bit type).
Definition: Types.h:114
Definition: Types.h:139

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 12:49:26 using doxygen 1.8.11