Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Utilities
ITK
Code
Common
itkOutputWindow.cxx
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Insight Segmentation & Registration Toolkit
4
Module: $RCSfile: itkOutputWindow.cxx,v $
5
Language: C++
6
Date: $Date: 2003-09-10 14:29:19 $
7
Version: $Revision: 1.17 $
8
9
Copyright (c) Insight Software Consortium. All rights reserved.
10
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12
Portions of this code are covered under the VTK copyright.
13
See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
14
15
This software is distributed WITHOUT ANY WARRANTY; without even
16
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17
PURPOSE. See the above copyright notices for more information.
18
19
=========================================================================*/
20
#include "
itkOutputWindow.h
"
21
#ifdef _WIN32
22
#include "
itkWin32OutputWindow.h
"
23
#endif
24
#include "
itkObjectFactory.h
"
25
26
namespace
itk
27
{
28
29
OutputWindow::Pointer
OutputWindow::m_Instance
= 0;
30
34
OutputWindow
35
::OutputWindow
()
36
{
37
m_PromptUser = 0;
38
}
39
40
OutputWindow
41
::~OutputWindow
()
42
{
43
}
44
45
void
46
OutputWindowDisplayText
(
const
char
* message)
47
{
48
OutputWindow::GetInstance
()->DisplayText(message);
49
}
50
51
void
52
OutputWindowDisplayErrorText
(
const
char
* message)
53
{
54
OutputWindow::GetInstance
()->DisplayErrorText(message);
55
}
56
57
void
58
OutputWindowDisplayWarningText
(
const
char
* message)
59
{
60
OutputWindow::GetInstance
()->DisplayWarningText(message);
61
}
62
63
void
64
OutputWindowDisplayGenericOutputText
(
const
char
* message)
65
{
66
OutputWindow::GetInstance
()->DisplayGenericOutputText(message);
67
}
68
69
void
70
OutputWindowDisplayDebugText
(
const
char
* message)
71
{
72
OutputWindow::GetInstance
()->DisplayDebugText(message);
73
}
74
75
76
void
77
OutputWindow
78
::PrintSelf
(std::ostream& os,
Indent
indent)
const
79
{
80
Superclass::PrintSelf(os, indent);
81
82
os << indent <<
"OutputWindow (single instance): "
83
<< (
void
*)
OutputWindow::m_Instance
<< std::endl;
84
85
os << indent <<
"Prompt User: "
<< (m_PromptUser ?
"On\n"
:
"Off\n"
);
86
}
87
88
92
void
93
OutputWindow
94
::DisplayText
(
const
char
* txt)
95
{
96
std::cerr << txt;
97
if
( m_PromptUser )
98
{
99
char
c =
'n'
;
100
std::cerr <<
"\nDo you want to suppress any further messages (y,n)?."
101
<< std::endl;
102
std::cin >> c;
103
if
( c ==
'y'
|| c ==
'Y'
)
104
{
105
Object::GlobalWarningDisplayOff
();
106
}
107
}
108
}
109
113
OutputWindow::Pointer
114
OutputWindow
115
::GetInstance
()
116
{
117
if
( !
OutputWindow::m_Instance
)
118
{
119
// Try the factory first
120
OutputWindow::m_Instance
=
ObjectFactory<Self>::Create
();
121
// if the factory did not provide one, then create it here
122
if
( !
OutputWindow::m_Instance
)
123
{
124
// For the windows OS, use a special output window
125
#ifdef _WIN32
126
OutputWindow::m_Instance
=
Win32OutputWindow::New
();
127
#else
128
OutputWindow::m_Instance
=
new
OutputWindow
;
129
// Remove extra reference from construction.
130
OutputWindow::m_Instance
->
UnRegister
();
131
#endif
132
}
133
}
137
return
OutputWindow::m_Instance
;
138
}
139
140
void
141
OutputWindow
142
::SetInstance
(
OutputWindow
* instance)
143
{
144
if
(
OutputWindow::m_Instance
== instance )
145
{
146
return
;
147
}
148
OutputWindow::m_Instance
= instance;
149
}
150
154
OutputWindow::Pointer
155
OutputWindow
156
::New
()
157
{
158
return
GetInstance();
159
}
160
161
162
}
// end namespace itk
Generated at Sat Feb 2 2013 23:58:06 for
Orfeo Toolbox
with
doxygen 1.8.1.1