#ifndef COMM_BUFFER_HPP
#define COMM_BUFFER_HPP

#include <mpi.h>
#include <vector>
#include "../datastructures/Body.hpp"

namespace nbody {
	using namespace std;

	class MpiBodyComm {
	protected:
		MPI::Datatype commBodyType;
		MPI::Datatype datatypes[3];
		int blocklengths[3];
		MPI::Aint displacements[3];
		vector<Body> buffer;
		MPI::Status status;
		MPI::Request request;
	public:
		MpiBodyComm();
		virtual ~MpiBodyComm();
		virtual bool sendBlocking(int target, vector<Body> bodies);
		virtual bool sendUnblocking(int target, vector<Body> bodies);
	};
}

#endif
