- if (not strcmp(root->name_, "HOST")) {
- char tnstr[INSTR_DEFAULT_STR_SIZE];
- snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename);
- simgrid::instr::Type::variableNew(tnstr, color, root);
- }
- if (not strcmp(root->name_, "MSG_VM")) {
- char tnstr[INSTR_DEFAULT_STR_SIZE];
- snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename);
- simgrid::instr::Type::variableNew(tnstr, color, root);
- }
- if (not strcmp(root->name_, "LINK")) {
- char tnstr[INSTR_DEFAULT_STR_SIZE];
- snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
- simgrid::instr::Type::variableNew(tnstr, color, root);
- }
- xbt_dict_cursor_t cursor = nullptr;
- simgrid::instr::Type* child_type;
- char *name;
- xbt_dict_foreach (root->children_, cursor, name, child_type) {
- recursiveNewVariableType (new_typename, color, child_type);
+ if (root->getName() == "HOST" || root->getName() == "MSG_VM")
+ root->getOrCreateVariableType(std::string("p") + new_typename, color == nullptr ? "" : color);
+
+ if (root->getName() == "LINK")
+ root->getOrCreateVariableType(std::string("b") + new_typename, color == nullptr ? "" : color);
+
+ for (auto elm : root->children_) {
+ recursiveNewVariableType(new_typename, color == nullptr ? "" : color, elm.second);