mark_color = white;
XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
- pj_value.PJ_value_new (mark_value, mark_color, type);
+ s_val rett(mark_value, mark_color, type);
}
/** \ingroup TRACE_mark
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event system (values)");
-val_t paje_value :: PJ_value_new (const char *name, const char *color, type_t father)
+val_t s_val::PJ_value_update (const char *name, const char *color, type_t father)
{
+ this->ret = xbt_new0(s_val, 1);
+ this->ret->name = xbt_strdup (name);
+ this->ret->father = father;
+ this->ret->color = xbt_strdup (color);
+
+ char str_id[INSTR_DEFAULT_STR_SIZE];
+ snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
+ this->ret->id = xbt_strdup (str_id);
+
+ xbt_dict_set (father->values, name, ret, nullptr);
+ XBT_DEBUG("new value %s, child of %s", this->ret->name, this->ret->father->name);
+ LogEntityValue(this->ret);
+ return this->ret;
+}
+
+s_val::s_val(const char *name, const char *color, type_t father){
if (name == nullptr || father == nullptr){
THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)");
}
-
- val_t ret = xbt_new0(s_val_t, 1);
- ret->name = xbt_strdup (name);
- ret->father = father;
- ret->color = xbt_strdup (color);
+ this->ret = xbt_new0(s_val, 1);
+ this->ret->name = xbt_strdup (name);
+ this->ret->father = father;
+ this->ret->color = xbt_strdup (color);
char str_id[INSTR_DEFAULT_STR_SIZE];
snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
- ret->id = xbt_strdup (str_id);
+ this->ret->id = xbt_strdup (str_id);
xbt_dict_set (father->values, name, ret, nullptr);
XBT_DEBUG("new value %s, child of %s", ret->name, ret->father->name);
- LogEntityValue(ret);
- return ret;
-}
+ LogEntityValue(this->ret);
+};
val_t paje_value :: PJ_value_get_or_new (const char *name, const char *color, type_t father)
{ paje_value pj_value;
ret = pj_value.PJ_value_get(name, father);
}
catch(xbt_ex& e) {
- ret = pj_value.PJ_value_new(name, color, father);
+ s_val rett(name, color, father);
+ ret = rett.ret;
}
return ret;
}
char *name;
char *color;
type_t father;
+ val_t ret;
+ s_val(const char *name, const char *color, type_t father);
+ val_t PJ_value_update (const char *name, const char *color, type_t father);
};
-typedef s_val s_val_t;
+
//--------------------------------------------------
typedef enum {
/* instr_config.c */
XBT_PRIVATE void recursiveDestroyType (type_t type);
+/* instr_paje_values.c */
+XBT_PUBLIC(val_t) PJ_value_get_or_new (const char *name, const char *color, type_t father);
+XBT_PUBLIC(val_t) PJ_value_get (const char *name, const type_t father);
+
XBT_PRIVATE void TRACE_TI_start();
XBT_PRIVATE void TRACE_TI_end();
if (msg_process == nullptr){
msg_process = PJ_type_container_new("MSG_PROCESS", container->type);
type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
- pj_value.PJ_value_new ("suspend", "1 0 1", state);
- pj_value.PJ_value_new ("sleep", "1 1 0", state);
- pj_value.PJ_value_new ("receive", "1 0 0", state);
- pj_value.PJ_value_new ("send", "0 0 1", state);
- pj_value.PJ_value_new ("task_execute", "0 1 1", state);
+ s_val PJ_value("suspend", "1 0 1", state);
+ PJ_value.PJ_value_update("sleep", "1 1 0", state);
+ PJ_value.PJ_value_update("receive", "1 0 0", state);
+ PJ_value.PJ_value_update("send", "0 0 1", state);
+ PJ_value.PJ_value_update("task_execute", "0 1 1", state);
PJ_type_link_new ("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process);
PJ_type_link_new ("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process);
}
if (msg_vm == nullptr){
msg_vm = PJ_type_container_new("MSG_VM", container->type);
type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm);
- pj_value.PJ_value_new ("suspend", "1 0 1", state);
- pj_value.PJ_value_new ("sleep", "1 1 0", state);
- pj_value.PJ_value_new ("receive", "1 0 0", state);
- pj_value.PJ_value_new ("send", "0 0 1", state);
- pj_value.PJ_value_new ("task_execute", "0 1 1", state);
+ s_val PJ_value("suspend", "1 0 1", state);
+ PJ_value.PJ_value_update ("sleep", "1 1 0", state);
+ PJ_value.PJ_value_update ("receive", "1 0 0", state);
+ PJ_value.PJ_value_update ("send", "0 0 1", state);
+ PJ_value.PJ_value_update ("task_execute", "0 1 1", state);
PJ_type_link_new ("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm);
PJ_type_link_new ("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm);
}
static void recursiveNewValueForUserStateType (const char *type_name, const char *value, const char *color, type_t root)
{ paje_value pj_value;
if (not strcmp(root->name, type_name)) {
- pj_value.PJ_value_new (value, color, root);
+ s_val PJ_value (value, color, root);
}
xbt_dict_cursor_t cursor = nullptr;
type_t child_type;