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-2017.
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_UINT32_TYPE UInt32;
65 
71  typedef OPENMS_INT64_TYPE Int64;
72 
78  typedef OPENMS_UINT64_TYPE UInt64;
79 
87  typedef time_t Time;
88 
94  //typedef size_t UInt;
95  typedef unsigned int UInt;
96 
102  //typedef OPENMS_SIZE_T_SIGNED Int;
103  typedef int Int;
104 
112  typedef OPENMS_BYTE_TYPE Byte;
113 
121  typedef OPENMS_UINT64_TYPE UID;
122 
128  typedef size_t Size;
129 
135  typedef ptrdiff_t SignedSize;
136 
137  enum ASCII
138  {
140  ASCII__BELL = '\a',
148 
155  };
156 
158 
201 
202 
208  template <typename FloatingPointType>
209  inline Int writtenDigits(const FloatingPointType& /* unused */ = FloatingPointType());
210 
212  template <>
213  inline Int writtenDigits<float>(const float&)
214  {
215  return std::numeric_limits<float>::digits10;
216  }
217 
219  template <>
220  inline Int writtenDigits<double>(const double&)
221  {
222  return std::numeric_limits<double>::digits10;
223  }
224 
226  template <>
227  inline Int writtenDigits<int>(const int&)
228  {
229  return std::numeric_limits<int>::digits10;
230  }
231 
233  template <>
234  inline Int writtenDigits<unsigned int>(const unsigned int&)
235  {
236  return std::numeric_limits<unsigned int>::digits10;
237  }
238 
240  template <>
241  inline Int writtenDigits<long int>(const long int&)
242  {
243  return std::numeric_limits<int>::digits10;
244  }
245 
247  template <>
248  inline Int writtenDigits<unsigned long int>(const unsigned long int&)
249  {
250  return std::numeric_limits<unsigned int>::digits10;
251  }
252 
253  class DataValue;
255  template <>
257  {
258  return std::numeric_limits<double>::digits10;
259  }
260 
261  /*
262  META-COMMENT: DO NOT INTRODUCE ANY LINEBREAKS BELOW IN
263  "<code>std::numeric_limits<long double>::digits10 == 18</code>".
264  The doxygen parser (version 1.5.5) will get confused! (Clemens)
265  */
266 
278  template <>
279  inline Int writtenDigits<long double>(const long double&)
280  {
281 #ifndef OPENMS_WINDOWSPLATFORM
282  return std::numeric_limits<long double>::digits10;
283 
284 #else
285  return std::numeric_limits<double>::digits10;
286 
287 #endif
288  }
289 
294  template <typename FloatingPointType>
295  inline Int writtenDigits(const FloatingPointType& /* unused */)
296  {
297  return 6;
298  }
299 
300  namespace Internal
301  {
308  extern OPENMS_DLLAPI const char* OpenMS_locale;
309  }
310 
311 } // namespace OpenMS
312 
313 #endif // OPENMS_CONCEPT_TYPES_H
Definition: Types.h:139
Int writtenDigits< DataValue >(const DataValue &)
DataValue will be printed like double.
Definition: Types.h:256
Definition: Types.h:152
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
Definition: Types.h:151
Definition: Types.h:145
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:295
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
const char * OpenMS_locale
Definition: Types.h:154
Definition: Types.h:143
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Definition: Types.h:140
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:213
Definition: Types.h:141
Definition: Types.h:147
Int writtenDigits< int >(const int &)
We do not want to bother people who unintentionally provide an int argument to this.
Definition: Types.h:227
Definition: Types.h:142
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:241
OPENMS_INT32_TYPE Int32
Signed integer type (32bit)
Definition: Types.h:57
OPENMS_UINT32_TYPE UInt32
Unsigned integer type (32bit)
Definition: Types.h:64
ASCII
Definition: Types.h:137
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:78
Definition: Types.h:149
Definition: Types.h:150
Definition: Types.h:144
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:248
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
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:234
OPENMS_INT64_TYPE Int64
Signed integer type (64bit)
Definition: Types.h:71
OPENMS_BYTE_TYPE Byte
Byte type.
Definition: Types.h:112
Definition: Types.h:153
Int writtenDigits< double >(const double &)
Number of digits commonly used for writing a double (a.k.a. precision).
Definition: Types.h:220
int Int
Signed integer type.
Definition: Types.h:103
Int writtenDigits< long double >(const long double &)
Number of digits commonly used for writing a long double (a.k.a. precision). ...
Definition: Types.h:279
time_t Time
Time type.
Definition: Types.h:87
OPENMS_UINT64_TYPE UID
A unique object ID (as unsigned 64bit type).
Definition: Types.h:121
Definition: Types.h:146

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13