1#ifndef DUNE_FEM_STREAMS_HH
2#define DUNE_FEM_STREAMS_HH
10#include <dune/common/exceptions.hh>
43 template<
class TraitsImp >
71 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
flush() );
98 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
writeInt( value ) );
107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
writeChar( value ) );
116 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
writeBool( value ) );
149 DUNE_THROW(
StreamError,
"Unable to write to stream." );
176 template<
class TraitsImp >
203 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
readDouble( value ) );
223 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
readFloat( value ) );
243 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
readInt( value ) );
263 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
readChar( value ) );
284 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
asImp().
readBool( value ) );
350 DUNE_THROW(
StreamError,
"Unable to read from stream." );
357 template <
class StreamImpl>
369 static StreamImpl*
create(
const std::string& filename,
373 return new StreamImpl( filename );
Definition: bindguard.hh:11
Definition: streams.hh:21
abstract interface for an output stream
Definition: streams.hh:46
void writeBool(const bool value)
write a bool to the stream
Definition: streams.hh:114
Traits::OutStreamType OutStreamType
type of the implementation (Barton-Nackman)
Definition: streams.hh:55
void writeInt(const int value)
write an int to the stream
Definition: streams.hh:96
void flush()
flush the stream
Definition: streams.hh:69
void writeChar(const char value)
write a char to the stream
Definition: streams.hh:105
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37
void writeUnsignedInt(unsigned int value)
write an unsigned int to the stream
Definition: streams.hh:132
void writeDouble(const double value)
write a double to the stream
Definition: streams.hh:78
void writeString(const std::string &s)
write a string to the stream
Definition: streams.hh:123
void writeFloat(const float value)
write a float to the stream
Definition: streams.hh:87
void writeError() const
Definition: streams.hh:147
ThisType OutStreamInterfaceType
type of the interface
Definition: streams.hh:58
TraitsImp Traits
type of the traits
Definition: streams.hh:52
void writeUnsignedInt64(uint64_t value)
write an uint64_t to the stream
Definition: streams.hh:141
abstract interface for an input stream
Definition: streams.hh:179
void readUnsignedInt(unsigned int &value)
read an unsigned int from the stream
Definition: streams.hh:311
double readDouble()
read a double from the stream
Definition: streams.hh:210
bool readBool()
read a bool from the stream
Definition: streams.hh:291
float readFloat()
read a double from the stream
Definition: streams.hh:230
void readError() const
Definition: streams.hh:348
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37
Traits::InStreamType InStreamType
type of the implementation (Barton-Nackman)
Definition: streams.hh:188
ThisType InStreamInterfaceType
type of the interface
Definition: streams.hh:191
void readString(std::string &s)
read a string from the stream
Definition: streams.hh:302
void readInt(int &value)
read an int from the stream
Definition: streams.hh:241
void readDouble(double &value)
read a double from the stream
Definition: streams.hh:201
void readFloat(float &value)
read a float from the stream
Definition: streams.hh:221
void readChar(char &value)
read a char from the stream
Definition: streams.hh:261
TraitsImp Traits
type of the traits
Definition: streams.hh:185
int readChar()
read a char from the stream
Definition: streams.hh:270
unsigned int readUnsignedInt()
read an unsigned int from the stream
Definition: streams.hh:320
void readUnsignedInt64(uint64_t &value)
read an uint64_t from the stream
Definition: streams.hh:331
int readInt()
read an int from the stream
Definition: streams.hh:250
uint64_t readUnsignedInt64()
read an uint64_t from the stream
Definition: streams.hh:340
void readBool(bool &value)
read a bool from the stream
Definition: streams.hh:282
Factory class for Fem Streams to deal with different constructor parameters.
Definition: streams.hh:359
static StreamImpl * create(const std::string &filename, const int rank=MPIManager::rank(), const MPICommunicatorType &mpiComm=MPIHelper ::getCommunicator())
return pointer to stream object created by new.
Definition: streams.hh:369
MPIHelper::MPICommunicator MPICommunicatorType
type of MPI communicator
Definition: streams.hh:361
Definition: bartonnackmaninterface.hh:17
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37
static int rank()
Definition: mpimanager.hh:401