25#ifndef __BITPIT_COMMUNICATIONS_BUFFERS_HPP__
26#define __BITPIT_COMMUNICATIONS_BUFFERS_HPP__
30#include "bitpit_containers.hpp"
41class DataCommunicator;
43typedef OBinaryStream RawSendBuffer;
44typedef IBinaryStream RawRecvBuffer;
47SendBuffer &
operator<<(SendBuffer &buffer,
const T &value);
50RecvBuffer & operator>>(RecvBuffer &buffer, T &value);
59template<
typename RawBufferType>
69 bool seekg (
size_t pos);
70 std::ifstream::pos_type
tellg(
void)
const;
81 const std::vector<RawBufferType> &
getBuffers()
const;
84 std::vector<RawBufferType> m_buffers;
85 RawBufferType *m_front;
86 RawBufferType *m_back;
98 SendBuffer(
size_t size = 0,
bool doubleBuffer =
false);
102 void write(
const char *data, std::size_t size);
114 RecvBuffer(
size_t size = 0,
bool doubleBuffer =
false);
116 void read(
char *data, std::size_t size);
122#include "communications_buffers.tpp"
Buffer to be used for data communications.
void setSize(size_t size)
RawBufferType & getFront()
std::ifstream::pos_type tellg(void) const
RawBufferType & getBack()
CommunicationBuffer(size_t size=0, bool doubleBuffer=false)
std::vector< RawBufferType > & getBuffers()
The DataCommunicator class provides the infrastructure needed to exchange data among processes.
Buffer to be used for receive communications.
RecvBuffer(size_t size=0, bool doubleBuffer=false)
void read(char *data, std::size_t size)
Buffer to be used for send communications.
void write(const char *data, std::size_t size)
SendBuffer(size_t size=0, bool doubleBuffer=false)
std::ostream & operator<<(std::ostream &, const std::vector< T > &)