# PhasicFlow: src/phasicFlow/streams/TStream/iTstream.hpp Source File

iTstream.hpp
Go to the documentation of this file.
#ifndef __iTstream_hpp__
#define __iTstream_hpp__
#include "iIstream.hpp"
#include "tokenList.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 iTstream
:
public iIstream
{
protected:
// - name of the stream
word name_;
// - list of tokens in this stream
tokenList tokenList_;
// - current token
tokenList::iterator currentToken_;
// - check if end of list is reached
bool isLastToken();
// - rewind the stream
void setFirstToken();
// - check for valid tokens in the tokenList
void validate();
public:
//- construct with a name
iTstream(const word& streamName);
// - construct with name and copy
iTstream(const word& streamName, const tokenList& tList);
// - construct with name and move
iTstream(const word& streamName, tokenList && tList);
// - copy construct
iTstream(const iTstream&) = default;
// - move construct
iTstream(iTstream&&) = default;
// - copy assignment
iTstream& operator=(const iTstream&) = default;
// - move assignment
iTstream& operator=(iTstream&&) = default;
// copy assignment from tokenList
void operator=(const tokenList& tList);
// move assignment from tokenList
void operator=(tokenList&& tList);
//- Destructor
virtual ~iTstream() = default;
//- Return the name of the stream
virtual const word& name() const;
//- Return non-const access to the name of the stream
virtual word& name();
//- Return next token from stream
virtual iIstream& read(token& t)override;
//- Read a character
virtual iIstream& read(char& c)override;
//- Read a word
virtual iIstream& read(word& str)override;
//- Read a string
virtual iIstream& readString(word& str)override;
//- Read a int64
virtual iIstream& read(int64&) override;
//- Read a int32
virtual iIstream& read(int32&) override;
//- Read a int16
virtual iIstream& read(int16&) override;
//- Read a int8
virtual iIstream& read(int8&) override;
//- Read a label
virtual iIstream& read(label&) override;
//- Read a uint32
virtual iIstream& read(uint32&) override;
//- Read a uint16
virtual iIstream& read(uint16&) override;
//- Read a floatScalar
virtual iIstream& read(float&) override;
//- Read a doubleScalar
virtual iIstream& read(double&) override;
// - Rewind the stream so that it may be read again
virtual void rewind();
// - reset the iTstream and make the stream empty
virtual void reset();
// - const access to token list
const tokenList& tokens()const;
// - size
size_t size()const;
// - size
size_t numTokens()const;
// - append a list of tokens to the end of tokens
// and rewind the stream
void appendTokens(const tokenList & tList);
// - append token to the end of token and rewind the stream
void appendToken(const token& t);
//- Return flags of output stream
ios_base::fmtflags flags() const
{
return ios_base::fmtflags(0);
}
//- Set flags of stream
ios_base::fmtflags flags(const ios_base::fmtflags)
{
return ios_base::fmtflags(0);
}
};
#include "helperTstream.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
pFlow::iTstream::flags
ios_base::fmtflags flags() const
Definition: iTstream.hpp:149
pFlow::iTstream::tokens
const tokenList & tokens() const
Definition: iTstream.cpp:323
pFlow::List< token >
pFlow::iTstream::flags
ios_base::fmtflags flags(const ios_base::fmtflags)
Definition: iTstream.hpp:155
pFlow::isBeginToken
bool isBeginToken(const token &tok)
pFlow::iTstream::isLastToken
bool isLastToken()
Definition: iTstream.cpp:6
pFlow::token
Definition: token.hpp:42
iIstream.hpp
pFlow::isEndToken
bool isEndToken(const token &tok)
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:59
helperTstream.hpp
pFlow::iTstream::reset
virtual void reset()
Definition: iTstream.cpp:315
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::iTstream::size
size_t size() const
Definition: iTstream.cpp:328
pFlow::int64
long long int int64
Definition: builtinTypes.hpp:55
pFlow::iTstream::rewind
virtual void rewind()
Definition: iTstream.cpp:307
pFlow::iTstream::setFirstToken
void setFirstToken()
Definition: iTstream.cpp:11
pFlow::iTstream::operator=
iTstream & operator=(const iTstream &)=default
pFlow::validTokenForStream
bool validTokenForStream(const token tok)
pFlow
Definition: demComponent.hpp:28
pFlow::iTstream::name_
word name_
Definition: iTstream.hpp:28
pFlow::iTstream::appendTokens
void appendTokens(const tokenList &tList)
Definition: iTstream.cpp:339
tokenList.hpp
pFlow::int16
short int int16
Definition: builtinTypes.hpp:51
pFlow::uint16
unsigned short int uint16
Definition: builtinTypes.hpp:57
pFlow::iIstream
Definition: iIstream.hpp:33
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::iTstream::tokenList_
tokenList tokenList_
Definition: iTstream.hpp:31
pFlow::iTstream::iTstream
iTstream(const word &streamName)
Definition: iTstream.cpp:32
pFlow::iTstream::name
virtual const word & name() const
Definition: iTstream.cpp:99
pFlow::List< token >::iterator
typename listType::iterator iterator
Definition: List.hpp:50
pFlow::iTstream::read
virtual iIstream & read(token &t) override
Definition: iTstream.cpp:111
pFlow::iTstream::validate
void validate()
Definition: iTstream.cpp:16
pFlow::iTstream
Definition: iTstream.hpp:21
pFlow::iTstream::appendToken
void appendToken(const token &t)
Definition: iTstream.cpp:352
pFlow::iTstream::~iTstream
virtual ~iTstream()=default
pFlow::iTstream::numTokens
size_t numTokens() const
Definition: iTstream.cpp:333
pFlow::iTstream::currentToken_
tokenList::iterator currentToken_
Definition: iTstream.hpp:34
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::int8
signed char int8
Definition: builtinTypes.hpp:49
pFlow::iTstream::readString
virtual iIstream & readString(word &str) override
Definition: iTstream.cpp:192