VTK  9.1.0
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_0_0
37#include "vtkObject.h"
38
39class VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
40{
41public:
44
45private:
47 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
48};
49
50class vtkOutputWindowPrivateAccessor;
51class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
52{
53public:
54 // Methods from vtkObject
55 vtkTypeMacro(vtkOutputWindow, vtkObject);
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
67
76 static void SetInstance(vtkOutputWindow* instance);
77
79
86 virtual void DisplayText(const char*);
87 virtual void DisplayErrorText(const char*);
88 virtual void DisplayWarningText(const char*);
89 virtual void DisplayGenericWarningText(const char*);
90 virtual void DisplayDebugText(const char*);
92
94
103 vtkBooleanMacro(PromptUser, bool);
104 vtkSetMacro(PromptUser, bool);
106
108
117 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
118 void SetUseStdErrorForAllMessages(bool);
119 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::GetDisplayMode")
120 bool GetUseStdErrorForAllMessages();
121 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
122 void UseStdErrorForAllMessagesOn();
123 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
124 void UseStdErrorForAllMessagesOff();
126
128
153 {
154 DEFAULT = -1,
155 NEVER = 0,
156 ALWAYS = 1,
157 ALWAYS_STDERR = 2
158 };
159 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
160 vtkGetMacro(DisplayMode, int);
161 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
162 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
163 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
166protected:
169
171 {
176 MESSAGE_TYPE_DEBUG
177 };
178
184 vtkGetMacro(CurrentMessageType, MessageTypes);
185
186 enum class StreamType
187 {
188 Null,
189 StdOutput,
190 StdError,
191 };
192
198
200
201private:
202 static vtkOutputWindow* Instance;
203 MessageTypes CurrentMessageType;
204 int DisplayMode;
205 int InStandardMacros; // used to suppress display to output streams from standard macros when
206 // logging is enabled.
207
208 friend class vtkOutputWindowPrivateAccessor;
209
210private:
211 vtkOutputWindow(const vtkOutputWindow&) = delete;
212 void operator=(const vtkOutputWindow&) = delete;
213};
214
215// Uses schwartz counter idiom for singleton management
217
218#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:82
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_0_0(reason)
static vtkOutputWindowCleanup vtkOutputWindowCleanupInstance