X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/106ea6cf11d63d3a2b39f3d86897cb627d95907e..b6dde5ff6f208b83545a4b4e9e81712d0d8617a1:/src/smpi/include/smpi_keyvals.hpp diff --git a/src/smpi/include/smpi_keyvals.hpp b/src/smpi/include/smpi_keyvals.hpp index c6a200f1d3..71bcae82e2 100644 --- a/src/smpi/include/smpi_keyvals.hpp +++ b/src/smpi/include/smpi_keyvals.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -49,17 +49,21 @@ class Keyval{ // Each subclass should have two members, as we want to separate the ones for Win, Comm, and Datatypes : // static std::unordered_map keyvals_; // static int keyval_id_; - template static int keyval_create(smpi_copy_fn copy_fn, smpi_delete_fn delete_fn, int* keyval, void* extra_statee); + template + static int keyval_create(const smpi_copy_fn& copy_fn, const smpi_delete_fn& delete_fn, int* keyval, + void* extra_state); template static int keyval_free(int* keyval); template int attr_delete(int keyval); template int attr_get(int keyval, void* attr_value, int* flag); template int attr_put(int keyval, void* attr_value); - template static int call_deleter(T* obj, smpi_key_elem elem, int keyval, void * value, int* flag); + template + static int call_deleter(T* obj, const s_smpi_key_elem_t* elem, int keyval, void* value, int* flag); template void cleanup_attr(); }; -template int Keyval::keyval_create(smpi_copy_fn copy_fn, smpi_delete_fn delete_fn, int* keyval, void* extra_state){ - +template +int Keyval::keyval_create(const smpi_copy_fn& copy_fn, const smpi_delete_fn& delete_fn, int* keyval, void* extra_state) +{ smpi_key_elem value = new s_smpi_key_elem_t; value->copy_fn=copy_fn; @@ -109,7 +113,7 @@ template int Keyval::attr_delete(int keyval){ template int Keyval::attr_get(int keyval, void* attr_value, int* flag){ - smpi_key_elem elem = T::keyvals_.at(keyval); + const s_smpi_key_elem_t* elem = T::keyvals_.at(keyval); if(elem==nullptr) return MPI_ERR_ARG; if(attributes()->empty()){ @@ -155,7 +159,7 @@ template void Keyval::cleanup_attr(){ call_deleter((T*)this, elem, it.first,it.second,&flag); } } else { - //already deleted, not a problem; + // already deleted, not a problem flag=0; } }