Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Have attributes actually work in fortran... the horror
[simgrid.git] / src / smpi / mpi / smpi_keyvals.cpp
1 /* Copyright (c) 2007-2018. 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 //#include "private.hpp"
8 #include "smpi_keyvals.hpp"
9
10 namespace simgrid{
11 namespace smpi{
12
13 std::unordered_map<int, void*>* Keyval::attributes(){
14   return &attributes_;
15 };
16
17
18 template <> int Keyval::call_deleter<Comm>(Comm* obj, smpi_key_elem elem, int keyval, void * value, int* flag){
19   int ret = MPI_SUCCESS;
20   if(elem->delete_fn.comm_delete_fn!=MPI_NULL_DELETE_FN)
21     ret = elem->delete_fn.comm_delete_fn(obj, keyval, value, elem->extra_state);
22   else if(elem->delete_fn.comm_delete_fn_fort!=MPI_NULL_DELETE_FN)
23     elem->delete_fn.comm_delete_fn_fort(obj, keyval, value, elem->extra_state, &ret);
24   return ret;
25 }
26
27 template <> int Keyval::call_deleter<Win>(Win* obj, smpi_key_elem elem, int keyval, void * value, int* flag){
28   int ret = MPI_SUCCESS;
29   if(elem->delete_fn.win_delete_fn!=MPI_NULL_DELETE_FN)
30     ret = elem->delete_fn.win_delete_fn(obj, keyval, value, elem->extra_state);
31   else if(elem->delete_fn.win_delete_fn_fort!=MPI_NULL_DELETE_FN)
32     elem->delete_fn.win_delete_fn_fort(obj, keyval, value, elem->extra_state, &ret);
33   return ret;
34 }
35
36 template <> int Keyval::call_deleter<Datatype>(Datatype* obj, smpi_key_elem elem, int keyval, void * value, int* flag){
37   int ret = MPI_SUCCESS;
38   if(elem->delete_fn.type_delete_fn!=MPI_NULL_DELETE_FN)
39     ret = elem->delete_fn.type_delete_fn(obj, keyval, value, elem->extra_state);
40   else if(elem->delete_fn.type_delete_fn_fort!=MPI_NULL_DELETE_FN)
41     elem->delete_fn.type_delete_fn_fort(obj, keyval, value, elem->extra_state, &ret);
42   return ret;
43 }
44
45 }
46 }