VTK  9.5.2
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 "vtkObject.h"
22
23VTK_ABI_NAMESPACE_BEGIN
24class vtkOutputWindowPrivateAccessor;
25class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
26{
27public:
28 // Methods from vtkObject
29 vtkTypeMacro(vtkOutputWindow, vtkObject);
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
41
50 static void SetInstance(vtkOutputWindow* instance);
51
53
60 virtual void DisplayText(const char*);
61 virtual void DisplayErrorText(const char*);
62 virtual void DisplayWarningText(const char*);
63 virtual void DisplayGenericWarningText(const char*);
64 virtual void DisplayDebugText(const char*);
66
68
77 vtkBooleanMacro(PromptUser, bool);
78 vtkSetMacro(PromptUser, bool);
80
82
107 {
108 DEFAULT = -1,
109 NEVER = 0,
110 ALWAYS = 1,
111 ALWAYS_STDERR = 2
112 };
113 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
114 vtkGetMacro(DisplayMode, int);
115 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
116 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
117 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
120protected:
123
125 {
130 MESSAGE_TYPE_DEBUG
131 };
132
138 vtkGetMacro(CurrentMessageType, MessageTypes);
139
140 enum class StreamType
141 {
142 Null,
143 StdOutput,
144 StdError,
145 };
146
152
154
155private:
156 std::atomic<MessageTypes> CurrentMessageType;
157 int DisplayMode;
158 std::atomic<int> InStandardMacros; // used to suppress display to output streams from standard
159 // macros when logging is enabled.
160
161 friend class vtkOutputWindowPrivateAccessor;
162
163 vtkOutputWindow(const vtkOutputWindow&) = delete;
164 void operator=(const vtkOutputWindow&) = delete;
165};
166
167VTK_ABI_NAMESPACE_END
168#endif
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:50
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.