VTK  9.2.6
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 
132  {
133  DEFAULT = -1,
134  NEVER = 0,
135  ALWAYS = 1,
136  ALWAYS_STDERR = 2
137  };
138  vtkSetClampMacro(DisplayMode, int, DEFAULT, ALWAYS_STDERR);
139  vtkGetMacro(DisplayMode, int);
140  void SetDisplayModeToDefault() { this->SetDisplayMode(vtkOutputWindow::DEFAULT); }
141  void SetDisplayModeToNever() { this->SetDisplayMode(vtkOutputWindow::NEVER); }
142  void SetDisplayModeToAlways() { this->SetDisplayMode(vtkOutputWindow::ALWAYS); }
145 protected:
146  vtkOutputWindow();
147  ~vtkOutputWindow() override;
148 
150  {
155  MESSAGE_TYPE_DEBUG
156  };
157 
163  vtkGetMacro(CurrentMessageType, MessageTypes);
164 
165  enum class StreamType
166  {
167  Null,
168  StdOutput,
169  StdError,
170  };
171 
176  virtual StreamType GetDisplayStream(MessageTypes msgType) const;
177 
179 
180 private:
181  static vtkOutputWindow* Instance;
182  MessageTypes CurrentMessageType;
183  int DisplayMode;
184  int InStandardMacros; // used to suppress display to output streams from standard macros when
185  // logging is enabled.
186 
187  friend class vtkOutputWindowPrivateAccessor;
188 
189 private:
190  vtkOutputWindow(const vtkOutputWindow&) = delete;
191  void operator=(const vtkOutputWindow&) = delete;
192 };
193 
194 // Uses schwartz counter idiom for singleton management
196 
197 #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:39
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...