10#ifndef LIBCWD_CLASS_DEBUG_H
11#define LIBCWD_CLASS_DEBUG_H
16#include "DebugObject_ThreadSpecificData.h"
28#ifndef HIDE_FROM_DOXYGEN
36 mutable std::mutex state_mutex_;
39 LockInterfaceBase* mutex_{};
47 LockInterfaceBase* replace_with(std::ostream* os, LockInterfaceBase* new_mutex);
53 void set_ostream(std::ostream* os);
59 std::ostream* read_real_os()
const;
62 bool has_mutex()
const;
68 std::ostream* get_locked_os(std::ostream* os, LockInterfaceBase** locked_mutex_out)
const;
78 bool try_lock_os(std::ostream* os, std::ostream** locked_os_out, LockInterfaceBase** locked_mutex_out)
const;
84 void write_color_off_newline(std::ostream* os,
char const* color_off, std::size_t color_off_size)
const;
111 friend void DebugObject_ThreadSpecificData::start(
DebugObject&, ChannelSetData&, LIBCWD_TSD_PARAM);
112 friend void DebugObject_ThreadSpecificData::finish(
DebugObject&, ChannelSetData&, LIBCWD_TSD_PARAM);
121 static int s_index_count_;
128 friend class libcwd::Buffer;
129 _private_::OstreamState ostream_state_;
132 Buffer* unfinished_oss_;
133 void const* newlineless_tsd_;
144 bool being_initialized_;
156 std::atomic<int> always_flush_{0};
227 bool has_mutex()
const;
234 friend class Channel;
235 friend class FatalChannel;
236 friend void ST_initialize_globals(LIBCWD_TSD_PARAM);
238 friend bool dwarf::ensure_initialization(LIBCWD_TSD_PARAM);
240 bool NS_init(LIBCWD_TSD_PARAM);
272#if CWDEBUG_DEBUGOUTPUT
277 void force_on(OnOffState& state);
278 void restore(OnOffState
const& state);
279 bool is_on(LIBCWD_TSD_PARAM)
const;
280 bool always_flush_is_on()
const;
285#include "set_ostream.inl.h"
void always_flush_on()
Turn always-flush for this debug object on.
Definition DebugObject.inl.h:287
void on()
Cancel last call to off().
Definition DebugObject.inl.h:266
DebugObject()
Constructor.
Definition DebugObject.inl.h:223
void off()
Turn this debug object off.
Definition DebugObject.inl.h:237
void always_flush_off()
Cancel last call to always_flush_on().
Definition DebugObject.inl.h:306
A string class used for the debug output margin and marker.
Definition DebugString.h:34
void set_ostream(std::ostream *os)
Set output device (single threaded applications).
Definition debug.cxx:1601
std::ostream * get_ostream() const
Get the ostream device as set with set_ostream().
Definition DebugObject.inl.h:117