Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Remove all references to decode_datatype
[simgrid.git] / src / smpi / mpi / smpi_datatype.cpp
index 8729d75..88b8750 100644 (file)
@@ -202,12 +202,15 @@ bool Datatype::is_basic()
   return (flags_ & DT_FLAG_BASIC);
 }
 
-const char* Datatype::encode()
+const char* Datatype::encode(MPI_Datatype dt)
 {
-  return std::to_string(id).c_str();
+  if (dt == MPI_DATATYPE_NULL)
+    return "-1";
+
+  return std::to_string(dt->id).c_str();
 }
 
-MPI_Datatype Datatype::decode(const char* const datatype_id)
+MPI_Datatype Datatype::decode(std::string datatype_id)
 {
   return id2type_lookup.find(std::stoi(datatype_id))->second;
 }