Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
PJ_container_remove_from_parent () becomes Container::removeFromParent
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 12 Oct 2017 11:14:36 +0000 (13:14 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 12 Oct 2017 11:14:36 +0000 (13:14 +0200)
src/instr/instr_paje_containers.cpp
src/instr/instr_private.hpp
src/msg/instr_msg_process.cpp
src/msg/msg_vm.cpp
src/smpi/internals/instr_smpi.cpp

index 9b5a8c8..c449a97 100644 (file)
@@ -170,18 +170,13 @@ Container* Container::byName(std::string name)
 
   return ret;
 }
-}
-}
 
-void PJ_container_remove_from_parent (container_t child)
+void Container::removeFromParent()
 {
-  if (child == nullptr){
-    THROWF (tracing_error, 0, "can't remove from parent with a nullptr child");
-  }
-
-  container_t parent = child->father_;
-  if (parent){
-    XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", child->name_.c_str(), parent->name_.c_str());
-    parent->children_.erase(child->name_);
+  if (father_) {
+    XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", name_.c_str(), father_->name_.c_str());
+    father_->children_.erase(name_);
   }
 }
+}
+}
index af513ac..6822b26 100644 (file)
@@ -129,8 +129,9 @@ public:
   e_container_types kind_; /* This container is of what kind */
   Container* father_;
   std::map<std::string, Container*> children_;
-  static simgrid::instr::Container* byNameOrNull(std::string name);
-  static simgrid::instr::Container* byName(std::string name);
+  static Container* byNameOrNull(std::string name);
+  static Container* byName(std::string name);
+  void removeFromParent();
 };
 
 //--------------------------------------------------
@@ -312,7 +313,6 @@ extern XBT_PRIVATE std::set<std::string> trivaEdgeTypes;
 XBT_PRIVATE long long int instr_new_paje_id();
 XBT_PUBLIC(container_t) PJ_container_get_root ();
 XBT_PUBLIC(void) PJ_container_set_root (container_t root);
-XBT_PUBLIC(void) PJ_container_remove_from_parent (container_t container);
 
 /* instr_paje_types.c */
 XBT_PUBLIC(simgrid::instr::Type*) PJ_type_get_root();
index e9cd03d..e7e4604 100644 (file)
@@ -74,7 +74,7 @@ void TRACE_msg_process_destroy (const char *process_name, int process_pid)
     container_t process =
         simgrid::instr::Container::byNameOrNull(instr_process_id_2(process_name, process_pid, str, len));
     if (process) {
-      PJ_container_remove_from_parent (process);
+      process->removeFromParent();
       delete process;
     }
   }
index cf9f09f..efc25d9 100644 (file)
@@ -171,7 +171,7 @@ void MSG_vm_destroy(msg_vm_t vm)
 
   if (TRACE_msg_vm_is_enabled()) {
     container_t container = simgrid::instr::Container::byName(vm->getName());
-    PJ_container_remove_from_parent(container);
+    container->removeFromParent();
     delete container;
   }
 }
@@ -300,7 +300,7 @@ static int migration_rx_fun(int argc, char *argv[])
 
     // destroy existing container of this vm
     container_t existing_container = simgrid::instr::Container::byName(vm->getName());
-    PJ_container_remove_from_parent(existing_container);
+    existing_container->removeFromParent();
     delete existing_container;
 
     // create new container on the new_host location
index 5807ffc..28ef28b 100644 (file)
@@ -221,7 +221,7 @@ void TRACE_smpi_finalize(int rank)
 
   char str[INSTR_DEFAULT_STR_SIZE];
   container_t container = simgrid::instr::Container::byName(smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE));
-  PJ_container_remove_from_parent (container);
+  container->removeFromParent();
   delete container;
 }