Loading...
Searching...
No Matches
dummyISstream.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2017 OpenFOAM Foundation
9 Copyright (C) 2019-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::dummyISstream
29
30Description
31 Dummy input stream, which can be used as a placeholder for interfaces
32 taking an Istream or ISstream. Aborts at any attempt to read from it.
33
34Note
35 The inheritance from an empty ICharStream is solely for convenience
36 of implementation and should not be relied upon.
37
38SourceFiles
39 dummyISstream.H
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef Foam_dummyISstream_H
44#define Foam_dummyISstream_H
45
46#include "autoPtr.H"
47#include "SpanStream.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
54/*---------------------------------------------------------------------------*\
55 Class dummyISstream Declaration
56\*---------------------------------------------------------------------------*/
57
58class dummyISstream
59:
60 public ICharStream
61{
62public:
63
64 // Generated Methods
65
66 //- Default construct
67 dummyISstream() = default;
68
69 //- Destructor
70 virtual ~dummyISstream() = default;
71
72
73 // Factory Methods
74
75 //- Return a dummyISstream
76 static autoPtr<ISstream> New()
77 {
78 return autoPtr<ISstream>(new dummyISstream());
79 }
80
81
82 // Member Functions
83
84 // Stream-state
85
86 //- Return current stream flags.
87 //- Dummy for dummy stream, returns 0.
88 virtual std::ios_base::fmtflags flags() const override
89 {
90 return std::ios_base::fmtflags(0);
91 }
92
93 //- Set stream flags, return old stream flags.
94 //- Dummy for dummy stream, returns 0.
95 virtual std::ios_base::fmtflags flags(std::ios_base::fmtflags) override
96 {
97 return std::ios_base::fmtflags(0);
98 }
99
101 // Read Functions
102
103 //- Return next token from stream
104 virtual Istream& read(token&) override
105 {
107 return *this;
108 }
109
110 //- Read a character
111 virtual Istream& read(char&) override
112 {
114 return *this;
115 }
116
117 //- Read a word
118 virtual Istream& read(word&) override
119 {
121 return *this;
122 }
123
124 // Read a string (including enclosing double-quotes)
125 virtual Istream& read(string&) override
126 {
128 return *this;
130
131 //- Read int32_t
132 virtual Istream& read(int32_t&) override
133 {
135 return *this;
137
138 //- Read int64_t
139 virtual Istream& read(int64_t&) override
140 {
142 return *this;
143 }
144
145 //- Read uint32_t
146 virtual Istream& read(uint32_t&) override
147 {
149 return *this;
150 }
151
152 //- Read uint64_t
153 virtual Istream& read(uint64_t&) override
156 return *this;
157 }
158
159 //- Read a float
160 virtual Istream& read(float&) override
161 {
163 return *this;
164 }
165
166 //- Read a double
167 virtual Istream& read(double&) override
168 {
170 return *this;
171 }
173 //- Read binary block
174 virtual Istream& read(char*, std::streamsize) override
175 {
177 return *this;
178 }
179
180 //- Low-level raw binary read
181 virtual Istream& readRaw(char*, std::streamsize) override
182 {
184 return *this;
185 }
186
187 //- Start of low-level raw binary read
188 virtual bool beginRawRead() override
189 {
190 return false;
191 }
192
193 //- End of low-level raw binary read
194 virtual bool endRawRead() override
195 {
196 return false;
197 }
198
199 //- Rewind the stream so that it may be read again
200 virtual void rewind() override
201 {}
202};
203
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207} // End namespace Foam
209// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210
211#endif
212
213// ************************************************************************* //
Input/output streams with (internal or external) character storage.
ICharStream(IOstreamOption streamOpt=IOstreamOption())
Default construct (empty), optionally with specified stream option.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
virtual Istream & readRaw(char *, std::streamsize) override
Low-level raw binary read.
virtual std::ios_base::fmtflags flags() const override
Return current stream flags. Dummy for dummy stream, returns 0.
virtual Istream & read(double &) override
Read a double.
virtual bool beginRawRead() override
Start of low-level raw binary read.
virtual bool endRawRead() override
End of low-level raw binary read.
virtual Istream & read(char &) override
Read a character.
virtual std::ios_base::fmtflags flags(std::ios_base::fmtflags) override
Set stream flags, return old stream flags. Dummy for dummy stream, returns 0.
virtual Istream & read(word &) override
Read a word.
virtual Istream & read(token &) override
Return next token from stream.
virtual Istream & read(string &) override
Read a string (including enclosing double-quotes).
virtual Istream & read(char *, std::streamsize) override
Read binary block.
virtual Istream & read(int32_t &) override
Read int32_t.
virtual Istream & read(float &) override
Read a float.
static autoPtr< ISstream > New()
Return a dummyISstream.
virtual ~dummyISstream()=default
Destructor.
virtual Istream & read(uint32_t &) override
Read uint32_t.
virtual Istream & read(uint64_t &) override
Read uint64_t.
virtual void rewind() override
Rewind the stream so that it may be read again.
dummyISstream()=default
Default construct.
virtual Istream & read(int64_t &) override
Read int64_t.
A token holds an item read from Istream.
Definition token.H:70
A class for handling words, derived from Foam::string.
Definition word.H:66
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
Namespace for OpenFOAM.