Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rework State related events
[simgrid.git] / src / instr / instr_interface.cpp
index 3cea149..0182dd2 100644 (file)
@@ -178,7 +178,8 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar
   if (not mark_value)
     THROWF (tracing_error, 1, "mark_value is nullptr");
 
-  simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName(mark_type);
+  simgrid::instr::EventType* type =
+      static_cast<simgrid::instr::EventType*>(simgrid::instr::Type::getRootType()->byName(mark_type));
   if (not type) {
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   } else {
@@ -233,7 +234,8 @@ void TRACE_mark(const char *mark_type, const char *mark_value)
     THROWF (tracing_error, 1, "mark_value is nullptr");
 
   //check if mark_type is already declared
-  simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName(mark_type);
+  simgrid::instr::EventType* type =
+      static_cast<simgrid::instr::EventType*>(simgrid::instr::Type::getRootType()->byName(mark_type));
   if (not type) {
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   } else {
@@ -940,9 +942,9 @@ void TRACE_host_state_declare_value (const char *state, const char *value, const
 void TRACE_host_set_state(const char* host, const char* state_name, const char* value_name)
 {
   container_t container       = simgrid::instr::Container::byName(host);
-  simgrid::instr::Type* state = container->type_->byName(state_name);
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName(state_name));
   state->addEntityValue(value_name);
-  new simgrid::instr::SetStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
+  state->setEvent(MSG_get_clock(), container, value_name);
 }
 
 /** \ingroup TRACE_user_variables
@@ -959,9 +961,9 @@ void TRACE_host_set_state(const char* host, const char* state_name, const char*
 void TRACE_host_push_state(const char* host, const char* state_name, const char* value_name)
 {
   container_t container      = simgrid::instr::Container::byName(host);
-  simgrid::instr::Type* state = container->type_->byName(state_name);
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName(state_name));
   state->addEntityValue(value_name);
-  new simgrid::instr::PushStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
+  state->pushEvent(MSG_get_clock(), container, value_name);
 }
 
 /** \ingroup TRACE_user_variables
@@ -974,11 +976,11 @@ void TRACE_host_push_state(const char* host, const char* state_name, const char*
  *
  *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_push_state, TRACE_host_reset_state
  */
-void TRACE_host_pop_state (const char *host, const char *state)
+void TRACE_host_pop_state(const char* host, const char* state_name)
 {
   container_t container      = simgrid::instr::Container::byName(host);
-  simgrid::instr::Type* type = container->type_->byName(state);
-  new simgrid::instr::PopStateEvent(MSG_get_clock(), container, type);
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName(state_name));
+  state->popEvent(MSG_get_clock(), container);
 }
 
 /** \ingroup TRACE_API