X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/32892d0df7206a7c14ace5a13f985df1e0a9249a..5774e50106ed0c53c47ab4651fb95ae5061954fd:/src/smpi/mpi/smpi_info.cpp diff --git a/src/smpi/mpi/smpi_info.cpp b/src/smpi/mpi/smpi_info.cpp index 0b64447dad..c20ae58755 100644 --- a/src/smpi/mpi/smpi_info.cpp +++ b/src/smpi/mpi/smpi_info.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2019. 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. */ @@ -9,11 +9,8 @@ namespace simgrid { namespace smpi { -Info::Info(Info* info) : map_(info->map_) +void Info::ref() { -} - -void Info::ref(){ refcount_++; } @@ -24,11 +21,7 @@ void Info::unref(Info* info){ } } -void Info::set(char *key, char *value){ - map_[key] = value; -} - -int Info::get(char *key, int valuelen, char *value, int *flag){ +int Info::get(const char *key, int valuelen, char *value, int *flag){ *flag=false; auto val = map_.find(key); if (val != map_.end()) { @@ -38,13 +31,11 @@ int Info::get(char *key, int valuelen, char *value, int *flag){ memcpy(value, tmpvalue.c_str(), (tmpvalue.length() + 1 < static_cast(valuelen)) ? tmpvalue.length() + 1 : valuelen); *flag=true; - return MPI_SUCCESS; - } else { - return MPI_ERR_INFO_KEY; } + return MPI_SUCCESS; } -int Info::remove(char *key){ +int Info::remove(const char *key){ if (map_.erase(key) == 0) return MPI_ERR_INFO_NOKEY; else @@ -68,16 +59,14 @@ int Info::get_nthkey(int n, char *key){ return MPI_ERR_ARG; } -int Info::get_valuelen(char *key, int *valuelen, int *flag){ +int Info::get_valuelen(const char *key, int *valuelen, int *flag){ *flag=false; auto val = map_.find(key); if (val != map_.end()) { *valuelen = val->second.length(); *flag=true; - return MPI_SUCCESS; - } else { - return MPI_ERR_INFO_KEY; } + return MPI_SUCCESS; } Info* Info::f2c(int id){