Logo AND Algorithmique Numérique Distribuée

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