CppCommon  1.0.4.1
C++ Common Library
stack_trace_manager.h
Go to the documentation of this file.
1 
9 #ifndef CPPCOMMON_SYSTEM_STACK_TRACE_MANAGER_H
10 #define CPPCOMMON_SYSTEM_STACK_TRACE_MANAGER_H
11 
12 #include "errors/exceptions.h"
13 #include "utility/singleton.h"
14 
15 #include <memory>
16 
17 namespace CppCommon {
18 
20 
25 class StackTraceManager : public CppCommon::Singleton<StackTraceManager>
26 {
28 
29 public:
33 
36 
38 
42  static void Initialize();
44 
47  static void Cleanup();
48 
49 private:
50  class Impl;
51 
52  Impl& impl() noexcept { return reinterpret_cast<Impl&>(_storage); }
53  const Impl& impl() const noexcept { return reinterpret_cast<Impl const&>(_storage); }
54 
55  static const size_t StorageSize = 4;
56  static const size_t StorageAlign = 1;
57  alignas(StorageAlign) std::byte _storage[StorageSize];
58 
59  StackTraceManager();
60 };
61 
62 } // namespace CppCommon
63 
64 #endif // CPPCOMMON_SYSTEM_STACK_TRACE_MANAGER_H
Singleton template base class.
Definition: singleton.h:47
StackTraceManager & operator=(const StackTraceManager &)=delete
StackTraceManager(StackTraceManager &&)=delete
StackTraceManager(const StackTraceManager &)=delete
static void Initialize()
Initialize stack trace manager.
StackTraceManager & operator=(StackTraceManager &&)=delete
static void Cleanup()
Cleanup stack trace manager.
Exceptions definition.
C++ Common project definitions.
Definition: token_bucket.h:15
Singleton definition.