Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / smpi / include / smpi_info.hpp
index ec95363..a64851b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team.
+/* Copyright (c) 2009-2023. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -9,32 +9,30 @@
 
 #include "smpi/smpi.h"
 #include "smpi_f2c.hpp"
-#include <unordered_map>
+#include <string>
+#include <map>
 
-namespace simgrid{
-namespace smpi{
+namespace simgrid::smpi {
 
 class Info : public F2C{
-  private:
-    std::unordered_map<std::string, std::string> map_;
-    int refcount_ = 1;
-
-  public:
-    Info() = default;
-    explicit Info(Info* orig);
-    ~Info() = default;
-    void ref();
-    static void unref(MPI_Info info);
-    void set(char *key, char *value);
-    int get(char *key,int valuelen, char *value, int *flag);
-    int remove(char* key);
-    int get_nkeys(int *nkeys);
-    int get_nthkey(int n, char *key);
-    int get_valuelen(char *key, int *valuelen, int *flag);
-    static Info* f2c(int id);
+  std::map<std::string, std::string, std::less<>> map_;
+  int refcount_ = 1;
+
+public:
+  explicit Info() {this->add_f();}
+  explicit Info(const Info* orig);
+  void ref();
+  static void unref(MPI_Info info);
+  void set(const char* key, const char* value) { map_[key] = value; }
+  int get(const char* key, int valuelen, char* value, int* flag) const;
+  std::string name() const override { return "MPI_Info"; }
+  int remove(const char* key);
+  int get_nkeys(int* nkeys) const;
+  int get_nthkey(int n, char* key) const;
+  int get_valuelen(const char* key, int* valuelen, int* flag) const;
+  static Info* f2c(int id);
 };
 
-}
-}
+} // namespace simgrid::smpi
 
 #endif