Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove explicit conversion to std::string when it's not required.
[simgrid.git] / src / instr / instr_paje_containers.hpp
index 8ce3d7f..a4a4fe0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -9,8 +9,7 @@
 #include "src/instr/instr_private.hpp"
 #include <string>
 
-namespace simgrid {
-namespace instr {
+namespace simgrid::instr {
 class Type;
 class LinkType;
 class StateType;
@@ -30,10 +29,14 @@ class Container {
 protected:
   static void set_root(Container* root) { root_container_ = root; }
 
-public:
+private:
   static xbt::signal<void(Container const&)> on_creation;
   static xbt::signal<void(Container const&)> on_destruction;
 
+public:
+  static void on_creation_cb(const std::function<void(Container const&)>& cb) { on_creation.connect(cb); }
+  static void on_destruction_cb(const std::function<void(Container const&)>& cb) { on_destruction.connect(cb); }
+
   explicit Container(const std::string& name, const std::string& type_name, Container* parent);
   Container(const Container&) = delete;
   Container& operator=(const Container&) = delete;
@@ -71,6 +74,5 @@ class HostContainer : public Container {
 public:
   HostContainer(s4u::Host const& host, NetZoneContainer* parent);
 };
-} // namespace instr
-} // namespace simgrid
+} // namespace simgrid::instr
 #endif