16 #ifndef INCLUDED_utility_io_mpistream_hh
17 #define INCLUDED_utility_io_mpistream_hh
32 namespace mpi_stream {
59 typename Tr = std::char_traits< Elem >,
60 typename ElemA = std::allocator< Elem >,
61 typename ByteT =
unsigned char,
62 typename ByteAT = std::allocator< ByteT >
65 public std::basic_streambuf< Elem, Tr >
82 using basic_streambuf_type::epptr;
83 using basic_streambuf_type::pbase;
84 using basic_streambuf_type::pptr;
90 std::size_t buffer_size_,
102 return flush(
false );
107 return flush(
true );
118 virtual std::streamsize
flush(
bool final );
136 typename Tr = std::char_traits< Elem >,
137 typename ElemA = std::allocator< Elem >,
138 typename ByteT =
unsigned char,
139 typename ByteAT = std::allocator< ByteT >
142 virtual public std::basic_ios< Elem, Tr >
164 m_buf( filename, buffer_size_, master_rank, append )
173 m_buf.release_file();
176 m_buf.print_header( header );
213 typename Tr = std::char_traits< Elem >,
214 typename ElemA = std::allocator< Elem >,
215 typename ByteT =
unsigned char,
216 typename ByteAT = std::allocator< ByteT >
220 public std::basic_ostream< Elem, Tr >
230 using ostream_type::flush;
247 std::stringstream& header,
267 ostream_type::setstate( std::ios_base::failbit );
284 template<
typename T >
289 static_cast< std::ostream &
>( *this ) << t;
300 static_cast< std::ostream &
>( *this ).
put( c );
311 static_cast< std::ostream &
>( *this ).
write( str, count );
318 ostream_type::flush();
351 #endif // INCLUDED_utility_io_mpistream_HPP
std::vector< char_type, char_allocator_type > char_vector_type
basic_mpi_ostream & operator<<(T const &t)
stream output
basic_mpi_ostreambase< Elem, Tr, ElemA, ByteT, ByteAT > mpi_ostreambase_type
int_type overflow(int_type c)
OVERFLOW.
std::basic_ostream< Elem, Tr > ostream_type
char_vector_type m_buffer
MPI_STREAM_MSG
messages to send to MpiFileBuffer
std::basic_streambuf< Elem, Tr > basic_streambuf_type
ElemA char_allocator_type
basic_mpi_ostream & write(char const *str, std::streamsize const count)
write a string
Base class for mpi ostreams.
bool send_to_master(char_type *, std::streamsize)
+++ SEND_TO_MASTER ++++
void print_header(std::string const &)
std::vector< byte_type, byte_allocator_type > byte_vector_type
static void put_long_as_uint32(ostream_reference out_, unsigned long x_)
std::basic_ostream< Elem, Tr > & ostream_reference
basic_mpi_ostream< char > mpi_ostream
void reset_state()
resets the mpi stream and zeros the crc
basic_mpi_ostream(std::string filename, int master_rank, std::stringstream &header, bool append=false, std::size_t buffer_size_=default_buffer_size)
Constructs a mpiper ostream decorator.
basic_mpi_ostream & flush()
std::string filename(const std::string &path)
basic_mpi_streambuf< Elem, Tr, ElemA, ByteT, ByteAT > mpi_streambuf_type
bool m_mpi_stream_finalized
tracks to see if mpi stream was finalized
virtual std::streamsize flush()
flushes the mpi buffer and output buffer
basic_mpi_ostream & put(char const c)
write char
basic_mpi_ostreambase(std::string filename, size_t buffer_size_, int master_rank, bool append)
Construct a mpi stream.
void print_header(std::string const &header)
ByteAT byte_allocator_type
const std::size_t default_buffer_size
Default gzip buffer size, change this to suite your needs.
virtual ~basic_mpi_streambuf()
std::basic_ostream< Elem, Tr > & ostream_reference
basic_mpi_streambuf(std::string filename, std::size_t buffer_size_, int master_rank_, bool append)
Construct a mpi stream.
MPI_FILE_STATUS
reported file status after opening
basic_mpi_ostream< wchar_t > mpi_wostream
void init()
set global 'init_was_called' to true
A stream decorator that takes raw input and zips it to a ostream.
std::basic_ostream< Elem, Tr > & ostream_reference
std::size_t fill_input_buffer()
byte_type * byte_buffer_type
virtual std::streamsize flush_final()
mpi_streambuf_type * rdbuf()
returns the underlying mpi ostream object