35 #ifndef OPENMS_CONCEPT_TYPES_H
36 #define OPENMS_CONCEPT_TYPES_H
38 #include <OpenMS/config.h>
50 #ifdef OPENMS_HAS_STDINT_H
61 typedef OPENMS_INT32_TYPE
Int32;
68 typedef OPENMS_INT64_TYPE
Int64;
137 typedef OPENMS_UINT64_TYPE
UID;
221 template <
typename FloatingPo
intType>
228 return std::numeric_limits<float>::digits10;
235 return std::numeric_limits<double>::digits10;
242 return std::numeric_limits<int>::digits10;
249 return std::numeric_limits<unsigned int>::digits10;
256 return std::numeric_limits<int>::digits10;
263 return std::numeric_limits<unsigned int>::digits10;
271 return std::numeric_limits<double>::digits10;
293 #ifndef OPENMS_WINDOWSPLATFORM
294 return std::numeric_limits<long double>::digits10;
297 return std::numeric_limits<double>::digits10;
303 template <
typename FloatingPo
intType>
307 return FloatingPointType::Sorry_but_writtenDigits_is_designed_to_work_for_floating_point_types_only;
312 template <
typename FloatingPo
intType>
357 template <
typename FloatingPo
intType>
364 template <
typename FloatingPo
intType>
365 inline std::ostream & operator<<(std::ostream & os, const PrecisionWrapper<FloatingPointType> & rhs)
368 if (rhs.ref_ != rhs.ref_)
376 const std::streamsize prec_save = os.precision();
377 return os << std::setprecision(
writtenDigits(FloatingPointType()))
378 << rhs.
ref_ << std::setprecision(prec_save);
428 template <
typename Type>
431 #ifndef OPENMS_COMPILER_GXX
432 return "[ Sorry, OpenMS::typeAsString() relies upon GNU extension __PRETTY_FUNCTION__ ]";
435 std::string pretty(__PRETTY_FUNCTION__);
436 static char const context_left[] =
"with Type =";
437 static char const context_right[] =
"]";
438 size_t left = pretty.find(context_left);
439 left +=
sizeof(context_left);
440 size_t right = pretty.rfind(context_right);
444 return pretty.substr(left, right - left);
461 #endif // OPENMS_CONCEPT_TYPES_H
float Real
Real type.
Definition: Types.h:109
Int writtenDigits< DataValue >(const DataValue &)
DataValue will be printed like double.
Definition: Types.h:269
unsigned int UInt
Unsigned integer type.
Definition: Types.h:92
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:304
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:151
const char * OpenMS_locale
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:226
std::string typeAsString(const Type &=Type())
Returns the Type as as std::string.
Definition: Types.h:429
Int writtenDigits< int >(const int &)
We do not want to bother people who unintentionally provide an int argument to this.
Definition: Types.h:240
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:254
const PrecisionWrapper< FloatingPointType > precisionWrapper(const FloatingPointType rhs)
Wrapper function that sets the appropriate precision for output temporarily. The original precision i...
Definition: Types.h:358
OPENMS_INT32_TYPE Int32
Signed integer type (32bit)
Definition: Types.h:61
ASCII
Definition: Types.h:153
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:75
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:261
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
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:247
OPENMS_INT64_TYPE Int64
Signed integer type (64bit)
Definition: Types.h:68
OPENMS_BYTE_TYPE Byte
Byte type.
Definition: Types.h:128
PrecisionWrapper(const FloatingPointType rhs)
Constructor. Note: Normally you will prefer to use the "make"-function precisionWrapper(), which see.
Definition: Types.h:316
Int writtenDigits< double >(const double &)
Number of digits commonly used for writing a double (a.k.a. precision).
Definition: Types.h:233
Wrapper class to implement output with appropriate precision. See precisionWrapper().
Definition: Types.h:313
int Int
Signed integer type.
Definition: Types.h:100
Int writtenDigits< long double >(const long double &)
Number of digits commonly used for writing a long double (a.k.a. precision). ...
Definition: Types.h:291
time_t Time
Time type.
Definition: Types.h:84
OPENMS_UINT64_TYPE UID
A unique object ID (as unsigned 64bit type).
Definition: Types.h:137
FloatingPointType const ref_
Definition: Types.h:320
PrecisionWrapper(const PrecisionWrapper &rhs)
Definition: Types.h:318
double DoubleReal
Double-precision real type.
Definition: Types.h:118