A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update copyright lines for 2023.
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_info.cpp
diff --git
a/src/smpi/mpi/smpi_info.cpp
b/src/smpi/mpi/smpi_info.cpp
index
446e6b9
..
0d696f4
100644
(file)
--- a/
src/smpi/mpi/smpi_info.cpp
+++ b/
src/smpi/mpi/smpi_info.cpp
@@
-1,13
+1,20
@@
-/* Copyright (c) 2007-202
0
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-202
3
. 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. */
#include "smpi_info.hpp"
/* 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. */
#include "smpi_info.hpp"
+#include "smpi_comm.hpp"
#include "simgrid/Exception.hpp"
#include "simgrid/Exception.hpp"
-namespace simgrid {
-namespace smpi {
+namespace simgrid::smpi {
+
+Info::Info(const Info* orig)
+{
+ if (orig != nullptr)
+ map_ = orig->map_;
+ this->add_f();
+}
void Info::ref()
{
void Info::ref()
{
@@
-17,6
+24,7
@@
void Info::ref()
void Info::unref(Info* info){
info->refcount_--;
if(info->refcount_==0){
void Info::unref(Info* info){
info->refcount_--;
if(info->refcount_==0){
+ F2C::free_f(info->f2c_id());
delete info;
}
}
delete info;
}
}
@@
-24,8
+32,7
@@
void Info::unref(Info* info){
int Info::get(const char* key, int valuelen, char* value, int* flag) const
{
*flag=false;
int Info::get(const char* key, int valuelen, char* value, int* flag) const
{
*flag=false;
- auto val = map_.find(key);
- if (val != map_.end()) {
+ if (auto val = map_.find(key); val != map_.end()) {
std::string tmpvalue = val->second;
memset(value, 0, valuelen);
std::string tmpvalue = val->second;
memset(value, 0, valuelen);
@@
-52,9
+59,9
@@
int Info::get_nkeys(int* nkeys) const
int Info::get_nthkey(int n, char* key) const
{
int num=0;
int Info::get_nthkey(int n, char* key) const
{
int num=0;
- for (auto const&
elm
: map_) {
+ for (auto const&
[elm, _]
: map_) {
if (num == n) {
if (num == n) {
- strncpy(key, elm.
first.c_str(), elm.first
.length() + 1);
+ strncpy(key, elm.
c_str(), elm
.length() + 1);
return MPI_SUCCESS;
}
num++;
return MPI_SUCCESS;
}
num++;
@@
-65,8
+72,7
@@
int Info::get_nthkey(int n, char* key) const
int Info::get_valuelen(const char* key, int* valuelen, int* flag) const
{
*flag=false;
int Info::get_valuelen(const char* key, int* valuelen, int* flag) const
{
*flag=false;
- auto val = map_.find(key);
- if (val != map_.end()) {
+ if (auto val = map_.find(key); val != map_.end()) {
*valuelen = val->second.length();
*flag=true;
}
*valuelen = val->second.length();
*flag=true;
}
@@
-77,5
+83,4
@@
Info* Info::f2c(int id){
return static_cast<Info*>(F2C::f2c(id));
}
return static_cast<Info*>(F2C::f2c(id));
}
-}
-}
+} // namespace simgrid::smpi