# PhasicFlow: fileStream Class Reference
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

fileStream Class Reference

Creates and manages an input/output file stream with specified format. More...

Inheritance diagram for fileStream:
[legend]
Collaboration diagram for fileStream:
[legend]

## Public Member Functions

| fileStream (const fileSystem &path, bool outStream=false, bool binary=false, bool append=false)
| From file path and input type and format. More...
| fileStream (const fileStream &)=delete
| No copy. More...
fileStream & | operator= (const fileStream &)=delete
| No assignment. More...
virtual | ~fileStream ()
| Destructor. More...
std::ifstream & | inStream ()
| Access input file stream. More...
std::ofstream & | outStream ()
| Access output file stream. More...

## Protected Member Functions

void | openInFile (const fileSystem &path)
| open input file More...
void | openOutFile (const fileSystem &path)
| open output file More...
void | close ()
| close streams More...

## Protected Attributes

uniquePtr< std::ifstream > | inStream_
| in file stream More...
uniquePtr< std::ofstream > | outStream_
| out file stream More...
bool | binary_ = false
bool | append_ = false

## Detailed Description

Creates and manages an input/output file stream with specified format.

It is based on OpenFOAM stream, with some modifications/simplifications to be tailored to our needs.

Definition at line 43 of file fileStream.hpp.

## Constructor & Destructor Documentation

## fileStream() [1/2]

fileStream | ( | const fileSystem & | path,
|  | bool | outStream = `false`,
|  | bool | binary = `false`,
|  | bool | append = `false`
| ) |  |

From file path and input type and format.

Definition at line 120 of file fileStream.cpp.

## fileStream() [2/2]

fileStream | ( | const fileStream & |  | ) |

delete

No copy.

## ~fileStream()

virtual ~fileStream | ( |  | ) |

inlinevirtual

Destructor.

Definition at line 80 of file fileStream.hpp.

References fileStream::close().

Here is the call graph for this function:

## Member Function Documentation

## openInFile()

void openInFile | ( | const fileSystem & | path | ) |

protected

open input file

Definition at line 27 of file fileStream.cpp.

References fileSystem::exist(), fatalErrorInFunction, fatalExit, and fileSystem::wordPath().

Here is the call graph for this function:

## openOutFile()

void openOutFile | ( | const fileSystem & | path | ) |

protected

open output file

Definition at line 58 of file fileStream.cpp.

References fileSystem::createDirs(), fileSystem::dirPath(), fatalErrorInFunction, fatalExit, and fileSystem::wordPath().

Here is the call graph for this function:

## close()

void close | ( |  | ) |

protected

close streams

Definition at line 106 of file fileStream.cpp.

References fileStream::inStream_, and fileStream::outStream_.

Referenced by fileStream::~fileStream().

Here is the caller graph for this function:

## operator=()

fileStream& operator= | ( | const fileStream & |  | ) |

delete

No assignment.

## inStream()

std::ifstream & inStream | ( |  | ) |

Access input file stream.

Definition at line 143 of file fileStream.cpp.

## outStream()

std::ofstream & outStream | ( |  | ) |

Access output file stream.

Definition at line 148 of file fileStream.cpp.

## Member Data Documentation

## inStream_

uniquePtr<std::ifstream> inStream_

protected

in file stream

Definition at line 48 of file fileStream.hpp.

Referenced by fileStream::close().

## outStream_

uniquePtr<std::ofstream> outStream_

protected

out file stream

Definition at line 51 of file fileStream.hpp.

Referenced by fileStream::close().

## binary_

bool binary_ = false

protected

Definition at line 53 of file fileStream.hpp.

## append_

bool append_ = false

protected

Definition at line 55 of file fileStream.hpp.

The documentation for this class was generated from the following files:

- src/phasicFlow/streams/Fstream/fileStream.hpp
- src/phasicFlow/streams/Fstream/fileStream.cpp