ITK  5.2.0
Insight Toolkit
itkStdStreamLogOutput.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 #ifndef itkStdStreamLogOutput_h
19 #define itkStdStreamLogOutput_h
20 
21 #include <iostream>
22 #include <string>
23 
24 #include <mutex>
25 #include "itkLogOutput.h"
26 
27 namespace itk
28 {
42 class ITKCommon_EXPORT StdStreamLogOutput : public LogOutput
43 {
44 public:
49 
50  using StreamType = std::ostream;
51 
52  using StreamPointerType = std::ostream *;
53 
54  itkTypeMacro(StdStreamLogOutput, LogOutput);
55 
56  itkNewMacro(StdStreamLogOutput);
57 
58  itkGetConstMacro(Stream, StreamPointerType);
59 
61  void
62  SetStream(StreamType & Stream);
63 
65  void
66  Flush() override;
67 
69  void
70  Write(double timestamp) override;
71 
73  void
74  Write(std::string const & content) override;
75 
77  void
78  Write(std::string const & content, double timestamp) override;
79 
80 protected:
83 
85  ~StdStreamLogOutput() override;
86 
87  void
88  PrintSelf(std::ostream & os, Indent indent) const override;
89 
90 private:
92 
93  std::mutex m_Mutex;
94 };
95 } // namespace itk
96 
97 #endif // itkStdStreamLogOutput_h
itkLogOutput.h
itk::StdStreamLogOutput
Represents a standard stream output stream.
Definition: itkStdStreamLogOutput.h:42
itk::StdStreamLogOutput::StreamType
std::ostream StreamType
Definition: itkStdStreamLogOutput.h:50
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::StdStreamLogOutput::m_Mutex
std::mutex m_Mutex
Definition: itkStdStreamLogOutput.h:93
itk::StdStreamLogOutput::m_Stream
StreamPointerType m_Stream
Definition: itkStdStreamLogOutput.h:91
itk::StdStreamLogOutput::StreamPointerType
std::ostream * StreamPointerType
Definition: itkStdStreamLogOutput.h:52
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LogOutput
Represents an output stream.
Definition: itkLogOutput.h:39
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62