Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
3135dcf2
Commit
3135dcf2
authored
Feb 17, 2020
by
Mark OLESEN
Browse files
ENH: support IOstreamOption in abstract stream types
- expose the write IOstreamOption in Time
parent
33f9ae50
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H
View file @
3135dcf2
...
...
@@ -158,10 +158,11 @@ public:
// Constructors
//- Construct with specified stream option
explicit
IOstream
(
const
IOstreamOption
option
)
//- Default construct (ASCII, uncompressed),
//- construct with specified stream option
explicit
IOstream
(
IOstreamOption
streamOpt
=
IOstreamOption
())
:
IOstreamOption
(
option
),
IOstreamOption
(
streamOpt
),
openClosed_
(
CLOSED
),
ioState_
(
ios_base
::
iostate
(
0
)),
labelByteSize_
(
sizeof
(
label
)),
...
...
@@ -171,15 +172,15 @@ public:
setBad
();
}
//- Construct with format, version
//- Construct with format, version
(compression)
IOstream
(
streamFormat
f
orma
t
,
versionNumber
ver
sion
,
compressionType
compression
=
UNCOMPRESSED
streamFormat
f
m
t
,
versionNumber
ver
,
compressionType
comp
=
compression
Type
::
UNCOMPRESSED
)
:
IOstream
(
IOstreamOption
(
f
ormat
,
version
,
compression
))
IOstream
(
IOstreamOption
(
f
mt
,
comp
,
ver
))
{}
...
...
src/OpenFOAM/db/IOstreams/IOstreams/Istream.H
View file @
3135dcf2
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-20
19
OpenCFD Ltd.
Copyright (C) 2017-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -85,16 +85,23 @@ public:
// Constructors
//- Default construct, set stream status
Istream
//- Default construct (ASCII, uncompressed),
//- construct with specified stream option.
explicit
Istream
(
IOstreamOption
streamOpt
=
IOstreamOption
())
:
IOstream
(
streamOpt
),
putBack_
(
false
)
{}
//- Construct with format, version (compression)
explicit
Istream
(
streamFormat
f
ormat
=
ASCII
,
versionNumber
ver
sion
=
currentVersion
,
compressionType
compression
=
UNCOMPRESSED
streamFormat
f
mt
,
versionNumber
ver
=
currentVersion
,
compressionType
comp
=
compression
Type
::
UNCOMPRESSED
)
:
IOstream
(
format
,
version
,
compression
),
putBack_
(
false
)
Istream
(
IOstreamOption
(
fmt
,
comp
,
ver
))
{}
...
...
src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H
View file @
3135dcf2
...
...
@@ -85,15 +85,23 @@ public:
// Constructors
//- Default construct, set stream status
Ostream
//- Default construct (ASCII, uncompressed),
//- construct with specified stream option
explicit
Ostream
(
IOstreamOption
streamOpt
=
IOstreamOption
())
:
IOstream
(
streamOpt
)
{}
//- Construct with format, version (compression)
explicit
Ostream
(
streamFormat
f
ormat
=
ASCII
,
versionNumber
ver
sion
=
currentVersion
,
compressionType
compression
=
UNCOMPRESSED
streamFormat
f
mt
,
versionNumber
ver
=
currentVersion
,
compressionType
comp
=
compression
Type
::
UNCOMPRESSED
)
:
I
Ostream
(
format
,
version
,
compression
)
Ostream
(
IOstreamOption
(
fmt
,
comp
,
ver
)
)
{}
...
...
src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H
View file @
3135dcf2
...
...
@@ -28,7 +28,7 @@ Class
Foam::ISstream
Description
Generic input stream using standard (STL) stream
s
.
Generic input stream using
a
standard (STL) stream.
SourceFiles
ISstreamI.H
...
...
@@ -88,16 +88,28 @@ public:
// Constructors
//- Construct as wrapper around std::istream
//- Construct wrapper around std::istream, set stream status
// Default stream options (ASCII, uncompressed)
inline
ISstream
(
std
::
istream
&
is
,
const
string
&
name
,
streamFormat
format
=
ASCII
,
versionNumber
version
=
currentVersion
,
compressionType
compression
=
UNCOMPRESSED
const
string
&
streamName
,
IOstreamOption
streamOpt
=
IOstreamOption
()
);
//- Construct wrapper around std::istream, set stream status
ISstream
(
std
::
istream
&
is
,
const
string
&
streamName
,
streamFormat
fmt
,
versionNumber
ver
=
currentVersion
,
compressionType
comp
=
compressionType
::
UNCOMPRESSED
)
:
ISstream
(
is
,
streamName
,
IOstreamOption
(
fmt
,
comp
,
ver
))
{}
//- Destructor
virtual
~
ISstream
()
=
default
;
...
...
src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H
View file @
3135dcf2
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2014 OpenFOAM Foundation
Copyright (C) 2017-20
19
OpenCFD Ltd.
Copyright (C) 2017-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -31,14 +31,12 @@ License
inline
Foam
::
ISstream
::
ISstream
(
std
::
istream
&
is
,
const
string
&
name
,
streamFormat
format
,
versionNumber
version
,
compressionType
compression
const
string
&
streamName
,
IOstreamOption
streamOpt
)
:
Istream
(
format
,
version
,
compression
),
name_
(
n
ame
),
Istream
(
streamOpt
),
name_
(
streamN
ame
),
is_
(
is
)
{
if
(
is_
.
good
())
...
...
src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H
View file @
3135dcf2
...
...
@@ -28,7 +28,7 @@ Class
Foam::OSstream
Description
Generic output stream.
Generic output
stream using a standard (STL)
stream.
SourceFiles
OSstreamI.H
...
...
@@ -76,16 +76,28 @@ public:
// Constructors
//- Construct as wrapper around std::ostream and set stream status
//- Construct wrapper around std::ostream, set stream status
// Default stream options (ASCII, uncompressed)
inline
OSstream
(
std
::
ostream
&
os
,
const
string
&
name
,
streamFormat
format
=
ASCII
,
versionNumber
version
=
currentVersion
,
compressionType
compression
=
UNCOMPRESSED
const
string
&
streamName
,
IOstreamOption
streamOpt
=
IOstreamOption
()
);
//- Construct wrapper around std::ostream, set stream status
OSstream
(
std
::
ostream
&
os
,
const
string
&
streamName
,
streamFormat
fmt
,
versionNumber
ver
=
currentVersion
,
compressionType
comp
=
compressionType
::
UNCOMPRESSED
)
:
OSstream
(
os
,
streamName
,
IOstreamOption
(
fmt
,
comp
,
ver
))
{}
// Member Functions
...
...
src/OpenFOAM/db/IOstreams/Sstreams/OSstreamI.H
View file @
3135dcf2
...
...
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -32,14 +33,12 @@ License
inline
Foam
::
OSstream
::
OSstream
(
std
::
ostream
&
os
,
const
string
&
name
,
streamFormat
format
,
versionNumber
version
,
compressionType
compression
const
string
&
streamName
,
IOstreamOption
streamOpt
)
:
Ostream
(
format
,
version
,
compression
),
name_
(
n
ame
),
Ostream
(
streamOpt
),
name_
(
streamN
ame
),
os_
(
os
)
{
if
(
os_
.
good
())
...
...
src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C
View file @
3135dcf2
...
...
@@ -47,13 +47,11 @@ inline void Foam::prefixOSstream::checkWritePrefix()
Foam
::
prefixOSstream
::
prefixOSstream
(
std
::
ostream
&
os
,
const
string
&
name
,
streamFormat
format
,
versionNumber
version
,
compressionType
compression
const
string
&
streamName
,
IOstreamOption
streamOpt
)
:
OSstream
(
os
,
name
,
format
,
version
,
compression
),
OSstream
(
os
,
streamName
,
streamOpt
),
printPrefix_
(
true
),
prefix_
()
{}
...
...
src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H
View file @
3135dcf2
...
...
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -75,12 +76,23 @@ public:
prefixOSstream
(
std
::
ostream
&
os
,
const
string
&
name
,
streamFormat
format
=
ASCII
,
versionNumber
version
=
currentVersion
,
compressionType
compression
=
UNCOMPRESSED
const
string
&
streamName
,
IOstreamOption
streamOpt
=
IOstreamOption
()
);
//- Construct and set stream status
prefixOSstream
(
std
::
ostream
&
os
,
const
string
&
streamName
,
streamFormat
fmt
,
versionNumber
ver
=
currentVersion
,
compressionType
comp
=
compressionType
::
UNCOMPRESSED
)
:
prefixOSstream
(
os
,
streamName
,
IOstreamOption
(
fmt
,
comp
,
ver
))
{}
// Member Functions
...
...
src/OpenFOAM/db/Time/Time.H
View file @
3135dcf2
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -206,7 +206,7 @@ protected:
private:
//-
Default
write stream option (format,
version, compres
sion)
//-
The
write stream option (format,
compression, ver
sion)
IOstreamOption
writeStreamOption_
;
//- Default graph format
...
...
@@ -323,24 +323,30 @@ public:
return
path
()
/
timeName
();
}
//-
Default write format
IOstream
::
streamFormat
writeFormat
()
const
//-
The write stream option (format, compression, version)
IOstream
Option
writeStreamOption
()
const
{
return
writeStreamOption_
.
format
()
;
return
writeStreamOption_
;
}
//-
Default write version number
IOstream
::
versionNumber
writeVersion
()
const
//-
The write stream format
IOstream
::
streamFormat
writeFormat
()
const
{
return
writeStreamOption_
.
version
();
return
writeStreamOption_
.
format
();
}
//-
Default write
compression
//-
The write stream
compression
IOstream
::
compressionType
writeCompression
()
const
{
return
writeStreamOption_
.
compression
();
}
//- The write stream version
IOstream
::
versionNumber
writeVersion
()
const
{
return
writeStreamOption_
.
version
();
}
//- Default graph format
const
word
&
graphFormat
()
const
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment