Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / smpi / include / smpi_errhandler.hpp
1 /* Copyright (c) 2010-2023. 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 namespace simgrid::smpi {
13
14 class Errhandler: public F2C {
15   private:
16     int refcount_ = 1;
17     MPI_Comm_errhandler_fn* comm_func_=nullptr;
18     MPI_File_errhandler_fn* file_func_=nullptr;
19     MPI_Win_errhandler_fn* win_func_=nullptr;
20   public:
21   Errhandler() = default;
22   explicit Errhandler(MPI_Comm_errhandler_fn *function):comm_func_(function){};
23   explicit Errhandler(MPI_File_errhandler_fn *function):file_func_(function){};
24   explicit Errhandler(MPI_Win_errhandler_fn *function):win_func_(function){};
25   void ref();
26   std::string name() const override {return "MPI_Errhandler";}
27   void call(MPI_Comm comm, int errorcode) const;
28   void call(MPI_Win win, int errorcode) const;
29   void call(MPI_File file, int errorcode) const;
30   static void unref(Errhandler* errhandler);
31   static Errhandler* f2c(int id);
32 };
33 } // namespace simgrid::smpi
34
35 #endif