-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkBufferOutputWindow.h
105 lines (84 loc) · 2.65 KB
/
vtkBufferOutputWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*=========================================================================
Program: Visualization Toolkit
Module: vtkBufferOutputWindow.h
Language: C++
RCS: $Id$
Copyright (c) 2004 Goodwin Lawlor
=========================================================================*/
// .NAME vtkBufferOutputWindow -
// .SECTION Description
// Writes debug/warning/error output to a buffer (a class variable) which can be accessed from a
// wrapped language (tcl etc.). The class invokes ErrorEvent, WarningEvent, GenericWarningEvent and
// UserEvent (ie DebugEvent doesn't exist) which can be observed and a callback triggered to get the
// output text.
//
// To use this class, instantiate it and then call SetInstance(this).
#ifndef __vtkBufferOutputWindow_h
#define __vtkBufferOutputWindow_h
#include "vtkOutputWindow.h"
#include "vtkBioengConfigure.h" // Include configuration header.
class VTK_BIOENG_EXPORT vtkBufferOutputWindow : public vtkOutputWindow
{
public:
vtkTypeMacro(vtkBufferOutputWindow, vtkOutputWindow);
static vtkBufferOutputWindow* New();
//BTX
enum TextType
{
TEXT,
WARNING_TEXT,
ERROR_TEXT,
GENERIC_WARNING_TEXT,
DEBUG_TEXT
};
//ETX
// Description:
// Get the last text type: 0 = TEXT; 1 = WARNING_TEXT; 2 = ERROR_TEXT;
// 3 = GENERIC_WARNING_TEXT; 4 = DEBUG_TEXT
vtkGetMacro(LastOutputTextType, int);
// Description:
// the output window api
virtual void DisplayText(const char*);
virtual void DisplayErrorText(const char*);
virtual void DisplayWarningText(const char*);
virtual void DisplayGenericWarningText(const char*);
virtual void DisplayDebugText(const char*);
// Description:
// Get the last message
vtkGetStringMacro(LastOutputText);
// Description:
// Get the last message type... error, warning etc.
char *GetLastOutputTextTypeAsString();
protected:
vtkBufferOutputWindow();
virtual ~vtkBufferOutputWindow();
char *LastOutputText;
int LastOutputTextType;
private:
vtkBufferOutputWindow(const vtkBufferOutputWindow&); // Not implemented.
void operator=(const vtkBufferOutputWindow&); // Not implemented.
};
inline char *vtkBufferOutputWindow::GetLastOutputTextTypeAsString(void)
{
if ( this->LastOutputTextType == TEXT )
{
return (char *)"Text";
}
else if ( this->LastOutputTextType == ERROR_TEXT )
{
return (char *)"Error Text";
}
else if ( this->LastOutputTextType == WARNING_TEXT )
{
return (char *)"Warning Text";
}
else if ( this->LastOutputTextType == GENERIC_WARNING_TEXT )
{
return (char *)"Generic Warning Text";
}
else
{
return (char *)"Debug Text";
}
}
#endif