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=========================================================================*/
25#ifndef vtkOutputWindow_h
26#define vtkOutputWindow_h
27
28#include "vtkCommonCoreModule.h" // For export macro
29#include "vtkDebugLeaksManager.h" // Must be included before singletons
30#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_0_0
31#include "vtkObject.h"
32
33class VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
34{
35public:
38
39private:
41 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
42};
43
44class vtkOutputWindowPrivateAccessor;
45class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
46{
47public:
48 // Methods from vtkObject
49 vtkTypeMacro(vtkOutputWindow, vtkObject);
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
61
70 static void SetInstance(vtkOutputWindow* instance);
71
73
80 virtual void DisplayText(const char*);
81 virtual void DisplayErrorText(const char*);
82 virtual void DisplayWarningText(const char*);
83 virtual void DisplayGenericWarningText(const char*);
84 virtual void DisplayDebugText(const char*);
86
88
97 vtkBooleanMacro(PromptUser, bool);
98 vtkSetMacro(PromptUser, bool);
100
102
111 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
112 void SetUseStdErrorForAllMessages(bool);
113 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::GetDisplayMode")
114 bool GetUseStdErrorForAllMessages();
115 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
116 void UseStdErrorForAllMessagesOn();
117 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
118 void UseStdErrorForAllMessagesOff();
120
122
147 {
148 DEFAULT = -1,
149 NEVER = 0,
150 ALWAYS = 1,
151 ALWAYS_STDERR = 2
152 };
153 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
154 vtkGetMacro(DisplayMode, int);
155 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
156 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
157 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
160protected:
163
165 {
170 MESSAGE_TYPE_DEBUG
171 };
172
178 vtkGetMacro(CurrentMessageType, MessageTypes);
179
180 enum class StreamType
181 {
182 Null,
183 StdOutput,
184 StdError,
185 };
186
192
194
195private:
196 static vtkOutputWindow* Instance;
197 MessageTypes CurrentMessageType;
198 int DisplayMode;
199 int InStandardMacros; // used to suppress display to output streams from standard macros when
200 // logging is enabled.
201
202 friend class vtkOutputWindowPrivateAccessor;
203
204private:
205 vtkOutputWindow(const vtkOutputWindow&) = delete;
206 void operator=(const vtkOutputWindow&) = delete;
207};
208
209// Uses schwartz counter idiom for singleton management
211
212#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
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