OpenMS
latest
nightly
RC_GHA
3.3.0
3.2.0
3.1.0
3.0.0
2.8.0
2.7.0
2.6.0
2.5.0-shortNms
2.5.0
2.4.0
2.3.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
openms/include/OpenMS/CONCEPT/Macros.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: Timo Sachsenberg$
6
// $Authors: Marc Sturm $
7
// --------------------------------------------------------------------------
8
9
#pragma once
10
11
12
#include <OpenMS/config.h>
13
#include <
OpenMS/CONCEPT/Exception.h
>
14
15
#include <string>
16
#include <cstring>
17
24
#define STRINGIFY(a) #a
25
26
#ifdef _OPENMP
27
28
// Pragma string literals are compiler-specific:
29
// gcc and clang use _Pragma while MSVS uses __pragma
30
// the MSVS pragma does not need a string token somehow.
31
#ifdef OPENMS_COMPILER_MSVC
32
#define OPENMS_THREAD_CRITICAL(name) \
33
__pragma(omp critical (name))
34
#else
35
#define OPENMS_THREAD_CRITICAL(name) \
36
_Pragma( STRINGIFY( omp critical (name) ) )
37
#endif
38
39
#else
40
41
#define OPENMS_THREAD_CRITICAL(name)
42
43
#endif
44
// end of helpers
46
47
63
#ifdef OPENMS_ASSERTIONS
64
70
#define OPENMS_PRECONDITION(condition, message) \
71
if (!(condition)) \
72
{ \
73
throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, # condition " "
# message); \
74
} \
75
81
#define OPENMS_POSTCONDITION(condition, message) \
82
if (!(condition)) \
83
{ \
84
throw Exception::Postcondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, # condition " "
# message); \
85
} \
86
87
#else
88
94
#define OPENMS_PRECONDITION(condition, message)
95
101
#define OPENMS_POSTCONDITION(condition, message)
102
103
#endif
104
// end of Conditions
106
Exception.h
OpenMS
CONCEPT
Macros.h
Generated on Mon Jan 27 2025 13:01:24 for OpenMS by
1.9.1