diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-10-28 18:13:13 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-10-28 18:13:13 +0100 |
commit | 0d757e1dcf3cf1518ae2fce9e8864dcc55d14d3a (patch) | |
tree | ada292c63b93aa469e761aee448b121f2ec47a50 /src/debugspew.h | |
parent | 3cf9c3c9d076d5822595834bdbf5153d4e923c67 (diff) | |
download | lanes-0d757e1dcf3cf1518ae2fce9e8864dcc55d14d3a.tar.gz lanes-0d757e1dcf3cf1518ae2fce9e8864dcc55d14d3a.tar.bz2 lanes-0d757e1dcf3cf1518ae2fce9e8864dcc55d14d3a.zip |
Renamed debugspew.h → debugspew.hpp, lindafactory.h → lindafactory.hpp
Diffstat (limited to 'src/debugspew.h')
-rw-r--r-- | src/debugspew.h | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/debugspew.h b/src/debugspew.h deleted file mode 100644 index 1eb5556..0000000 --- a/src/debugspew.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "lanesconf.h" | ||
4 | #include "universe.hpp" | ||
5 | |||
6 | // ################################################################################################# | ||
7 | |||
8 | #if USE_DEBUG_SPEW() | ||
9 | |||
10 | class DebugSpewIndentScope | ||
11 | { | ||
12 | private: | ||
13 | Universe* const U{}; | ||
14 | |||
15 | public: | ||
16 | static std::string_view const debugspew_indent; | ||
17 | |||
18 | DebugSpewIndentScope(Universe* U_) | ||
19 | : U{ U_ } | ||
20 | { | ||
21 | if (U) { | ||
22 | U->debugspewIndentDepth.fetch_add(1, std::memory_order_relaxed); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | ~DebugSpewIndentScope() | ||
27 | { | ||
28 | if (U) { | ||
29 | U->debugspewIndentDepth.fetch_sub(1, std::memory_order_relaxed); | ||
30 | } | ||
31 | } | ||
32 | }; | ||
33 | |||
34 | // ################################################################################################# | ||
35 | |||
36 | inline std::string_view DebugSpewIndent(Universe const* const U_) | ||
37 | { | ||
38 | return DebugSpewIndentScope::debugspew_indent.substr(0, static_cast<size_t>(U_->debugspewIndentDepth.load(std::memory_order_relaxed))); | ||
39 | } | ||
40 | |||
41 | inline auto& DebugSpew(Universe const* const U_) | ||
42 | { | ||
43 | if (!U_) { | ||
44 | return std::cerr; | ||
45 | } | ||
46 | return std::cerr << DebugSpewIndent(U_) << " "; | ||
47 | } | ||
48 | #define DEBUGSPEW_CODE(_code) _code | ||
49 | #define DEBUGSPEW_OR_NOT(a_, b_) a_ | ||
50 | #define DEBUGSPEW_PARAM_COMMA(param_) param_, | ||
51 | #define DEBUGSPEW_COMMA_PARAM(param_) , param_ | ||
52 | |||
53 | #else // USE_DEBUG_SPEW() | ||
54 | |||
55 | #define DEBUGSPEW_CODE(_code) | ||
56 | #define DEBUGSPEW_OR_NOT(a_, b_) b_ | ||
57 | #define DEBUGSPEW_PARAM_COMMA(param_) | ||
58 | #define DEBUGSPEW_COMMA_PARAM(param_) | ||
59 | |||
60 | #endif // USE_DEBUG_SPEW() | ||