From 9de0b7f8937b7f6ce990132609f0b26851b31f2b Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 3 Jan 2025 15:36:22 +0100 Subject: Monitor CPU --- debug.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 debug.h (limited to 'debug.h') diff --git a/debug.h b/debug.h new file mode 100644 index 0000000..1965de0 --- /dev/null +++ b/debug.h @@ -0,0 +1,40 @@ +#pragma once + +#include +#include + +class debug_ostream +{ +public: + debug_ostream(): m_active(false) {} + + void activate() + { + m_active = true; + } + + void deactivate() + { + m_active = false; + } + + template + debug_ostream& operator<<(const T& arg) { + if (m_active) + std::cout << arg; + return *this; + } + + debug_ostream& operator<<( + std::basic_ostream& (*func) + (std::basic_ostream&) ) { + if (m_active) + std::cout << *func; + return *this; + } + +private: + bool m_active; +}; + +extern debug_ostream debug_cout; -- cgit v1.2.3