Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add support for MPI Errhandlers in Comm, File, Win.
[simgrid.git] / src / smpi / include / smpi_errhandler.hpp
1 /* Copyright (c) 2010-2019. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SMPI_ERRHANDLER_HPP_INCLUDED
8 #define SMPI_ERRHANDLER_HPP_INCLUDED
9 #include "smpi_f2c.hpp"
10 #include <smpi/smpi.h>
11
12
13 namespace simgrid{
14 namespace smpi{
15
16 class Errhandler: public F2C {
17   private:
18     int refcount_ = 1;
19     MPI_Comm_errhandler_fn* comm_func_=nullptr;
20     MPI_File_errhandler_fn* file_func_=nullptr;
21     MPI_Win_errhandler_fn* win_func_=nullptr;
22   public:
23   Errhandler() = default;
24   explicit Errhandler(MPI_Comm_errhandler_fn *function):comm_func_(function){};
25   explicit Errhandler(MPI_File_errhandler_fn *function):file_func_(function){};
26   explicit Errhandler(MPI_Win_errhandler_fn *function):win_func_(function){};
27   void ref();
28   void call(MPI_Comm comm, int errorcode);
29   void call(MPI_Win win, int errorcode);
30   void call(MPI_File file, int errorcode);
31   static void unref(Errhandler* errhandler);
32   static Errhandler* f2c(int id);
33
34 };
35   
36 }
37 }
38
39 #endif