// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.

#ifndef tools_impi
#define tools_impi

#include <string>
#include <vector>

#include "typedefs"

namespace tools {

class impi {
public:
  virtual ~impi(){}
public:
  virtual bool pack(char) = 0;
  virtual bool pack(short) = 0;
  virtual bool pack(int) = 0;
  virtual bool pack(unsigned int) = 0;
  virtual bool pack(uint64) = 0;
  virtual bool pack(int64) = 0;
  virtual bool pack(float) = 0;
  virtual bool pack(double)  = 0;
  virtual bool bpack(bool) = 0;
  virtual bool spack(const std::string&) = 0;
  virtual bool vpack(const std::vector<unsigned int>&) = 0;
  virtual bool vpack(const std::vector<int>&) = 0;
  virtual bool vpack(const std::vector<double>&) = 0;
  virtual bool pack(uint32,const char*) = 0;
  virtual bool pack(uint32,const int*) = 0;

  virtual bool unpack(char&) = 0;
  virtual bool unpack(short&) = 0;
  virtual bool unpack(int&) = 0;
  virtual bool unpack(unsigned int&) = 0;
  virtual bool unpack(uint64&) = 0;
  virtual bool unpack(int64&) = 0;
  virtual bool unpack(float&) = 0;
  virtual bool unpack(double&)  = 0;
  virtual bool bunpack(bool&) = 0;
  virtual bool sunpack(std::string&) = 0;
  virtual bool vunpack(std::vector<unsigned int>&) = 0;
  virtual bool vunpack(std::vector<int>&) = 0;
  virtual bool vunpack(std::vector<double>&) = 0;
  virtual bool unpack(uint32&,char*&) = 0;
  virtual bool unpack(uint32&,int*&) = 0;

  virtual void pack_reset() = 0;
  virtual bool send_buffer(int,int) = 0;

  virtual bool wait_buffer(int rank,int src,int tag,int& probe_src,bool verbose = false) = 0;
  virtual bool wait_buffer(int rank,int tag,int& probe_src,bool verbose = false) = 0; //MPI_ANY_SOURCE.
};

}

#endif
