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=========================================================================*/
34#ifndef vtkOutputWindow_h
35#define vtkOutputWindow_h
36
37#include "vtkCommonCoreModule.h" // For export macro
38#include "vtkDebugLeaksManager.h" // Must be included before singletons
39#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_0_0
40#include "vtkObject.h"
41
42class VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
43{
44public:
47
48private:
50 vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
51};
52
53class vtkOutputWindowPrivateAccessor;
54class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
55{
56public:
57 // Methods from vtkObject
58 vtkTypeMacro(vtkOutputWindow, vtkObject);
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
70
79 static void SetInstance(vtkOutputWindow* instance);
80
82
89 virtual void DisplayText(const char*);
90 virtual void DisplayErrorText(const char*);
91 virtual void DisplayWarningText(const char*);
92 virtual void DisplayGenericWarningText(const char*);
93 virtual void DisplayDebugText(const char*);
95
97
106 vtkBooleanMacro(PromptUser, bool);
107 vtkSetMacro(PromptUser, bool);
109
111
120 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
121 void SetUseStdErrorForAllMessages(bool);
122 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::GetDisplayMode")
123 bool GetUseStdErrorForAllMessages();
124 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
125 void UseStdErrorForAllMessagesOn();
126 VTK_DEPRECATED_IN_9_0_0("Use vtkOutputWindow::SetDisplayMode")
127 void UseStdErrorForAllMessagesOff();
129
131
156 {
157 DEFAULT = -1,
158 NEVER = 0,
159 ALWAYS = 1,
160 ALWAYS_STDERR = 2
161 };
162 vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
163 vtkGetMacro(DisplayMode, int);
164 void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
165 void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
166 void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
169protected:
172
174 {
179 MESSAGE_TYPE_DEBUG
180 };
181
187 vtkGetMacro(CurrentMessageType, MessageTypes);
188
189 enum class StreamType
190 {
191 Null,
192 StdOutput,
193 StdError,
194 };
195
201
203
204private:
205 static vtkOutputWindow* Instance;
206 MessageTypes CurrentMessageType;
207 int DisplayMode;
208 int InStandardMacros; // used to suppress display to output streams from standard macros when
209 // logging is enabled.
210
211 friend class vtkOutputWindowPrivateAccessor;
212
213private:
214 vtkOutputWindow(const vtkOutputWindow&) = delete;
215 void operator=(const vtkOutputWindow&) = delete;
216};
217
218// Uses schwartz counter idiom for singleton management
220
221#endif
a simple class to control print indentation
Definition: vtkIndent.h:43
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.
#define VTK_DEPRECATED_IN_9_0_0(reason)
static vtkOutputWindowCleanup vtkOutputWindowCleanupInstance