switch to C++ MPI API and add const to signatures