OpenMS
Types.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Oliver Kohlbacher $
6 // $Authors: Marc Sturm, Clemens Groepl $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/config.h>
12 
13 #include <ctime>
14 #include <cstddef> // for size_t & ptrdiff_t
15 #include <limits>
16 
17 #include <cstdint> // since C++11
18 
19 namespace OpenMS
20 {
26  typedef int32_t Int32;
27 
33  typedef uint32_t UInt32;
34 
40  typedef int64_t Int64;
41 
47  typedef uint64_t UInt64;
48 
56  typedef time_t Time;
57 
63  //typedef size_t UInt;
64  typedef unsigned int UInt;
65 
71  //typedef OPENMS_SIZE_T_SIGNED Int;
72  typedef int Int;
73 
81  typedef uint8_t Byte;
82 
90  typedef uint64_t UID;
91 
97  typedef size_t Size;
98 
104  typedef ptrdiff_t SignedSize;
105 
106  enum ASCII
107  {
109  ASCII__BELL = '\a',
117 
123  ASCII__SEMICOLON = ';'
124  };
125 
127 
170 
171 
177  template <typename FloatingPointType>
178  inline constexpr Int writtenDigits(const FloatingPointType& /* unused */ = FloatingPointType());
179 
181  template <>
182  inline constexpr Int writtenDigits<float>(const float&)
183  {
184  return std::numeric_limits<float>::digits10;
185  }
186 
188  template <>
189  inline constexpr Int writtenDigits<double>(const double&)
190  {
191  return std::numeric_limits<double>::digits10;
192  }
193 
195  template <>
196  inline constexpr Int writtenDigits<int>(const int&)
197  {
198  return std::numeric_limits<int>::digits10;
199  }
200 
202  template <>
203  inline constexpr Int writtenDigits<unsigned int>(const unsigned int&)
204  {
205  return std::numeric_limits<unsigned int>::digits10;
206  }
207 
209  template <>
210  inline constexpr Int writtenDigits<long int>(const long int&)
211  {
212  return std::numeric_limits<int>::digits10;
213  }
214 
216  template <>
217  inline constexpr Int writtenDigits<unsigned long int>(const unsigned long int&)
218  {
219  return std::numeric_limits<unsigned int>::digits10;
220  }
221 
222  class DataValue;
224  template <>
225  inline constexpr Int writtenDigits<DataValue>(const DataValue&)
226  {
227  return std::numeric_limits<double>::digits10;
228  }
229 
230  /*
231  META-COMMENT: DO NOT INTRODUCE ANY LINEBREAKS BELOW IN
232  "<code>std::numeric_limits<long double>::digits10 == 18</code>".
233  The doxygen parser (version 1.5.5) will get confused! (Clemens)
234  */
235 
247  template <>
248  inline constexpr Int writtenDigits<long double>(const long double&)
249  {
250 #ifndef OPENMS_WINDOWSPLATFORM
251  return std::numeric_limits<long double>::digits10;
252 
253 #else
254  return std::numeric_limits<double>::digits10;
255 
256 #endif
257  }
258 
263  template <typename FloatingPointType>
264  inline constexpr Int writtenDigits(const FloatingPointType& /* unused */)
265  {
266  return 6;
267  }
268 
269  namespace Internal
270  {
277  extern OPENMS_DLLAPI const char* OpenMS_locale;
278  }
279 
280 } // namespace OpenMS
281 
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:33
int32_t Int32
Signed integer type (32bit)
Definition: Types.h:26
int64_t Int64
Signed integer type (64bit)
Definition: Types.h:40
uint8_t Byte
Byte type.
Definition: Types.h:81
int Int
Signed integer type.
Definition: Types.h:72
uint32_t UInt32
Unsigned integer type (32bit)
Definition: Types.h:33
uint64_t UID
A unique object ID (as unsigned 64bit type).
Definition: Types.h:90
uint64_t UInt64
Unsigned integer type (64bit)
Definition: Types.h:47
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:104
time_t Time
Time type.
Definition: Types.h:56
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
const char * OpenMS_locale
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
ASCII
Definition: Types.h:107
@ ASCII__EXCLAMATION_MARK
Definition: Types.h:120
@ ASCII__HORIZONTAL_TAB
Definition: Types.h:111
@ ASCII__BACKSPACE
Definition: Types.h:108
@ ASCII__RETURN
Definition: Types.h:113
@ ASCII__NEWLINE
Definition: Types.h:112
@ ASCII__SEMICOLON
Definition: Types.h:123
@ ASCII__TAB
Definition: Types.h:115
@ ASCII__COMMA
Definition: Types.h:119
@ ASCII__COLON
Definition: Types.h:118
@ ASCII__BELL
Definition: Types.h:109
@ ASCII__SPACE
Definition: Types.h:114
@ ASCII__POINT
Definition: Types.h:121
@ ASCII__QUESTION_MARK
Definition: Types.h:122
@ ASCII__CARRIAGE_RETURN
Definition: Types.h:110
@ ASCII__VERTICAL_TAB
Definition: Types.h:116
constexpr 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:210
constexpr Int writtenDigits< float >(const float &)
Number of digits commonly used for writing a float (a.k.a. precision).
Definition: Types.h:182
constexpr Int writtenDigits< long double >(const long double &)
Number of digits commonly used for writing a long double (a.k.a. precision). ...
Definition: Types.h:248
constexpr 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:217
constexpr Int writtenDigits< DataValue >(const DataValue &)
DataValue will be printed like double.
Definition: Types.h:225
constexpr Int writtenDigits< double >(const double &)
Number of digits commonly used for writing a double (a.k.a. precision).
Definition: Types.h:189
constexpr 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:203
constexpr Int writtenDigits< int >(const int &)
We do not want to bother people who unintentionally provide an int argument to this.
Definition: Types.h:196
constexpr Int writtenDigits(const FloatingPointType &=FloatingPointType())
Number of digits commonly used for writing a floating point type (a.k.a. precision)....
Definition: Types.h:264