# PhasicFlow: src/phasicFlow/streams/TStream/oTstream.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.

oTstream.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 __oTstream_hpp__
#define __oTstream_hpp__
#include "tokenList.hpp"
#include "iOstream.hpp"
namespace pFlow
{
//- Helper functions declearation
inline bool validTokenForStream(const token tok);
inline bool isBeginToken(const token& tok);
inline bool isEndToken(const token& tok);
class oTstream
:
public iOstream
{
protected:
word name_;
tokenList tokenList_;
public:
oTstream(const word& nm);
oTstream(const oTstream& src);
oTstream(oTstream&&) = default;
virtual ~oTstream() = default;
// Give const access
const tokenList& tokens()const;
// Give access
tokenList& tokens();
virtual bool write(const token& tok);
virtual iOstream& write(const char c);
virtual iOstream& write(const char* str);
virtual iOstream& write(const word& str);
virtual iOstream& writeQuoted(const std::string& str, const bool quoted=true );
virtual iOstream& write(const int64 val) override;
virtual iOstream& write(const int32 val) override;
virtual iOstream& write(const int8 val) override;
virtual iOstream& write(const uint64 val) override;
virtual iOstream& write(const uint32 val) override;
virtual iOstream& write(const uint8 val) override;
virtual iOstream& write(const float val) override;
virtual iOstream& write(const double val) override;
virtual iOstream& write(const size_t val) override;
void seek(size_t pos) override;
iOstream& write(
const char* binaryData,
std::streamsize count) override;
virtual void append(const token& tok);
virtual void append(const tokenList& tLisk);
void reset();
virtual void rewind();
virtual void indent()
{}
virtual void startOfBinaryStreaming()
{}
virtual void endOfBinaryStreaming()
{}
virtual void flush()
{}
virtual void endl()
{}
virtual char fill() const
{
return 0;
}
virtual char fill(const char)
{
return 0;
}
virtual int width() const
{
return 0;
}
virtual int width(const int)
{
return 0;
}
virtual int precision() const
{
return 0;
}
virtual int precision(const int)
{
return 0;
}
virtual ios_base::fmtflags flags() const
{
return ios_base::fmtflags(0);
}
ios_base::fmtflags flags(const ios_base::fmtflags)
{
return ios_base::fmtflags(0);
}
};
#include "helperTstream.hpp"
} // End namespace pFlow
#endif
pFlow::oTstream::flags
ios_base::fmtflags flags(const ios_base::fmtflags)
Set flags of stream.
Definition: oTstream.hpp:224
pFlow::oTstream
Output token stream.
Definition: oTstream.hpp:48
pFlow::List< token >
pFlow::isBeginToken
bool isBeginToken(const token &tok)
Is tok a begin token?
pFlow::token
Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...
Definition: token.hpp:44
pFlow::oTstream::name_
word name_
name of stream
Definition: oTstream.hpp:56
pFlow::oTstream::endl
virtual void endl()
Add newline and flush stream.
Definition: oTstream.hpp:175
pFlow::oTstream::startOfBinaryStreaming
virtual void startOfBinaryStreaming()
Add a new line and flush stream.
Definition: oTstream.hpp:163
pFlow::oTstream::endOfBinaryStreaming
virtual void endOfBinaryStreaming()
Reach end of file add a new line and flush stream.
Definition: oTstream.hpp:167
pFlow::isEndToken
bool isEndToken(const token &tok)
Is tok an end token?
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
helperTstream.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::oTstream::append
virtual void append(const token &tok)
append token to the stream
Definition: oTstream.cpp:181
pFlow::int64
long long int int64
Definition: builtinTypes.hpp:52
pFlow::oTstream::width
virtual int width(const int)
Set width of output field.
Definition: oTstream.hpp:199
pFlow::oTstream::indent
virtual void indent()
Add indentation characters.
Definition: oTstream.hpp:159
pFlow::oTstream::precision
virtual int precision() const
Get precision of output field.
Definition: oTstream.hpp:205
pFlow::oTstream::seek
void seek(size_t pos) override
Definition: oTstream.cpp:176
pFlow::oTstream::flush
virtual void flush()
Flush stream.
Definition: oTstream.hpp:171
pFlow::oTstream::reset
void reset()
Reset the output buffer and rewind the stream.
Definition: oTstream.cpp:196
pFlow::oTstream::fill
virtual char fill(const char)
Set padding character for formatted field up to field width.
Definition: oTstream.hpp:186
pFlow::oTstream::fill
virtual char fill() const
Get the current padding character.
Definition: oTstream.hpp:180
pFlow::oTstream::tokens
const tokenList & tokens() const
Definition: oTstream.cpp:32
pFlow::validTokenForStream
bool validTokenForStream(const token tok)
Is tok a valid token for this stream?
pFlow
Definition: demGeometry.hpp:27
pFlow::oTstream::oTstream
oTstream(const word &nm)
emtpy stream with a name
Definition: oTstream.cpp:6
tokenList.hpp
pFlow::oTstream::flags
virtual ios_base::fmtflags flags() const
Return flags of output stream.
Definition: oTstream.hpp:218
pFlow::oTstream::width
virtual int width() const
Get width of output field.
Definition: oTstream.hpp:192
pFlow::int32
int int32
Definition: builtinTypes.hpp:50
pFlow::count
auto count(const Vector< T, Allocator > &vec, const T &val)
Definition: VectorAlgorithm.hpp:26
pFlow::oTstream::rewind
virtual void rewind()
Rewind the output stream.
Definition: oTstream.cpp:202
pFlow::oTstream::writeQuoted
virtual iOstream & writeQuoted(const std::string &str, const bool quoted=true)
Write std::string surrounded by quotes.
Definition: oTstream.cpp:86
pFlow::oTstream::precision
virtual int precision(const int)
Set precision of output field.
Definition: oTstream.hpp:212
pFlow::uint64
unsigned long long int uint64
Definition: builtinTypes.hpp:58
pFlow::int8
signed char int8
Definition: builtinTypes.hpp:48
pFlow::oTstream::write
virtual bool write(const token &tok)
Write token to stream or otherwise handle it.
Definition: oTstream.cpp:44
pFlow::oTstream::~oTstream
virtual ~oTstream()=default
destructor
iOstream.hpp
pFlow::uint8
unsigned char uint8
Definition: builtinTypes.hpp:54
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::oTstream::tokenList_
tokenList tokenList_
tokenList
Definition: oTstream.hpp:59