Rosetta 3.3
Public Types | Public Member Functions
utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT > Class Template Reference

A mpiper ostream. More...

#include <mpistream.hh>

Inheritance diagram for utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >:
Inheritance graph
[legend]
Collaboration diagram for utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef basic_mpi_ostreambase
< Elem, Tr, ElemA, ByteT,
ByteAT > 
mpi_ostreambase_type
typedef std::basic_ostream
< Elem, Tr > 
ostream_type
typedef std::basic_ostream
< Elem, Tr > & 
ostream_reference
typedef Elem char_type

Public Member Functions

 basic_mpi_ostream (std::string filename, int master_rank, std::stringstream &header, bool append=false, size_t buffer_size_=default_buffer_size)
 Constructs a mpiper ostream decorator.
void close ()
 ~basic_mpi_ostream ()
template<typename T >
basic_mpi_ostreamoperator<< (T const &t)
 stream output
basic_mpi_ostreamput (char const c)
 write char
basic_mpi_ostreamwrite (char const *str, std::streamsize const count)
 write a string

Detailed Description

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
class utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >

A mpiper ostream.

Remarks:

This class is a ostream decorator that behaves 'almost' like any other ostream.

At construction, it takes any ostream that shall be used to output of the compressed data.

When finished, you need to call the special method zflush or call the destructor to flush all the intermidiate streams.

Example:

 // creating the target mpi string, could be a fstream
 ostringstream ostringstream_;
 // creating the mpi layer
 mpi_ostream mpiper(ostringstream_);


 // writing data
 mpiper<<f<<" "<<d<<" "<<ui<<" "<<ul<<" "<<us<<" "<<c<<" "<<dum;
 // mpi ostream needs special flushing...
 mpiper.zflush();

Member Typedef Documentation

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef Elem utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::char_type
template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef basic_mpi_ostreambase< Elem, Tr, ElemA, ByteT, ByteAT > utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::mpi_ostreambase_type
template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef std::basic_ostream< Elem, Tr >& utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::ostream_reference
template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef std::basic_ostream< Elem, Tr > utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::ostream_type

Constructor & Destructor Documentation

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::basic_mpi_ostream ( std::string  filename,
int  master_rank,
std::stringstream &  header,
bool  append = false,
size_t  buffer_size_ = default_buffer_size 
) [inline]

Constructs a mpiper ostream decorator.

Parameters:
ostream_ostream where the compressed output is written
is_gmpi_true if gmpi header and footer have to be added
level_level of compression 0, bad and fast, 9, good and slower,
strategy_compression strategy
window_size_see zlib doc
memory_level_see zlib doc
buffer_size_the buffer size used to mpi data
Note:
When is_gmpi_ is true, a gmpi header and footer is automatically added

References utility::io::mpi_stream::basic_mpi_ostreambase< Elem, Tr, ElemA, ByteT, ByteAT >::file_status(), utility::io::mpi_stream::MPI_FAIL, utility::io::mpi_stream::MPI_SUCCESS_NEW, and utility::io::mpi_stream::basic_mpi_ostreambase< Elem, Tr, ElemA, ByteT, ByteAT >::print_header().

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::~basic_mpi_ostream ( ) [inline]

Member Function Documentation

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
void utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::close ( ) [inline]
template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
template<typename T >
basic_mpi_ostream& utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::operator<< ( T const &  t) [inline]

stream output

if mpi stream has been finalized, will reset

the stream and add header if necessary

References sd::t.

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
basic_mpi_ostream& utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::put ( char const  c) [inline]

write char

if mpi stream has been finalized, will reset

the stream and add header if necessary

References utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::put().

Referenced by utility::io::ozstream::put(), and utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::put().

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
basic_mpi_ostream& utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::write ( char const *  str,
std::streamsize const  count 
) [inline]

write a string

if mpi stream has been finalized, will reset

the stream and add header if necessary

References utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::write().

Referenced by utility::io::ozstream::write(), and utility::io::mpi_stream::basic_mpi_ostream< Elem, Tr, ElemA, ByteT, ByteAT >::write().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines