Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid costly exceptions when looking into a map.
[simgrid.git] / src / instr / instr_interface.cpp
index dbefe45..726b68a 100644 (file)
@@ -84,7 +84,7 @@ void TRACE_category_with_color (const char *category, const char *color)
   if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
 
-  if (!(TRACE_categorized() && category != nullptr))
+  if (not(TRACE_categorized() && category != nullptr))
     return;
 
   //check if category is already created
@@ -196,7 +196,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar
     mark_color = white;
 
   XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
-  PJ_value_new (mark_value, mark_color, type);
+  value rett(mark_value, mark_color, type);
 }
 
 /** \ingroup TRACE_mark
@@ -247,9 +247,8 @@ void TRACE_mark(const char *mark_type, const char *mark_value)
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   }
 
-  val_t value = PJ_value_get (mark_value, type);
   XBT_DEBUG("MARK %s %s", mark_type, mark_value);
-  new NewEvent (MSG_get_clock(), PJ_container_get_root(), type, value);
+  new NewEvent(MSG_get_clock(), PJ_container_get_root(), type, value::get(mark_value, type));
 }
 
 /** \ingroup TRACE_mark
@@ -485,19 +484,6 @@ void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *v
   instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, nullptr, user_vm_variables);
 }
 
-/** \ingroup TRACE_user_variables
- *  \brief Get declared user vm variables
- *
- * This function should be used to get VM variables that were already declared with #TRACE_vm_variable_declare or with
- * #TRACE_vm_variable_declare_with_color.
- *
- * \return A dynar with the declared host variables, must be freed with xbt_dynar_free.
- */
-xbt_dynar_t TRACE_get_vm_variables ()
-{
-  return instr_dict_to_dynar (user_vm_variables);
-}
-
 /* for host variables */
 /** \ingroup TRACE_user_variables
  *  \brief Declare a new user variable associated to hosts.
@@ -959,11 +945,12 @@ void TRACE_host_state_declare_value (const char *state, const char *value, const
  *
  *  \see TRACE_host_state_declare, TRACE_host_push_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
-void TRACE_host_set_state (const char *host, const char *state, const char *value)
+void TRACE_host_set_state(const char* host, const char* state, const char* value_str)
 {
   container_t container = PJ_container_get(host);
   type_t type = PJ_type_get (state, container->type);
-  val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+  value* val =
+      value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
   new SetStateEvent(MSG_get_clock(), container, type, val);
 }
 
@@ -978,11 +965,12 @@ void TRACE_host_set_state (const char *host, const char *state, const char *valu
  *
  *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
-void TRACE_host_push_state (const char *host, const char *state, const char *value)
+void TRACE_host_push_state(const char* host, const char* state, const char* value_str)
 {
   container_t container = PJ_container_get(host);
   type_t type = PJ_type_get (state, container->type);
-  val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+  value* val =
+      value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
   new PushStateEvent(MSG_get_clock(), container, type, val);
 }
 
@@ -1003,23 +991,6 @@ void TRACE_host_pop_state (const char *host, const char *state)
   new PopStateEvent(MSG_get_clock(), container, type);
 }
 
-/** \ingroup TRACE_user_variables
- *  \brief Reset the state of a given host.
- *
- *  Clear all previous values of a user state.
- *
- *  \param host The name of the host to be considered.
- *  \param state The name of the state to be cleared.
- *
- *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_push_state, TRACE_host_pop_state
- */
-void TRACE_host_reset_state (const char *host, const char *state)
-{
-  container_t container = PJ_container_get(host);
-  type_t type = PJ_type_get (state, container->type);
-  new ResetStateEvent(MSG_get_clock(), container, type);
-}
-
 /** \ingroup TRACE_API
  *  \brief Get Paje container types that can be mapped to the nodes of a graph.
  *
@@ -1045,21 +1016,3 @@ xbt_dynar_t TRACE_get_edge_types ()
 {
   return instr_dict_to_dynar (trivaEdgeTypes);
 }
-
-/** \ingroup TRACE_API
- *  \brief Pauses all tracing activities.
- *  \see TRACE_resume
- */
-void TRACE_pause ()
-{
-  instr_pause_tracing();
-}
-
-/** \ingroup TRACE_API
- *  \brief Resumes all tracing activities.
- *  \see TRACE_pause
- */
-void TRACE_resume ()
-{
-  instr_resume_tracing();
-}