#ifndef COMM_BUFFER_HPP
#define COMM_BUFFER_HPP


#include <mpi.h>
#include <vector>
#include <Body.hpp>

namespace nbody {
	using namespace std;

	class MpiBodyComm {
	protected:
		MPI_Datatype* datatype;
		MPI_Request request;
		vector<Body> buffer;
	public:
		MpiBodyComm(MPI_Datatype* bodyDatatype);
		virtual ~MpiBodyComm();
		virtual void cleanup();
		virtual void sendBlocking(int target, vector<Body> bodies);
		virtual void recvBlocking(int source, vector<Body>& bodies);
		virtual bool sendUnblocking(int target, vector<Body> bodies);
		virtual bool recvUnblocking(int source, vector<Body>& bodies);
	};
}

#endif
