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 =========================================================================*/
31 #ifndef vtkOutputWindow_h
32 #define vtkOutputWindow_h
33 
34 #include "vtkCommonCoreModule.h" // For export macro
35 #include "vtkDebugLeaksManager.h" // Must be included before singletons
36 #include "vtkObject.h"
37 
38 class VTKCOMMONCORE_EXPORT vtkOutputWindowCleanup
39 {
40 public:
43 
44 private:
45  vtkOutputWindowCleanup(const vtkOutputWindowCleanup& other) = delete;
46  vtkOutputWindowCleanup& operator=(const vtkOutputWindowCleanup& rhs) = delete;
47 };
48 
49 class vtkOutputWindowPrivateAccessor;
50 class VTKCOMMONCORE_EXPORT vtkOutputWindow : public vtkObject
51 {
52 public:
53  // Methods from vtkObject
54  vtkTypeMacro(vtkOutputWindow, vtkObject);
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
65  static vtkOutputWindow* New();
66 
70  static vtkOutputWindow* GetInstance();
75  static void SetInstance(vtkOutputWindow* instance);
76 
78 
85  virtual void DisplayText(const char*);
86  virtual void DisplayErrorText(const char*);
87  virtual void DisplayWarningText(const char*);
88  virtual void DisplayGenericWarningText(const char*);
89  virtual void DisplayDebugText(const char*);
91 
93 
102  vtkBooleanMacro(PromptUser, bool);
103  vtkSetMacro(PromptUser, bool);
105 
107 
116  VTK_LEGACY(void SetUseStdErrorForAllMessages(bool));
117  VTK_LEGACY(bool GetUseStdErrorForAllMessages());
118  VTK_LEGACY(void UseStdErrorForAllMessagesOn());
119  VTK_LEGACY(void UseStdErrorForAllMessagesOff());
121 
123 
148  {
149  DEFAULT = -1,
150  NEVER = 0,
151  ALWAYS = 1,
152  ALWAYS_STDERR = 2
153  };
154  vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
155  vtkGetMacro(DisplayMode, int);
156  void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
157  void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
158  void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
161 protected:
162  vtkOutputWindow();
163  ~vtkOutputWindow() override;
164 
166  {
171  MESSAGE_TYPE_DEBUG
172  };
173 
179  vtkGetMacro(CurrentMessageType, MessageTypes);
180 
181  enum class StreamType
182  {
183  Null,
184  StdOutput,
185  StdError,
186  };
187 
192  virtual StreamType GetDisplayStream(MessageTypes msgType) const;
193 
195 
196 private:
197  static vtkOutputWindow* Instance;
198  MessageTypes CurrentMessageType;
199  int DisplayMode;
200  int InStandardMacros; // used to suppress display to output streams from standard macros when
201  // logging is enabled.
202 
203  friend class vtkOutputWindowPrivateAccessor;
204 
205 private:
206  vtkOutputWindow(const vtkOutputWindow&) = delete;
207  void operator=(const vtkOutputWindow&) = delete;
208 };
209 
210 // Uses schwartz counter idiom for singleton management
212 
213 #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:62
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...