1 #ifndef DUNE_FEM_ASCIISTREAMS_HH 2 #define DUNE_FEM_ASCIISTREAMS_HH 49 using BaseType::writeError;
58 mustFreeStream_( false )
66 : stream_( *(new
std :: ofstream( filename.c_str() )) ),
67 mustFreeStream_( true )
86 stream_.setf( std ::ios_base :: scientific, std :: ios_base :: floatfield );
87 stream_ .precision( 16 );
88 stream_ << value << std :: endl;
96 stream_.setf( std ::ios_base :: scientific, std :: ios_base :: floatfield );
97 stream_ .precision( 7 );
98 stream_ << value << std :: endl;
106 stream_ << value << std :: endl;
115 int val = (int) value;
122 std::string val( ( value ==
true ) ?
"true" :
"false" );
133 const unsigned int length = s.length();
135 for(
unsigned int i = 0; i < length; ++i )
136 stream_.put( s[ i ] );
137 stream_ << std :: endl;
145 stream_ << value << std::endl;
153 stream_ << value << std::endl;
161 return stream_.good() | stream_.eof();
198 using BaseType::readError;
207 mustFreeStream_( false )
215 : stream_( *(new
std :: ifstream( filename.c_str() )) ),
216 mustFreeStream_( true )
222 if( mustFreeStream_ )
266 else if ( val ==
"false" )
281 for(
unsigned int i = 0; i < length; ++i )
306 return stream_.good() | stream_.eof();
314 #endif // #ifndef DUNE_FEM_ASCIISTREAMS_HH std::istream & stream_
Definition: asciistreams.hh:194
~ASCIIOutStream()
destructor
Definition: asciistreams.hh:71
void writeUnsignedInt(unsigned int value)
write an unsigned int to the stream
Definition: asciistreams.hh:143
void writeUnsignedInt64(uint64_t value)
write an uint64_t to the stream
Definition: asciistreams.hh:151
input stream reading from an STL input stream using ASCII decoding
Definition: asciistreams.hh:183
Definition: asciistreams.hh:18
ASCIIInStream(std::istream &stream)
constructor
Definition: asciistreams.hh:205
void flush()
flush the stream
Definition: asciistreams.hh:78
void readUnsignedInt(unsigned int &value)
read an unsigned int from the stream
Definition: asciistreams.hh:288
bool valid() const
Definition: asciistreams.hh:304
void readUnsignedInt64(uint64_t &value)
read an uint64_t from the stream
Definition: asciistreams.hh:296
ASCIIOutStream OutStreamType
Definition: asciistreams.hh:20
void readChar(char &value)
read a char from the stream
Definition: asciistreams.hh:251
ASCIIInStream(const std::string &filename)
constructor
Definition: asciistreams.hh:214
output stream writing into an STL output stream using ASCII encoding
Definition: asciistreams.hh:34
bool mustFreeStream_
Definition: asciistreams.hh:46
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: asciistreams.hh:277
void writeChar(const char value)
write a char to the stream
Definition: asciistreams.hh:112
~ASCIIInStream()
destructor
Definition: asciistreams.hh:220
ASCIIInStreamTraits Traits
type of the traits
Definition: asciistreams.hh:191
ASCIIInStream InStreamType
Definition: asciistreams.hh:169
std::ostream & stream_
Definition: asciistreams.hh:45
ASCIIOutStream(std::ostream &stream)
constructor
Definition: asciistreams.hh:56
Definition: asciistreams.hh:167
void readInt(int &value)
read an int from the stream
Definition: asciistreams.hh:243
void writeString(const std::string &s)
write a string to the stream
Definition: asciistreams.hh:131
void readDouble(double &value)
read a double from the stream
Definition: asciistreams.hh:227
void writeFloat(const float value)
write a float to the stream
Definition: asciistreams.hh:94
void writeBool(const bool value)
write a char to the stream
Definition: asciistreams.hh:120
void writeInt(const int value)
write an int to the stream
Definition: asciistreams.hh:104
void writeDouble(const double value)
write a double to the stream
Definition: asciistreams.hh:84
void readFloat(float &value)
read a float from the stream
Definition: asciistreams.hh:235
ASCIIOutStreamTraits Traits
type of the traits
Definition: asciistreams.hh:42
bool mustFreeStream_
Definition: asciistreams.hh:195
void readBool(bool &value)
read a bool from the stream
Definition: asciistreams.hh:259
bool valid() const
Definition: asciistreams.hh:159
abstract interface for an output stream
Definition: streams.hh:44
ASCIIOutStream(const std::string &filename)
constructor
Definition: asciistreams.hh:65