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
16#ifndef vtkOutputWindow_h
17#define vtkOutputWindow_h
18
19#include "vtkCommonCoreModule.h" // For export macro
20#include "vtkDebugLeaksManager.h" // Must be included before singletons
21#include "vtkDeprecation.h" // For `VTK_DEPRECATED_IN_9_3_0`
22#include "vtkObject.h"
23
24VTK_ABI_NAMESPACE_BEGIN
26 "`vtkOutputWindowCleanup` is no longer necessary") VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
27{
28public:
31
32private:
34 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
35};
36
37class vtkOutputWindowPrivateAccessor;
38class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
39{
40public:
41 // Methods from vtkObject
42 vtkTypeMacro(vtkOutputWindow, vtkObject);
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
54
63 static void SetInstance(vtkOutputWindow* instance);
64
66
73 virtual void DisplayText(const char*);
74 virtual void DisplayErrorText(const char*);
75 virtual void DisplayWarningText(const char*);
76 virtual void DisplayGenericWarningText(const char*);
77 virtual void DisplayDebugText(const char*);
79
81
90 vtkBooleanMacro(PromptUser, bool);
91 vtkSetMacro(PromptUser, bool);
93
95
120 {
121 DEFAULT = -1,
122 NEVER = 0,
123 ALWAYS = 1,
124 ALWAYS_STDERR = 2
125 };
126 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
127 vtkGetMacro(DisplayMode, int);
128 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
129 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
130 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
133protected:
136
138 {
143 MESSAGE_TYPE_DEBUG
144 };
145
151 vtkGetMacro(CurrentMessageType, MessageTypes);
152
153 enum class StreamType
154 {
155 Null,
156 StdOutput,
157 StdError,
158 };
159
165
167
168private:
169 std::atomic<MessageTypes> CurrentMessageType;
170 int DisplayMode;
171 std::atomic<int> InStandardMacros; // used to suppress display to output streams from standard
172 // macros when logging is enabled.
173
174 friend class vtkOutputWindowPrivateAccessor;
175
176 vtkOutputWindow(const vtkOutputWindow&) = delete;
177 void operator=(const vtkOutputWindow&) = delete;
178};
179
180VTK_ABI_NAMESPACE_END
181#endif
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:49
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)