Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make trivial functions inline.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 27 Oct 2020 22:03:19 +0000 (23:03 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 27 Oct 2020 22:43:08 +0000 (23:43 +0100)
src/smpi/include/smpi_f2c.hpp
src/smpi/mpi/smpi_f2c.cpp

index 7acafc0..69c309d 100644 (file)
@@ -15,33 +15,33 @@ 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<int, F2C*>* f2c_lookup_;
-    static int f2c_id_;
-    int my_f2c_id_ = -1;
-
-  protected:
-    static std::unordered_map<int, F2C*>* f2c_lookup();
-    static void set_f2c_lookup(std::unordered_map<int, F2C*>* map);
-    static int f2c_id();
-    static void f2c_id_increment();
-
-  public:
-    static void delete_lookup();
-    static std::unordered_map<int, F2C*>* 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<int, F2C*>* f2c_lookup_;
+  static int f2c_id_;
+  int my_f2c_id_ = -1;
+
+protected:
+  static std::unordered_map<int, F2C*>* f2c_lookup() { return f2c_lookup_; }
+  static void set_f2c_lookup(std::unordered_map<int, F2C*>* 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<int, F2C*>* 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);
 };
 
 }
index bff67c3..1989c12 100644 (file)
@@ -21,38 +21,6 @@ int F2C::f2c_id_ = 0;
 // Keep it non trivially-constructible, or it will break MC+smpi on FreeBSD with Clang (don't ask why)
 F2C::F2C() = default;
 
-std::unordered_map<int, F2C*>* F2C::f2c_lookup()
-{
-  return f2c_lookup_;
-}
-
-void F2C::set_f2c_lookup(std::unordered_map<int, F2C*>* map)
-{
-  f2c_lookup_ = map;
-}
-
-void F2C::f2c_id_increment(){
-  f2c_id_++;
-}
-
-int F2C::f2c_id(){
-  return f2c_id_;
-}
-
-void F2C::delete_lookup(){
-  delete f2c_lookup_;
-}
-
-std::unordered_map<int, F2C*>* F2C::lookup()
-{
-  return f2c_lookup_;
-}
-
-void F2C::free_f(int id)
-{
-  f2c_lookup_->erase(id);
-}
-
 int F2C::add_f()
 {
   if (f2c_lookup_ == nullptr)