KWStyle - itkFileOutputWindow.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkFileOutputWindow.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:35 $
7   Version:   $Revision: 1.4 $
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      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkFileOutputWindow_h
18 #define __itkFileOutputWindow_h
19
20 #include "itkOutputWindow.h"
21 #include "itkObjectFactory.h"
22 #include <fstream>
23
24 namespace itk
25 {
26 /** \class FileOutputWindow
27  * \brief Messages sent from the system are sent to a file.
28  *
29  * Text messages that the system should display to the user are sent to 
30  * this object (or subclasses of this object) and are logged to a file.
31  *
32  * \ingroup OSSystemObjects
33  * 
34  */
35
36 class ITKCommon_EXPORT FileOutputWindow : public OutputWindow
37 {
38 public:
39   /** Standard class typedefs. */
40   typedef FileOutputWindow        Self;
41 TDA   typedef OutputWindow  Superclass;
42 TDA   typedef SmartPointer<Self>  Pointer;
43 TDA   typedef SmartPointer<const Self>  ConstPointer;
44   
45   /** Method for creation through the object factory. */
46   itkNewMacro(Self);
47
48   /** Run-time type information (and related methods). */
49   itkTypeMacro(FileOutputWindow, OutputWindow);
50
51   /** Send a string to display. */
52   virtual void DisplayText(const char*);
53
54   /** Set the filename for the log file */
55   itkSetStringMacro(FileName);
56   
57   /** Get the filename for the log file */
58   itkGetStringMacro(FileName);
59   
60   /** Set/Get the buffer flushing mode */
61   itkSetMacro(Flush,bool);
62   itkGetMacro(Flush,bool);
63   itkBooleanMacro(Flush);
64   
65   /** Setting append will cause the log file to be 
66    * opened in append mode.  Otherwise, if the log file exists,
67    * it will be overwritten each time the FileOutputWindow 
68    * is created. */
69   itkSetMacro(Append, bool);
70   itkGetMacro(Append, bool);
71   itkBooleanMacro(Append);
72   
73 protected:
74   FileOutputWindow();
75   virtual ~FileOutputWindow();
76   virtual void PrintSelf(std::ostream& os, Indent indent) const;
77   void Initialize();
78   
79   std::ofstream *m_Stream;
80   std::string m_FileName;
81   bool m_Flush;
82   bool m_Append;
83
84 private:
85   FileOutputWindow(const Self&); //purposely not implemented
86   void operator=(const Self&); //purposely not implemented
87   
88 };
89   
90 // end namespace itk
91
92 #endif
93

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:07PM
© Kitware Inc.