VTK  9.3.20240420
vtkOutputWindow.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
38#ifndef vtkOutputWindow_h
39#define vtkOutputWindow_h
40
41#include "vtkCommonCoreModule.h" // For export macro
42#include "vtkDebugLeaksManager.h" // Must be included before singletons
43#include "vtkDeprecation.h" // For `VTK_DEPRECATED_IN_9_3_0`
44#include "vtkObject.h"
45
46VTK_ABI_NAMESPACE_BEGIN
48 "`vtkOutputWindowCleanup` is no longer necessary") VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
49{
50public:
53
54private:
56 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
57};
58
59class vtkOutputWindowPrivateAccessor;
60class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
61{
62public:
63 // Methods from vtkObject
64 vtkTypeMacro(vtkOutputWindow, vtkObject);
68 void PrintSelf(ostream& os, vtkIndent indent) override;
69
76
85 static void SetInstance(vtkOutputWindow* instance);
86
88
95 virtual void DisplayText(const char*);
96 virtual void DisplayErrorText(const char*);
97 virtual void DisplayWarningText(const char*);
98 virtual void DisplayGenericWarningText(const char*);
99 virtual void DisplayDebugText(const char*);
101
103
112 vtkBooleanMacro(PromptUser, bool);
113 vtkSetMacro(PromptUser, bool);
115
117
142 {
143 DEFAULT = -1,
144 NEVER = 0,
145 ALWAYS = 1,
146 ALWAYS_STDERR = 2
147 };
148 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
149 vtkGetMacro(DisplayMode, int);
150 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
151 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
152 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
155protected:
158
160 {
165 MESSAGE_TYPE_DEBUG
166 };
167
173 vtkGetMacro(CurrentMessageType, MessageTypes);
174
175 enum class StreamType
176 {
177 Null,
178 StdOutput,
179 StdError,
180 };
181
187
189
190private:
191 std::atomic<MessageTypes> CurrentMessageType;
192 int DisplayMode;
193 std::atomic<int> InStandardMacros; // used to suppress display to output streams from standard
194 // macros when logging is enabled.
195
196 friend class vtkOutputWindowPrivateAccessor;
197
198 vtkOutputWindow(const vtkOutputWindow&) = delete;
199 void operator=(const vtkOutputWindow&) = delete;
200};
201
202VTK_ABI_NAMESPACE_END
203#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
vtkOutputWindowCleanup()=default
~vtkOutputWindowCleanup()=default
base class for writing debug output to a console
virtual void DisplayGenericWarningText(const char *)
Display the text.
void SetDisplayModeToAlways()
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
void SetDisplayModeToNever()
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
virtual StreamType GetDisplayStream(MessageTypes msgType) const
Returns the standard output stream to post the message of the given type on.
void SetDisplayModeToAlwaysStdErr()
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
DisplayModes
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
void PrintSelf(ostream &os, vtkIndent indent) override
Print ObjectFactor to stream.
static vtkOutputWindow * GetInstance()
Return the singleton instance with no reference counting.
static vtkOutputWindow * New()
Creates a new instance of vtkOutputWindow.
void SetDisplayModeToDefault()
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
~vtkOutputWindow() override
virtual void DisplayDebugText(const char *)
Display the text.
static void SetInstance(vtkOutputWindow *instance)
Supply a user defined output window.
virtual void DisplayWarningText(const char *)
Display the text.
virtual void DisplayText(const char *)
Display the text.
virtual void DisplayErrorText(const char *)
Display the text.
#define VTK_DEPRECATED_IN_9_3_0(reason)