Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / src / instr / instr_paje_types.hpp
index b30eb76..0961d6e 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. */
@@ -26,11 +26,16 @@ class Type {
   std::map<std::string, std::unique_ptr<Type>, std::less<>> children_;
   Container* issuer_ = nullptr;
 
+  static xbt::signal<void(Type const&, PajeEventType event_type)> on_creation;
+
 protected:
   Container* get_issuer() const { return issuer_; }
 
 public:
-  static xbt::signal<void(Type const&, PajeEventType event_type)> on_creation;
+  static void on_creation_cb(const std::function<void(Type const&, PajeEventType event_type)>& cb)
+  {
+    on_creation.connect(cb);
+  }
 
   Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
        Type* parent);
@@ -94,8 +99,13 @@ public:
 };
 
 class LinkType : public ValueType {
-public:
   static xbt::signal<void(LinkType const&, Type const&, Type const&)> on_creation;
+
+public:
+  static void on_creation_cb(const std::function<void(LinkType const&, Type const&, Type const&)>& cb)
+  {
+    on_creation.connect(cb);
+  }
   LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* parent)
       : ValueType(PajeEventType::DefineLinkType, name, alias, parent)
   {