Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't build useless temporary object (sonar, c++17).
[simgrid.git] / src / instr / instr_paje_containers.hpp
index 8ce3d7f3e931f15a934287add0d4194bfd276540..06e6219cc29a6467651c7ce74ef169da8f609a5a 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. */
@@ -30,10 +30,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;