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=========================================================================*/
40#ifndef vtkOutputWindow_h
41#define vtkOutputWindow_h
42
43#include "vtkCommonCoreModule.h" // For export macro
44#include "vtkDebugLeaksManager.h" // Must be included before singletons
45#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_0_0
46#include "vtkObject.h"
47
48class VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
49{
50public:
53
54private:
56 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
57};
58
59class vtkOutputWindowPrivateAccessor;
60class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
61{
62public:
63 // Methods from vtkObject
64 vtkTypeMacro(vtkOutputWindow, vtkObject);
68 void PrintSelf(ostream& os, vtkIndent indent) override;
69
76
85 static void SetInstance(vtkOutputWindow* instance);
86
88
95 virtual void DisplayText(const char*);
96 virtual void DisplayErrorText(const char*);
97 virtual void DisplayWarningText(const char*);
98 virtual void DisplayGenericWarningText(const char*);
99 virtual void DisplayDebugText(const char*);
101
103
112 vtkBooleanMacro(PromptUser, bool);
113 vtkSetMacro(PromptUser, bool);
115
117
126 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
127 void SetUseStdErrorForAllMessages(bool);
128 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::GetDisplayMode")
129 bool GetUseStdErrorForAllMessages();
130 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
131 void UseStdErrorForAllMessagesOn();
132 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
133 void UseStdErrorForAllMessagesOff();
135
137
162 {
163 DEFAULT = -1,
164 NEVER = 0,
165 ALWAYS = 1,
166 ALWAYS_STDERR = 2
167 };
168 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
169 vtkGetMacro(DisplayMode, int);
170 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
171 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
172 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
175protected:
178
180 {
185 MESSAGE_TYPE_DEBUG
186 };
187
193 vtkGetMacro(CurrentMessageType, MessageTypes);
194
195 enum class StreamType
196 {
197 Null,
198 StdOutput,
199 StdError,
200 };
201
207
209
210private:
211 static vtkOutputWindow* Instance;
212 MessageTypes CurrentMessageType;
213 int DisplayMode;
214 int InStandardMacros; // used to suppress display to output streams from standard macros when
215 // logging is enabled.
216
217 friend class vtkOutputWindowPrivateAccessor;
218
219private:
220 vtkOutputWindow(const vtkOutputWindow&) = delete;
221 void operator=(const vtkOutputWindow&) = delete;
222};
223
224// Uses schwartz counter idiom for singleton management
226
227#endif
a simple class to control print indentation
Definition: vtkIndent.h:43
abstract base class for most VTK objects
Definition: vtkObject.h:72
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