#include <gmpi.hpp>
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 |
Definition at line 47 of file gmpi.hpp.
typedef Base_t GMPI::buffer_t< Base_t >::base_t |
GMPI::buffer_t< Base_t >::buffer_t | ( | ) | [inline] |
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().
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().
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.
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>>().
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>>().
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.
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<<().
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>>().
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.
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().
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().
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.
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.
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().
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().
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().
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().
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().
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().