www.cemf.ir
fileStream.hpp
Go to the documentation of this file.
1
/*------------------------------- phasicFlow ---------------------------------
2
O C enter of
3
O O E ngineering and
4
O O M ultiscale modeling of
5
OOOOOOO F luid flow
6
------------------------------------------------------------------------------
7
Copyright (C): www.cemf.ir
8
email: hamid.r.norouzi AT gmail.com
9
------------------------------------------------------------------------------
10
Licence:
11
This file is part of phasicFlow code. It is a free software for simulating
12
granular and multiphase flows. You can redistribute it and/or modify it under
13
the terms of GNU General Public License v3 or any other later versions.
14
15
phasicFlow is distributed to help others in their research in the field of
16
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
19
-----------------------------------------------------------------------------*/
20
// based on OpenFOAM stream, with some modifications/simplifications
21
// to be tailored to our needs
22
23
24
#ifndef __fileStream_hpp__
25
#define __fileStream_hpp__
26
27
28
#include <fstream>
29
30
#include "
fileSystem.hpp
"
31
#include "
uniquePtr.hpp
"
32
33
namespace
pFlow
34
{
35
36
class
fileStream
37
{
38
protected
:
39
40
// - in file stream
41
uniquePtr<std::ifstream>
inStream_
;
42
43
// - out file stream
44
uniquePtr<std::ofstream>
outStream_
;
45
46
bool
binary_
=
false
;
47
48
// - open input file
49
void
openInFile
(
const
fileSystem
& path);
50
51
// - open output file
52
void
openOutFile
(
const
fileSystem
& path);
53
54
// - close streams
55
void
close
();
56
57
public
:
58
59
// - Constructors
60
61
fileStream
(
const
fileSystem
& path,
bool
outStream
=
false
,
bool
binary =
false
);
62
63
fileStream
(
const
fileStream
&)=
delete
;
64
65
fileStream
&
operator=
(
const
fileStream
&)=
delete
;
66
67
virtual
~fileStream
()
68
{
69
close
();
70
}
71
72
73
// - access
74
75
std::ifstream&
inStream
();
76
77
std::ofstream&
outStream
();
78
79
};
80
81
}
82
83
#endif
pFlow::fileStream::outStream_
uniquePtr< std::ofstream > outStream_
Definition:
fileStream.hpp:44
pFlow::fileStream::openInFile
void openInFile(const fileSystem &path)
Definition:
fileStream.cpp:30
pFlow::fileStream::close
void close()
Definition:
fileStream.cpp:92
pFlow::fileStream::operator=
fileStream & operator=(const fileStream &)=delete
pFlow::fileStream::fileStream
fileStream(const fileSystem &path, bool outStream=false, bool binary=false)
Definition:
fileStream.cpp:106
pFlow::fileStream::~fileStream
virtual ~fileStream()
Definition:
fileStream.hpp:67
fileSystem.hpp
pFlow
Definition:
demComponent.hpp:28
pFlow::fileSystem
Definition:
fileSystem.hpp:63
pFlow::fileStream::outStream
std::ofstream & outStream()
Definition:
fileStream.cpp:132
uniquePtr.hpp
pFlow::fileStream::binary_
bool binary_
Definition:
fileStream.hpp:46
pFlow::fileStream::inStream_
uniquePtr< std::ifstream > inStream_
Definition:
fileStream.hpp:41
pFlow::fileStream
Definition:
fileStream.hpp:36
pFlow::uniquePtr< std::ifstream >
pFlow::fileStream::openOutFile
void openOutFile(const fileSystem &path)
Definition:
fileStream.cpp:61
pFlow::fileStream::inStream
std::ifstream & inStream()
Definition:
fileStream.cpp:127
src
phasicFlow
streams
Fstream
fileStream.hpp
Generated by
1.8.17