Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More const.
[simgrid.git] / src / instr / instr_config.cpp
index 881499f..a1be187 100644 (file)
@@ -23,7 +23,7 @@ XBT_LOG_NEW_CATEGORY(instr, "Logging the behavior of the tracing system (used fo
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_config, instr, "Configuration");
 
 std::ofstream tracing_file;
-std::map<container_t, std::ofstream*> tracing_files; // TI specific
+std::map<const simgrid::instr::Container*, std::ofstream*> tracing_files; // TI specific
 double prefix = 0.0;                                 // TI specific
 
 constexpr char OPT_TRACING_BASIC[]             = "tracing/basic";
@@ -172,7 +172,7 @@ static void print_line(const char* option, const char* desc, const char* longdes
 {
   std::string str = std::string("--cfg=") + option + " ";
 
-  int len = str.size();
+  int len = static_cast<int>(str.size());
   XBT_HELP("%s%*.*s %s", str.c_str(), 30 - len, 30 - len, "", desc);
   if (longdesc != nullptr) {
     XBT_HELP("%s\n", longdesc);
@@ -216,16 +216,16 @@ int trace_precision;
 /*************
  * Callbacks *
  *************/
-xbt::signal<void(Container&)> Container::on_creation;
-xbt::signal<void(Container&)> Container::on_destruction;
-xbt::signal<void(Type&, e_event_type)> Type::on_creation;
-xbt::signal<void(LinkType&, Type&, Type&)> LinkType::on_creation;
+xbt::signal<void(Container const&)> Container::on_creation;
+xbt::signal<void(Container const&)> Container::on_destruction;
+xbt::signal<void(Type const&, e_event_type)> Type::on_creation;
+xbt::signal<void(LinkType const&, Type const&, Type const&)> LinkType::on_creation;
 xbt::signal<void(PajeEvent&)> PajeEvent::on_creation;
-xbt::signal<void(PajeEvent&)> PajeEvent::on_destruction;
-xbt::signal<void(StateEvent&)> StateEvent::on_destruction;
-xbt::signal<void(EntityValue&)> EntityValue::on_creation;
+xbt::signal<void(PajeEvent const&)> PajeEvent::on_destruction;
+xbt::signal<void(StateEvent const&)> StateEvent::on_destruction;
+xbt::signal<void(EntityValue const&)> EntityValue::on_creation;
 
-static void on_container_creation_paje(Container& c)
+static void on_container_creation_paje(const Container& c)
 {
   double timestamp = SIMIX_get_clock();
   std::stringstream stream;
@@ -244,7 +244,7 @@ static void on_container_creation_paje(Container& c)
   tracing_file << stream.str() << std::endl;
 }
 
-static void on_container_destruction_paje(Container& c)
+static void on_container_destruction_paje(const Container& c)
 {
   // trace my destruction, but not if user requests so or if the container is root
   if (not trace_disable_destroy && &c != Container::get_root()) {
@@ -260,7 +260,7 @@ static void on_container_destruction_paje(Container& c)
   }
 }
 
-static void on_container_creation_ti(Container& c)
+static void on_container_creation_ti(const Container& c)
 {
   XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, SIMIX_get_clock());
   // if we are in the mode with only one file
@@ -286,7 +286,7 @@ static void on_container_creation_ti(Container& c)
   tracing_files.insert({&c, ti_unique_file});
 }
 
-static void on_container_destruction_ti(Container& c)
+static void on_container_destruction_ti(const Container& c)
 {
   if (not trace_disable_destroy && &c != Container::get_root()) {
     if (not simgrid::config::get_value<bool>("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) {
@@ -323,13 +323,13 @@ static void on_event_destruction(const PajeEvent& event)
   tracing_file << event.stream_.str() << std::endl;
 }
 
-static void on_state_event_destruction(StateEvent& event)
+static void on_state_event_destruction(const StateEvent& event)
 {
   if (event.has_extra())
     *tracing_files.at(event.get_container()) << event.stream_.str() << std::endl;
 }
 
-static void on_type_creation(Type& type, e_event_type event_type)
+static void on_type_creation(const Type& type, e_event_type event_type)
 {
   if (event_type == PAJE_DefineLinkType)
     return; // this kind of type has to be handled differently
@@ -344,7 +344,7 @@ static void on_type_creation(Type& type, e_event_type event_type)
   tracing_file << stream.str() << std::endl;
 }
 
-static void on_link_type_creation(Type& type, Type& source, Type& dest)
+static void on_link_type_creation(const Type& type, const Type& source, const Type& dest)
 {
   std::stringstream stream;
   XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, trace_precision, 0.);