VTK  9.7.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
23 #ifndef vtkOutputWindow_h
24 #define vtkOutputWindow_h
25 
26 #include "vtkCommonCoreModule.h" // For export macro
27 #include "vtkDebugLeaksManager.h" // Must be included before singletons
28 #include "vtkObject.h"
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkOutputWindowPrivateAccessor;
32 class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
33 {
34 public:
35  // Methods from vtkObject
36  vtkTypeMacro(vtkOutputWindow, vtkObject);
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
47  static vtkOutputWindow* New();
48 
52  static vtkOutputWindow* GetInstance();
57  static void SetInstance(vtkOutputWindow* instance);
58 
60 
67  virtual void DisplayText(const char*);
68  virtual void DisplayErrorText(const char*);
69  virtual void DisplayWarningText(const char*);
70  virtual void DisplayGenericWarningText(const char*);
71  virtual void DisplayDebugText(const char*);
73 
75 
84  vtkBooleanMacro(PromptUser, bool);
85  vtkSetMacro(PromptUser, bool);
87 
89 
94  vtkBooleanMacro(ShowWindow, bool);
95  vtkSetMacro(ShowWindow, bool);
97 
99 
124  {
125  DEFAULT = -1,
126  NEVER = 0,
127  ALWAYS = 1,
128  ALWAYS_STDERR = 2
129  };
130  vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
131  vtkGetMacro(DisplayMode, int);
132  void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
133  void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
134  void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
137 protected:
138  vtkOutputWindow();
139  ~vtkOutputWindow() override;
140 
142  {
147  MESSAGE_TYPE_DEBUG
148  };
149 
155  vtkGetMacro(CurrentMessageType, MessageTypes);
156 
157  enum class StreamType
158  {
159  Null,
160  StdOutput,
161  StdError,
162  };
163 
168  virtual StreamType GetDisplayStream(MessageTypes msgType) const;
169 
171  bool ShowWindow = true;
172 
173 private:
174  std::atomic<MessageTypes> CurrentMessageType;
175  int DisplayMode;
176  std::atomic<int> InStandardMacros; // used to suppress display to output streams from standard
177  // macros when logging is enabled.
178 
179  friend class vtkOutputWindowPrivateAccessor;
180 
181  vtkOutputWindow(const vtkOutputWindow&) = delete;
182  void operator=(const vtkOutputWindow&) = delete;
183 };
184 
185 VTK_ABI_NAMESPACE_END
186 #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:52
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.
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...