ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkFileOutputWindow.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkFileOutputWindow_h
00019 #define __itkFileOutputWindow_h
00020 
00021 #include "itkOutputWindow.h"
00022 #include "itkObjectFactory.h"
00023 #include <fstream>
00024 
00025 namespace itk
00026 {
00038 class ITKCommon_EXPORT FileOutputWindow:public OutputWindow
00039 {
00040 public:
00042   typedef FileOutputWindow           Self;
00043   typedef OutputWindow               Superclass;
00044   typedef SmartPointer< Self >       Pointer;
00045   typedef SmartPointer< const Self > ConstPointer;
00046 
00048   itkNewMacro(Self);
00049 
00051   itkTypeMacro(FileOutputWindow, OutputWindow);
00052 
00054   virtual void DisplayText(const char *);
00055 
00057   itkSetStringMacro(FileName);
00058 
00060   itkGetStringMacro(FileName);
00061 
00063   itkSetMacro(Flush, bool);
00064   itkGetConstMacro(Flush, bool);
00065   itkBooleanMacro(Flush);
00067 
00072   itkSetMacro(Append, bool);
00073   itkGetConstMacro(Append, bool);
00074   itkBooleanMacro(Append);
00075 protected:
00076   FileOutputWindow();
00077   virtual ~FileOutputWindow();
00078   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00080 
00081   void Initialize();
00082 
00083   std::ofstream *m_Stream;
00084 
00085   std::string m_FileName;
00086 
00087   bool m_Flush;
00088   bool m_Append;
00089 private:
00090   FileOutputWindow(const Self &); //purposely not implemented
00091   void operator=(const Self &);   //purposely not implemented
00092 };
00093 } // end namespace itk
00094 
00095 #endif
00096