Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / instr / instr_paje_types.hpp
index b30eb76..bdb16d4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2023. 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. */
@@ -11,8 +11,7 @@
 #include <string>
 #include <vector>
 
-namespace simgrid {
-namespace instr {
+namespace simgrid::instr {
 class ContainerType;
 class EventType;
 
@@ -26,11 +25,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 +98,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)
   {
@@ -121,6 +130,5 @@ public:
   void pop_event();
   void pop_event(TIData* extra);
 };
-} // namespace instr
-} // namespace simgrid
+} // namespace simgrid::instr
 #endif