ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkInputStreamBase.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 * https://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 itkInputStreamBase_h
19#define itkInputStreamBase_h
20
21#include <ios>
22#include <iosfwd> // For istream.
23#include <memory> // For unique_ptr.
24#include <string>
25
26#include "WebAssemblyInterfaceExport.h"
27
28namespace itk
29{
30namespace wasm
31{
32
43class WebAssemblyInterface_EXPORT InputStreamBase
44{
45public:
46 std::istream &
48 {
49 return *m_IStream;
50 }
51
52 std::istream *
54 {
55 return m_IStream.get();
56 }
57
58 void
59 SetJSON(const std::string & json);
60
61 virtual void
62 SetFileName(const std::string & fileName) = 0;
63
64protected:
65 void
66 SetFile(const std::string & fileName, const std::ios_base::openmode openMode);
67
68 InputStreamBase() = default;
69
70 // Move semantics for its derived classes:
74
76
77private:
78 std::unique_ptr<std::istream> m_IStream;
79};
80
81
82WebAssemblyInterface_EXPORT bool
83lexical_cast(const std::string & input, InputStreamBase & inputStream);
84
85} // end namespace wasm
86} // end namespace itk
87
88#endif
Base class of input stream for an itk::wasm::Pipeline.
void SetJSON(const std::string &json)
void SetFile(const std::string &fileName, const std::ios_base::openmode openMode)
InputStreamBase & operator=(InputStreamBase &&)=default
InputStreamBase(InputStreamBase &&)=default
virtual void SetFileName(const std::string &fileName)=0
std::unique_ptr< std::istream > m_IStream
bool lexical_cast(const std::string &input, InputImage< TImage > &inputImage)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....