VTK  9.2.6
vtkOutputWindow.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOutputWindow.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
28#ifndef vtkOutputWindow_h
29#define vtkOutputWindow_h
30
31#include "vtkCommonCoreModule.h" // For export macro
32#include "vtkDebugLeaksManager.h" // Must be included before singletons
33#include "vtkObject.h"
34
35class 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 static vtkOutputWindow* Instance;
179 MessageTypes CurrentMessageType;
180 int DisplayMode;
181 int InStandardMacros; // used to suppress display to output streams from standard macros when
182 // logging is enabled.
183
184 friend class vtkOutputWindowPrivateAccessor;
185
186private:
187 vtkOutputWindow(const vtkOutputWindow&) = delete;
188 void operator=(const vtkOutputWindow&) = delete;
189};
190
191// Uses schwartz counter idiom for singleton management
193
194#endif
a simple class to control print indentation
Definition vtkIndent.h:34
abstract base class for most VTK objects
Definition vtkObject.h:57
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.
static vtkOutputWindowCleanup vtkOutputWindowCleanupInstance