1 #ifndef DUNE_FEM_STREAMS_HH 2 #define DUNE_FEM_STREAMS_HH 10 #include <dune/common/exceptions.hh> 43 template<
class TraitsImp >
61 using BaseType::asImp;
71 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().flush() );
80 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().writeDouble( value ) );
89 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().writeFloat( value ) );
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 ) );
125 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().writeString( s ) );
134 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().writeUnsignedInt( value ) );
143 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().writeUnsignedInt64( value ) );
149 DUNE_THROW(
StreamError,
"Unable to write to stream." );
176 template<
class TraitsImp >
194 using BaseType::asImp;
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 ) );
304 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().readString( s ) );
313 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().readUnsignedInt( value ) );
323 readUnsignedInt( value );
333 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().readUnsignedInt64( value ) );
343 readUnsignedInt64( value );
350 DUNE_THROW(
StreamError,
"Unable to read from stream." );
357 template <
class StreamImpl>
369 static StreamImpl*
create(
const std::string& filename,
371 const MPICommunicatorType& mpiComm = MPIHelper :: getCommunicator() )
373 return new StreamImpl( filename );
383 #endif // #ifndef DUNE_FEM_STREAMS_HH int readInt()
read an int from the stream
Definition: streams.hh:250
void readBool(bool &value)
read a bool from the stream
Definition: streams.hh:282
void writeDouble(const double value)
write a double to the stream
Definition: streams.hh:78
input stream reading from an STL input stream using ASCII decoding
Definition: asciistreams.hh:183
MPIHelper::MPICommunicator MPICommunicatorType
type of MPI communicator
Definition: streams.hh:361
bool readBool()
read a bool from the stream
Definition: streams.hh:291
static int rank()
Definition: mpimanager.hh:116
ThisType OutStreamInterfaceType
type of the interface
Definition: streams.hh:58
void readError() const
Definition: streams.hh:348
void writeError() const
Definition: streams.hh:147
unsigned int readUnsignedInt()
read an unsigned int from the stream
Definition: streams.hh:320
Traits::OutStreamType OutStreamType
type of the implementation (Barton-Nackman)
Definition: streams.hh:55
TraitsImp Traits
type of the traits
Definition: streams.hh:185
void writeUnsignedInt64(uint64_t value)
write an uint64_t to the stream
Definition: streams.hh:141
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
void writeBool(const bool value)
write a bool to the stream
Definition: streams.hh:114
void flush()
flush the stream
Definition: streams.hh:69
void writeChar(const char value)
write a char to the stream
Definition: streams.hh:105
void readUnsignedInt64(uint64_t &value)
read an uint64_t from the stream
Definition: streams.hh:331
void writeInt(const int value)
write an int to the stream
Definition: streams.hh:96
Factory class for Fem Streams to deal with different constructor parameters.
Definition: streams.hh:358
Definition: coordinate.hh:4
abstract interface for an input stream
Definition: streams.hh:177
void readString(std::string &s)
read a string from the stream
Definition: streams.hh:302
ThisType InStreamInterfaceType
type of the interface
Definition: streams.hh:191
void readUnsignedInt(unsigned int &value)
read an unsigned int from the stream
Definition: streams.hh:311
float readFloat()
read a double from the stream
Definition: streams.hh:230
TraitsImp Traits
type of the traits
Definition: streams.hh:52
double readDouble()
read a double from the stream
Definition: streams.hh:210
void readChar(char &value)
read a char from the stream
Definition: streams.hh:261
Traits::InStreamType InStreamType
type of the implementation (Barton-Nackman)
Definition: streams.hh:188
void readFloat(float &value)
read a float from the stream
Definition: streams.hh:221
Definition: virtualstreams.hh:70
uint64_t readUnsignedInt64()
read an uint64_t from the stream
Definition: streams.hh:340
void readDouble(double &value)
read a double from the stream
Definition: streams.hh:201
int readChar()
read a char from the stream
Definition: streams.hh:270
void writeString(const std::string &s)
write a string to the stream
Definition: streams.hh:123
Definition: streams.hh:21
void writeUnsignedInt(unsigned int value)
write an unsigned int to the stream
Definition: streams.hh:132
void readInt(int &value)
read an int from the stream
Definition: streams.hh:241
abstract interface for an output stream
Definition: streams.hh:44
void writeFloat(const float value)
write a float to the stream
Definition: streams.hh:87
Definition: bartonnackmaninterface.hh:15