VTK  9.3.1
vtkOutputWindow.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
19 #ifndef vtkOutputWindow_h
20 #define vtkOutputWindow_h
21 
22 #include "vtkCommonCoreModule.h" // For export macro
23 #include "vtkDebugLeaksManager.h" // Must be included before singletons
24 #include "vtkDeprecation.h" // For `VTK_DEPRECATED_IN_9_3_0`
25 #include "vtkObject.h"
26 
27 VTK_ABI_NAMESPACE_BEGIN
29  "`vtkOutputWindowCleanup` is no longer necessary") VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
30 {
31 public:
32  vtkOutputWindowCleanup() = default;
33  ~vtkOutputWindowCleanup() = default;
34 
35 private:
36  vtkOutputWindowCleanup(const vtkOutputWindowCleanup& other) = delete;
37  vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
38 };
39 
40 class vtkOutputWindowPrivateAccessor;
41 class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
42 {
43 public:
44  // Methods from vtkObject
45  vtkTypeMacro(vtkOutputWindow, vtkObject);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
56  static vtkOutputWindow* New();
57 
61  static vtkOutputWindow* GetInstance();
66  static void SetInstance(vtkOutputWindow* instance);
67 
69 
76  virtual void DisplayText(const char*);
77  virtual void DisplayErrorText(const char*);
78  virtual void DisplayWarningText(const char*);
79  virtual void DisplayGenericWarningText(const char*);
80  virtual void DisplayDebugText(const char*);
82 
84 
93  vtkBooleanMacro(PromptUser, bool);
94  vtkSetMacro(PromptUser, bool);
96 
98 
123  {
124  DEFAULT = -1,
125  NEVER = 0,
126  ALWAYS = 1,
127  ALWAYS_STDERR = 2
128  };
129  vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
130  vtkGetMacro(DisplayMode, int);
131  void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
132  void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
133  void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
136 protected:
137  vtkOutputWindow();
138  ~vtkOutputWindow() override;
139 
141  {
146  MESSAGE_TYPE_DEBUG
147  };
148 
154  vtkGetMacro(CurrentMessageType, MessageTypes);
155 
156  enum class StreamType
157  {
158  Null,
159  StdOutput,
160  StdError,
161  };
162 
167  virtual StreamType GetDisplayStream(MessageTypes msgType) const;
168 
170 
171 private:
172  std::atomic<MessageTypes> CurrentMessageType;
173  int DisplayMode;
174  std::atomic<int> InStandardMacros; // used to suppress display to output streams from standard
175  // macros when logging is enabled.
176 
177  friend class vtkOutputWindowPrivateAccessor;
178 
179  vtkOutputWindow(const vtkOutputWindow&) = delete;
180  void operator=(const vtkOutputWindow&) = delete;
181 };
182 
183 VTK_ABI_NAMESPACE_END
184 #endif
void SetDisplayModeToAlwaysStdErr()
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetDisplayModeToNever()
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.
#define VTK_DEPRECATED_IN_9_3_0(reason)
a simple class to control print indentation
Definition: vtkIndent.h:28
base class for writing debug output to a console
void SetDisplayModeToDefault()
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
void SetDisplayModeToAlways()
Flag indicates how the vtkOutputWindow handles displaying of text to stderr / stdout.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...