GMPI::buffer_t< Base_t > Class Template Reference

#include <gmpi.hpp>

List of all members.

Public Types

typedef Base_t base_t
 The base type of the buffer.

Public Member Functions

 buffer_t ()
 Set an empty configuration.
 buffer_t (size_t n)
 Reserve n entries of base type at the beginning.
void reserve (size_t n)
 Reserve memory for another n entries of base type.
bool empty () const
 Whether all data is read.
size_t remaining () const
 The number of remaining entries to read.
Base_t read () const
 Read one entry of base type from buffer.
void unread () const
 Undo effect of last reading.
void write (Base_t output)
 Write one entry of base type into buffer.
void load (Base_t *address, size_t n) const
 Load n entries from the buffer into address.
void store (Base_t *address, size_t n)
 Store n entries from address into the buffer.
size_t size () const
 Buffer size, e.g. to send or receive data.
Base_t * address ()
 Buffer address (as non-const), e.g. to receive data.
const Base_t * buffer_address () const
 Buffer address (as const), e.g. to send data.
void free ()
 Explicit memory release.

Public Attributes

MPI::Datatype mpi_t
 MPI data type used in operations.
const int base_t_size
 Base type's size in byte.

Private Attributes

vector< Base_t > my_buffer
size_t write_pos
size_t read_pos
bool read_write


Detailed Description

template<typename Base_t>
class GMPI::buffer_t< Base_t >

Definition at line 47 of file gmpi.hpp.


Member Typedef Documentation

template<typename Base_t>
typedef Base_t GMPI::buffer_t< Base_t >::base_t

The base type of the buffer.

Definition at line 49 of file gmpi.hpp.


Constructor & Destructor Documentation

template<typename Base_t>
GMPI::buffer_t< Base_t >::buffer_t (  )  [inline]

Set an empty configuration.

Definition at line 59 of file gmpi.hpp.

template<typename Base_t>
GMPI::buffer_t< Base_t >::buffer_t ( size_t  n  )  [inline]

Reserve n entries of base type at the beginning.

Definition at line 63 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::reserve().

Here is the call graph for this function:


Member Function Documentation

template<typename Base_t>
void GMPI::buffer_t< Base_t >::reserve ( size_t  n  )  [inline]

Reserve memory for another n entries of base type.

Definition at line 68 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::my_buffer, GMPI::buffer_t< Base_t >::read_write, and GMPI::buffer_t< Base_t >::write_pos.

Referenced by GMPI::Intracomm::Bcast(), GMPI::buffer_t< Base_t >::buffer_t(), GMPI::Comm::Recv(), GMPI::buffer_t< Base_t >::store(), and GMPI::buffer_t< Base_t >::write().

template<typename Base_t>
bool GMPI::buffer_t< Base_t >::empty (  )  const [inline]

Whether all data is read.

Definition at line 74 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::read_pos, and GMPI::buffer_t< Base_t >::write_pos.

template<typename Base_t>
size_t GMPI::buffer_t< Base_t >::remaining (  )  const [inline]

The number of remaining entries to read.

Definition at line 78 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::read_pos, and GMPI::buffer_t< Base_t >::write_pos.

Referenced by GMPI::operator>>().

template<typename Base_t>
Base_t GMPI::buffer_t< Base_t >::read (  )  const [inline]

Read one entry of base type from buffer.

Definition at line 82 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::my_buffer, GMPI::buffer_t< Base_t >::read_pos, and GMPI::buffer_t< Base_t >::read_write.

Referenced by GMPI::operator>>().

template<typename Base_t>
void GMPI::buffer_t< Base_t >::unread (  )  const [inline]

Undo effect of last reading.

Definition at line 89 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::read_pos.

template<typename Base_t>
void GMPI::buffer_t< Base_t >::write ( Base_t  output  )  [inline]

Write one entry of base type into buffer.

Definition at line 95 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::my_buffer, GMPI::buffer_t< Base_t >::read_write, GMPI::buffer_t< Base_t >::reserve(), and GMPI::buffer_t< Base_t >::write_pos.

Referenced by GMPI::operator<<().

Here is the call graph for this function:

template<typename Base_t>
void GMPI::buffer_t< Base_t >::load ( Base_t *  address,
size_t  n 
) const [inline]

Load n entries from the buffer into address.

Definition at line 103 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::base_t_size, GMPI::buffer_t< Base_t >::my_buffer, GMPI::buffer_t< Base_t >::read_pos, and GMPI::buffer_t< Base_t >::read_write.

Referenced by GMPI::operator>>().

template<typename Base_t>
void GMPI::buffer_t< Base_t >::store ( Base_t *  address,
size_t  n 
) [inline]

Store n entries from address into the buffer.

Definition at line 111 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::base_t_size, GMPI::buffer_t< Base_t >::my_buffer, GMPI::buffer_t< Base_t >::read_write, GMPI::buffer_t< Base_t >::reserve(), and GMPI::buffer_t< Base_t >::write_pos.

Here is the call graph for this function:

template<typename Base_t>
size_t GMPI::buffer_t< Base_t >::size (  )  const [inline]

Buffer size, e.g. to send or receive data.

Definition at line 119 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::my_buffer.

Referenced by GMPI::Intracomm::Bcast(), GMPI::operator<<(), and GMPI::Comm::Send().

template<typename Base_t>
Base_t* GMPI::buffer_t< Base_t >::address (  )  [inline]

Buffer address (as non-const), e.g. to receive data.

Definition at line 122 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::my_buffer.

Referenced by GMPI::Intracomm::Bcast(), GMPI::Comm::Recv(), and GMPI::Comm::Send().

template<typename Base_t>
const Base_t* GMPI::buffer_t< Base_t >::buffer_address (  )  const [inline]

Buffer address (as const), e.g. to send data.

Definition at line 125 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::my_buffer.

template<typename Base_t>
void GMPI::buffer_t< Base_t >::free (  )  [inline]

Explicit memory release.

Definition at line 128 of file gmpi.hpp.

References GMPI::buffer_t< Base_t >::my_buffer, GMPI::buffer_t< Base_t >::read_pos, GMPI::buffer_t< Base_t >::read_write, and GMPI::buffer_t< Base_t >::write_pos.


Member Data Documentation

template<typename Base_t>
MPI::Datatype GMPI::buffer_t< Base_t >::mpi_t

MPI data type used in operations.

Definition at line 50 of file gmpi.hpp.

Referenced by GMPI::Intracomm::Bcast(), GMPI::Comm::Recv(), and GMPI::Comm::Send().

template<typename Base_t>
const int GMPI::buffer_t< Base_t >::base_t_size

Base type's size in byte.

Definition at line 51 of file gmpi.hpp.

Referenced by GMPI::buffer_t< Base_t >::load(), and GMPI::buffer_t< Base_t >::store().

template<typename Base_t>
vector<Base_t> GMPI::buffer_t< Base_t >::my_buffer [private]

Definition at line 53 of file gmpi.hpp.

Referenced by GMPI::buffer_t< Base_t >::address(), GMPI::buffer_t< Base_t >::buffer_address(), GMPI::buffer_t< Base_t >::free(), GMPI::buffer_t< Base_t >::load(), GMPI::buffer_t< Base_t >::read(), GMPI::buffer_t< Base_t >::reserve(), GMPI::buffer_t< Base_t >::size(), GMPI::buffer_t< Base_t >::store(), and GMPI::buffer_t< Base_t >::write().

template<typename Base_t>
size_t GMPI::buffer_t< Base_t >::write_pos [mutable, private]

Definition at line 54 of file gmpi.hpp.

Referenced by GMPI::buffer_t< Base_t >::empty(), GMPI::buffer_t< Base_t >::free(), GMPI::buffer_t< Base_t >::remaining(), GMPI::buffer_t< Base_t >::reserve(), GMPI::buffer_t< Base_t >::store(), and GMPI::buffer_t< Base_t >::write().

template<typename Base_t>
size_t GMPI::buffer_t< Base_t >::read_pos [mutable, private]

Definition at line 54 of file gmpi.hpp.

Referenced by GMPI::buffer_t< Base_t >::empty(), GMPI::buffer_t< Base_t >::free(), GMPI::buffer_t< Base_t >::load(), GMPI::buffer_t< Base_t >::read(), GMPI::buffer_t< Base_t >::remaining(), and GMPI::buffer_t< Base_t >::unread().

template<typename Base_t>
bool GMPI::buffer_t< Base_t >::read_write [mutable, private]

Definition at line 56 of file gmpi.hpp.

Referenced by GMPI::buffer_t< Base_t >::free(), GMPI::buffer_t< Base_t >::load(), GMPI::buffer_t< Base_t >::read(), GMPI::buffer_t< Base_t >::reserve(), GMPI::buffer_t< Base_t >::store(), and GMPI::buffer_t< Base_t >::write().


The documentation for this class was generated from the following file:
Generated on Wed Mar 11 10:35:17 2009 for angel by  doxygen 1.5.3