Loading [MathJax]/extensions/tex2jax.js
Tomographerv4.1
Tomographer C++ Framework Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cxxdefs.h
Go to the documentation of this file.
1 /* This file is part of the Tomographer project, which is distributed under the
2  * terms of the MIT license.
3  *
4  * The MIT License (MIT)
5  *
6  * Copyright (c) 2016 ETH Zurich, Institute for Theoretical Physics, Philippe Faist
7  * Copyright (c) 2017 Caltech, Institute for Quantum Information and Matter, Philippe Faist
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a copy
10  * of this software and associated documentation files (the "Software"), to deal
11  * in the Software without restriction, including without limitation the rights
12  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13  * copies of the Software, and to permit persons to whom the Software is
14  * furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included in
17  * all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  */
27 
28 #ifndef TOMOGRAPHER_TOOLS_DEFS_H
29 #define TOMOGRAPHER_TOOLS_DEFS_H
30 
39 #include <cassert>
40 #include <cstddef>
41 #include <cstdlib>
42 
43 
44 // NOTE: DO NOT INCLUDE EIGEN HEADERS IN THIS FILE! For instance eigen_assert_exception.h
45 // depends on cxxutil.h not including any Eigen headers.
46 
47 
48 
49 
50 // -----------------------------------------------------------------------------
51 // Some general useful definitions
52 // -----------------------------------------------------------------------------
53 
54 
55 //
56 // Included in front of all public symbols. If you need, you may define this to
57 // e.g. "__attribute__((visibility("default")))" or "__declspec(dllexport)" to export the
58 // definition in the library
59 //
60 #ifndef TOMOGRAPHER_EXPORT
61 #define TOMOGRAPHER_EXPORT
62 #endif
63 
64 
65 // -----------------------------------------------------------------------------
66 // Some C++ helpers
67 // -----------------------------------------------------------------------------
68 
69 
70 
76 #define TOMO_STATIC_ASSERT_EXPR(...) \
77  static_assert(__VA_ARGS__, #__VA_ARGS__)
78 
79 
80 #ifndef tomographer_assert
81 
83 #define tomographer_assert(...) eigen_assert((__VA_ARGS__) && "assert: " #__VA_ARGS__)
84 #endif
85 
86 
87 
88 #ifndef TOMOGRAPHER_PARSED_BY_DOXYGEN
89 // WARNING!!! CHECK OUT http://stackoverflow.com/q/29363532/1694896
90 // FOR VERY SUBTLE BUGS :( :( -- TEST WITH INTEL ICC!!
91 #define TOMOGRAPHER_ENABLED_IF(...) \
92  template<bool _dummy__enabledif = false, \
93  typename std::enable_if<_dummy__enabledif || (__VA_ARGS__), bool>::type \
94  _dummy__enabledif2 = false>
95 #define TOMOGRAPHER_ENABLED_IF_TMPL(...) \
96  bool _dummy__enabledif = false, \
97  typename std::enable_if<_dummy__enabledif || (__VA_ARGS__), bool>::type \
98  _dummy__enabledif2 = true
99 
106 #define TOMOGRAPHER_ENABLED_IF_TMPL_REPEAT(...) \
107  bool _dummy__enabledif, \
108  typename std::enable_if<_dummy__enabledif || (__VA_ARGS__), bool>::type \
109  _dummy__enabledifAlt2 = true
110 #endif
111 
112 
113 
114 
115 
116 
117 
118 #endif