VTK  9.0.1
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 =========================================================================*/
28 #ifndef vtkOutputWindow_h
29 #define vtkOutputWindow_h
30 
31 #include "vtkCommonCoreModule.h" // For export macro
32 #include "vtkDebugLeaksManager.h" // Must be included before singletons
33 #include "vtkObject.h"
34 
35 class VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
36 {
37 public:
40 
41 private:
42  vtkOutputWindowCleanup(const vtkOutputWindowCleanup& other) = delete;
43  vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
44 };
45 
46 class vtkOutputWindowPrivateAccessor;
47 class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
48 {
49 public:
50  // Methods from vtkObject
51  vtkTypeMacro(vtkOutputWindow, vtkObject);
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
62  static vtkOutputWindow* New();
63 
67  static vtkOutputWindow* GetInstance();
72  static void SetInstance(vtkOutputWindow* instance);
73 
75 
82  virtual void DisplayText(const char*);
83  virtual void DisplayErrorText(const char*);
84  virtual void DisplayWarningText(const char*);
85  virtual void DisplayGenericWarningText(const char*);
86  virtual void DisplayDebugText(const char*);
88 
90 
99  vtkBooleanMacro(PromptUser, bool);
100  vtkSetMacro(PromptUser, bool);
102 
104 
113  VTK_LEGACY(void SetUseStdErrorForAllMessages(bool));
114  VTK_LEGACY(bool GetUseStdErrorForAllMessages());
115  VTK_LEGACY(void UseStdErrorForAllMessagesOn());
116  VTK_LEGACY(void UseStdErrorForAllMessagesOff());
118 
120 
145  {
146  DEFAULT = -1,
147  NEVER = 0,
148  ALWAYS = 1,
149  ALWAYS_STDERR = 2
150  };
151  vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
152  vtkGetMacro(DisplayMode, int);
153  void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
154  void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
155  void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
158 protected:
159  vtkOutputWindow();
160  ~vtkOutputWindow() override;
161 
163  {
168  MESSAGE_TYPE_DEBUG
169  };
170 
176  vtkGetMacro(CurrentMessageType, MessageTypes);
177 
178  enum class StreamType
179  {
180  Null,
181  StdOutput,
182  StdError,
183  };
184 
189  virtual StreamType GetDisplayStream(MessageTypes msgType) const;
190 
192 
193 private:
194  static vtkOutputWindow* Instance;
195  MessageTypes CurrentMessageType;
196  int DisplayMode;
197  int InStandardMacros; // used to suppress display to output streams from standard macros when
198  // logging is enabled.
199 
200  friend class vtkOutputWindowPrivateAccessor;
201 
202 private:
203  vtkOutputWindow(const vtkOutputWindow&) = delete;
204  void operator=(const vtkOutputWindow&) = delete;
205 };
206 
207 // Uses schwartz counter idiom for singleton management
209 
210 #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:56
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:33
base class for writing debug output to a console
static vtkOutputWindowCleanup vtkOutputWindowCleanupInstance
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...