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=========================================================================*/
31#ifndef vtkOutputWindow_h
32#define vtkOutputWindow_h
33
34#include "vtkCommonCoreModule.h" // For export macro
35#include "vtkDebugLeaksManager.h" // Must be included before singletons
36#include "vtkObject.h"
37
38class VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
39{
40public:
43
44private:
46 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
47};
48
49class vtkOutputWindowPrivateAccessor;
50class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
51{
52public:
53 // Methods from vtkObject
54 vtkTypeMacro(vtkOutputWindow, vtkObject);
58 void PrintSelf(ostream& os, vtkIndent indent) override;
59
66
75 static void SetInstance(vtkOutputWindow* instance);
76
78
85 virtual void DisplayText(const char*);
86 virtual void DisplayErrorText(const char*);
87 virtual void DisplayWarningText(const char*);
88 virtual void DisplayGenericWarningText(const char*);
89 virtual void DisplayDebugText(const char*);
91
93
102 vtkBooleanMacro(PromptUser, bool);
103 vtkSetMacro(PromptUser, bool);
105
107
132 {
133 DEFAULT = -1,
134 NEVER = 0,
135 ALWAYS = 1,
136 ALWAYS_STDERR = 2
137 };
138 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
139 vtkGetMacro(DisplayMode, int);
140 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
141 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
142 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
145protected:
148
150 {
155 MESSAGE_TYPE_DEBUG
156 };
157
163 vtkGetMacro(CurrentMessageType, MessageTypes);
164
165 enum class StreamType
166 {
167 Null,
168 StdOutput,
169 StdError,
170 };
171
177
179
180private:
181 static vtkOutputWindow* Instance;
182 MessageTypes CurrentMessageType;
183 int DisplayMode;
184 int InStandardMacros; // used to suppress display to output streams from standard macros when
185 // logging is enabled.
186
187 friend class vtkOutputWindowPrivateAccessor;
188
189private:
190 vtkOutputWindow(const vtkOutputWindow&) = delete;
191 void operator=(const vtkOutputWindow&) = delete;
192};
193
194// Uses schwartz counter idiom for singleton management
196
197#endif
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:63
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