- // level depends on level of father
- if (newContainer->father){
- newContainer->level = newContainer->father->level+1;
- XBT_DEBUG("new container %s, child of %s", name, father->name);
- }else{
- newContainer->level = 0;
- }
- // type definition (method depends on kind of this new container)
- newContainer->kind = kind;
- if (newContainer->kind == INSTR_AS){
- //if this container is of an AS, its type name depends on its level
- char as_typename[INSTR_DEFAULT_STR_SIZE];
- snprintf (as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", newContainer->level);
- if (newContainer->father){
- newContainer->type = PJ_type_get_or_null (as_typename, newContainer->father->type);
- if (newContainer->type == nullptr){
- newContainer->type = PJ_type_container_new (as_typename, newContainer->father->type);
- }
- }else{
- newContainer->type = PJ_type_container_new ("0", nullptr);
- }
- }else{
- //otherwise, the name is its kind
- char typeNameBuff[INSTR_DEFAULT_STR_SIZE];
- switch (newContainer->kind){
- case INSTR_HOST: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "HOST"); break;
- case INSTR_LINK: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "LINK"); break;
- case INSTR_ROUTER: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "ROUTER"); break;
- case INSTR_SMPI: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MPI"); break;
- case INSTR_MSG_PROCESS: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_PROCESS"); break;
- case INSTR_MSG_VM: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_VM"); break;
- case INSTR_MSG_TASK: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_TASK"); break;
- default: THROWF (tracing_error, 0, "new container kind is unknown."); break;
- }
- type_t type = PJ_type_get_or_null (typeNameBuff, newContainer->father->type);
- if (type == nullptr){
- newContainer->type = PJ_type_container_new (typeNameBuff, newContainer->father->type);
- }else{
- newContainer->type = type;