Orfeo Toolbox  4.0
itkOutputWindow.cxx
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifdef _WIN32
29 # include "itkWin32OutputWindow.h"
30 #else
31 # include "itkOutputWindow.h"
32 # include "itkObjectFactory.h"
33 #endif
34 
35 namespace itk
36 {
38 
44 {
45  m_PromptUser = 0;
46 }
47 
50 {}
51 
52 void
53 OutputWindowDisplayText(const char *message)
54 {
55  OutputWindow::GetInstance()->DisplayText(message);
56 }
57 
58 void
59 OutputWindowDisplayErrorText(const char *message)
60 {
61  OutputWindow::GetInstance()->DisplayErrorText(message);
62 }
63 
64 void
65 OutputWindowDisplayWarningText(const char *message)
66 {
67  OutputWindow::GetInstance()->DisplayWarningText(message);
68 }
69 
70 void
72 {
73  OutputWindow::GetInstance()->DisplayGenericOutputText(message);
74 }
75 
76 void
77 OutputWindowDisplayDebugText(const char *message)
78 {
79  OutputWindow::GetInstance()->DisplayDebugText(message);
80 }
81 
82 void
84 ::PrintSelf(std::ostream & os, Indent indent) const
85 {
86  Superclass::PrintSelf(os, indent);
87 
88  os << indent << "OutputWindow (single instance): "
89  << (void *)OutputWindow::m_Instance << std::endl;
90 
91  os << indent << "Prompt User: " << ( m_PromptUser ? "On\n" : "Off\n" );
92 }
93 
97 void
99 ::DisplayText(const char *txt)
100 {
101  std::cerr << txt;
102  if ( m_PromptUser )
103  {
104  char c = 'n';
105  std::cerr << "\nDo you want to suppress any further messages (y,n)?."
106  << std::endl;
107  std::cin >> c;
108  if ( c == 'y' || c == 'Y' )
109  {
111  }
112  }
113 }
114 
121 {
123  {
124  // Try the factory first
126  // if the factory did not provide one, then create it here
128  {
129  // For the windows OS, use a special output window
130 #ifdef _WIN32
131  OutputWindow::m_Instance = Win32OutputWindow::New();
132 #else
134  // Remove extra reference from construction.
136 #endif
137  }
138  }
143 }
144 
145 void
148 {
149  if ( OutputWindow::m_Instance == instance )
150  {
151  return;
152  }
153  OutputWindow::m_Instance = instance;
154 }
155 
162 {
163  return GetInstance();
164 }
165 } // end namespace itk

Generated at Sat Mar 8 2014 15:20:07 for Orfeo Toolbox with doxygen 1.8.3.1