X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3ce054415500e2f9b7ebf726c9f22446f5ec39f3..1957cbeaedc9d28cea7839684d82ac8454cc8bef:/src/instr/instr_paje_containers.cpp diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 76b985257e..7541e6b35d 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -71,7 +71,7 @@ simgrid::instr::Container::Container(const char* name, simgrid::instr::e_contain char as_typename[INSTR_DEFAULT_STR_SIZE]; snprintf(as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", this->level_); if (this->father_) { - this->type_ = simgrid::instr::Type::getOrNull(as_typename, this->father_->type_); + this->type_ = this->father_->type_->getChildOrNull(as_typename); if (this->type_ == nullptr) { this->type_ = simgrid::instr::Type::containerNew(as_typename, this->father_->type_); } @@ -107,7 +107,7 @@ simgrid::instr::Container::Container(const char* name, simgrid::instr::e_contain THROWF (tracing_error, 0, "new container kind is unknown."); break; } - simgrid::instr::Type* type = simgrid::instr::Type::getOrNull(typeNameBuff, this->father_->type_); + simgrid::instr::Type* type = this->father_->type_->getChildOrNull(typeNameBuff); if (type == nullptr){ this->type_ = simgrid::instr::Type::containerNew(typeNameBuff, this->father_->type_); }else{ @@ -121,11 +121,10 @@ simgrid::instr::Container::Container(const char* name, simgrid::instr::e_contain } //register all kinds by name - if (allContainers.find(this->name_) != allContainers.end()) { + if (not allContainers.emplace(this->name_, this).second) { THROWF(tracing_error, 1, "container %s already present in allContainers data structure", this->name_); } - allContainers.emplace(this->name_, this); XBT_DEBUG("Add container name '%s'", this->name_); //register NODE types for triva configuration @@ -170,9 +169,8 @@ simgrid::instr::Container* PJ_container_get(const char* name) simgrid::instr::Container* PJ_container_get_or_null(const char* name) { - if (allContainers.find(name) == allContainers.end()) - return nullptr; - return allContainers.at(name); + auto cont = allContainers.find(name); + return cont == allContainers.end() ? nullptr : cont->second; } simgrid::instr::Container* PJ_container_get_root()