# PhasicFlow: src/phasicFlow/streams/Stream/Istream.hpp Source File
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.

Istream.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __Istream_hpp__
#define __Istream_hpp__
#include <limits>
#include <iostream>
#include "iIstream.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace pFlow
{
class Istream
:
public iIstream
{
//- Private Data
word name_;
std::istream& is_;
char nextValid();
void readWordToken(token& t);
// Handles "$var" and "${var}" forms, permits '/' scoping character.
Istream& readVariable(word& str);
void operator=(const Istream&) = delete;
public:
Istream( std::istream& is, const word& streamName, writeFormat wf = ASCII);
virtual ~Istream() = default;
virtual const word& name() const
{
return name_;
}
virtual word& name()
{
return name_;
}
virtual ios_base::fmtflags flags() const;
Istream& get(char& c);
int peek();
Istream& getLine(word& str, char delim = '\n');
std::streamsize getLine(std::nullptr_t, char delim = '\n');
Istream& putback(const char c);
virtual iIstream& read(token& t) override;
virtual iIstream& read(char& c) override;
virtual iIstream& read(word& str) override;
virtual iIstream& readString(word& str) override;
virtual iIstream& read(int64&) override;
virtual iIstream& read(int32&) override;
virtual iIstream& read(int8&) override;
virtual iIstream& read(uint64&) override;
virtual iIstream& read(uint32&) override;
virtual iIstream& read(uint8&) override;
virtual iIstream& read(float& val) override;
virtual iIstream& read(double& val) override;
iIstream& read(char* buffer, std::streamsize count) override;
size_t findBinaryBlockStart()override;
void rewind() override;
void seek(size_t pos) override;
size_t tell() override;
virtual ios_base::fmtflags flags(const ios_base::fmtflags flags);
virtual std::istream& stdStream()
{
return is_;
}
virtual const std::istream& stdStream() const
{
return is_;
}
};
}
#endif
pFlow::Istream::operator=
void operator=(const Istream &)=delete
No copy assignment.
pFlow::Istream::stdStream
virtual std::istream & stdStream()
Access to underlying std::istream.
Definition: Istream.hpp:173
pFlow::token
Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...
Definition: token.hpp:44
pFlow::Istream::nextValid
char nextValid()
Get the next valid character.
Definition: Istream.cpp:49
iIstream.hpp
pFlow::Istream::readWordToken
void readWordToken(token &t)
Read a word token.
Definition: Istream.cpp:127
pFlow::Istream::findBinaryBlockStart
size_t findBinaryBlockStart() override
It seek for a character sequence that indicates the start of a binary block char sequence is 255 255 ...
Definition: Istream.cpp:861
pFlow::Istream::tell
size_t tell() override
Return current position indicator.
Definition: Istream.cpp:911
pFlow::Istream::Istream
Istream(std::istream &is, const word &streamName, writeFormat wf=ASCII)
Construct wrapper around std::istream, set stream status.
Definition: Istream.cpp:304
pFlow::IOstream::ASCII
@ ASCII
Definition: IOstream.hpp:61
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::Istream::name
virtual word & name()
Return non-const access to the name of the stream.
Definition: Istream.hpp:87
pFlow::int64
long long int int64
Definition: builtinTypes.hpp:52
pFlow::Istream::name
virtual const word & name() const
Return the name of the stream.
Definition: Istream.hpp:81
pFlow
Definition: demGeometry.hpp:27
pFlow::Istream::seek
void seek(size_t pos) override
Definition: Istream.cpp:902
pFlow::Istream::readString
virtual iIstream & readString(word &str) override
Read a string.
Definition: Istream.cpp:680
pFlow::Istream
Standard input stream for binary and ascii data.
Definition: Istream.hpp:39
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::Istream::readVariable
Istream & readVariable(word &str)
Read a variable name starting with '$'.
Definition: Istream.cpp:141
pFlow::int32
int int32
Definition: builtinTypes.hpp:50
pFlow::Istream::read
virtual iIstream & read(token &t) override
Return next token from stream.
Definition: Istream.cpp:392
pFlow::Istream::~Istream
virtual ~Istream()=default
Destructor.
pFlow::count
auto count(const Vector< T, Allocator > &vec, const T &val)
Definition: VectorAlgorithm.hpp:26
pFlow::Istream::get
Istream & get(char &c)
Raw, low-level get character function.
Definition: Istream.cpp:325
pFlow::Istream::rewind
void rewind() override
Rewind the stream so that it may be read again.
Definition: Istream.cpp:891
pFlow::Istream::name_
word name_
Stream name.
Definition: Istream.hpp:46
pFlow::uint64
unsigned long long int uint64
Definition: builtinTypes.hpp:58
pFlow::int8
signed char int8
Definition: builtinTypes.hpp:48
pFlow::Istream::peek
int peek()
Raw, low-level peek function.
Definition: Istream.cpp:339
pFlow::IOstream::writeFormat
writeFormat
Definition: IOstream.hpp:59
pFlow::Istream::flags
virtual ios_base::fmtflags flags() const
Return flags of output stream.
Definition: Istream.cpp:927
pFlow::Istream::stdStream
virtual const std::istream & stdStream() const
Const access to underlying std::istream.
Definition: Istream.hpp:179
pFlow::Istream::putback
Istream & putback(const char c)
Raw, low-level putback character function.
Definition: Istream.cpp:375
pFlow::Istream::getLine
Istream & getLine(word &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
Definition: Istream.cpp:345
pFlow::uint8
unsigned char uint8
Definition: builtinTypes.hpp:54
pFlow::Istream::is_
std::istream & is_
Input stream.
Definition: Istream.hpp:49