VTK  9.3.0
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
25#ifndef vtkOutputWindow_h
26#define vtkOutputWindow_h
27
28#include "vtkCommonCoreModule.h" // For export macro
29#include "vtkDebugLeaksManager.h" // Must be included before singletons
30#include "vtkDeprecation.h" // For `VTK_DEPRECATED_IN_9_3_0`
31#include "vtkObject.h"
32
33VTK_ABI_NAMESPACE_BEGIN
35 "`vtkOutputWindowCleanup` is no longer necessary") VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
36{
37public:
40
41private:
43 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
44};
45
46class vtkOutputWindowPrivateAccessor;
47class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
48{
49public:
50 // Methods from vtkObject
51 vtkTypeMacro(vtkOutputWindow, vtkObject);
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
63
72 static void SetInstance(vtkOutputWindow* instance);
73
75
82 virtual void DisplayText(const char*);
83 virtual void DisplayErrorText(const char*);
84 virtual void DisplayWarningText(const char*);
85 virtual void DisplayGenericWarningText(const char*);
86 virtual void DisplayDebugText(const char*);
88
90
99 vtkBooleanMacro(PromptUser, bool);
100 vtkSetMacro(PromptUser, bool);
102
104
129 {
130 DEFAULT = -1,
131 NEVER = 0,
132 ALWAYS = 1,
133 ALWAYS_STDERR = 2
134 };
135 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
136 vtkGetMacro(DisplayMode, int);
137 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
138 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
139 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
142protected:
145
147 {
152 MESSAGE_TYPE_DEBUG
153 };
154
160 vtkGetMacro(CurrentMessageType, MessageTypes);
161
162 enum class StreamType
163 {
164 Null,
165 StdOutput,
166 StdError,
167 };
168
174
176
177private:
178 std::atomic<MessageTypes> CurrentMessageType;
179 int DisplayMode;
180 std::atomic<int> InStandardMacros; // used to suppress display to output streams from standard
181 // macros when logging is enabled.
182
183 friend class vtkOutputWindowPrivateAccessor;
184
185 vtkOutputWindow(const vtkOutputWindow&) = delete;
186 void operator=(const vtkOutputWindow&) = delete;
187};
188
189VTK_ABI_NAMESPACE_END
190#endif
a simple class to control print indentation
Definition vtkIndent.h:38
abstract base class for most VTK objects
Definition vtkObject.h:58
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)