1 /* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "smpi_f2c.hpp"
8 #include "src/smpi/include/smpi_actor.hpp"
12 int mpi_status_ignore_;
13 int mpi_statuses_ignore_;
18 std::unordered_map<int, F2C*>* F2C::f2c_lookup_ = nullptr;
21 // Keep it non trivially-constructible, or it will break MC+smpi on FreeBSD with Clang (don't ask why)
24 std::unordered_map<int, F2C*>* F2C::f2c_lookup()
29 void F2C::set_f2c_lookup(std::unordered_map<int, F2C*>* map)
34 void F2C::f2c_id_increment(){
42 void F2C::delete_lookup(){
46 std::unordered_map<int, F2C*>* F2C::lookup()
51 void F2C::free_f(int id)
53 f2c_lookup_->erase(id);
58 if (f2c_lookup_ == nullptr)
59 f2c_lookup_ = new std::unordered_map<int, F2C*>();
61 my_f2c_id_ = f2c_id();
62 (*f2c_lookup_)[my_f2c_id_] = this;
69 if (f2c_lookup_ == nullptr) {
70 f2c_lookup_ = new std::unordered_map<int, F2C*>();
74 /* this function wasn't found, add it */
82 if (f2c_lookup_ == nullptr)
83 f2c_lookup_ = new std::unordered_map<int, F2C*>();
86 auto comm = f2c_lookup_->find(id);
87 return comm == f2c_lookup_->end() ? nullptr : comm->second;