X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/711f572ba93269d5151544df3a6df09018c803a0..08e7455d67920bbd7a87f440d00f2c1e071314a0:/src/smpi/include/smpi_f2c.hpp diff --git a/src/smpi/include/smpi_f2c.hpp b/src/smpi/include/smpi_f2c.hpp index 7acafc0ef9..ac5d65b676 100644 --- a/src/smpi/include/smpi_f2c.hpp +++ b/src/smpi/include/smpi_f2c.hpp @@ -1,6 +1,6 @@ /* Handle Fortran - C conversion for MPI Types*/ -/* Copyright (c) 2010-2020. The SimGrid Team. +/* Copyright (c) 2010-2021. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -15,33 +15,32 @@ namespace simgrid{ namespace smpi{ class F2C { - private: - // We use a single lookup table for every type. - // Beware of collisions if id in mpif.h is not unique - static std::unordered_map* f2c_lookup_; - static int f2c_id_; - int my_f2c_id_ = -1; - - protected: - static std::unordered_map* f2c_lookup(); - static void set_f2c_lookup(std::unordered_map* map); - static int f2c_id(); - static void f2c_id_increment(); - - public: - static void delete_lookup(); - static std::unordered_map* lookup(); - F2C(); - virtual ~F2C() = default; - - //Override these to handle specific values. - virtual int add_f(); - static void free_f(int id); - virtual int c2f(); - static void print_f2c_lookup(); - // This method should be overridden in all subclasses to avoid casting the result when calling it. - // For the default one, the MPI_*_NULL returned is assumed to be NULL. - static F2C* f2c(int id); +private: + // We use a single lookup table for every type. + // Beware of collisions if id in mpif.h is not unique + static std::unordered_map* f2c_lookup_; + static int f2c_id_; + int my_f2c_id_ = -1; + +protected: + static void set_f2c_lookup(std::unordered_map* map) { f2c_lookup_ = map; } + static int f2c_id() { return f2c_id_; } + static void f2c_id_increment() { f2c_id_++; } + +public: + static void delete_lookup() { delete f2c_lookup_; } + static std::unordered_map* lookup() { return f2c_lookup_; } + F2C(); + virtual ~F2C() = default; + + // Override these to handle specific values. + virtual int add_f(); + static void free_f(int id) { f2c_lookup_->erase(id); } + virtual int c2f(); + static void print_f2c_lookup(); + // This method should be overridden in all subclasses to avoid casting the result when calling it. + // For the default one, the MPI_*_NULL returned is assumed to be NULL. + static F2C* f2c(int id); }; }