Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make NetCards extendable, and use this for NS3 extension
[simgrid.git] / src / kernel / routing / NetCard.hpp
index 7a78c0a..40454d4 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef KERNEL_ROUTING_NETCARD_HPP_
 #define KERNEL_ROUTING_NETCARD_HPP_
 
+#include <xbt/Extendable.hpp>
 #include <xbt/base.h>
 #include <xbt/signal.hpp>
 
 namespace simgrid {
 namespace kernel {
 namespace routing {
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(NetCard*)>) netcardCreatedCallbacks;
 
 /** @ingroup SURF_routing_interface
  * @brief Network cards are the vertices in the graph representing the network, used to compute paths between nodes.
  *
  * @details This represents a position in the network. One can route information between two netcards
  */
-class NetCard {
+class NetCard : public simgrid::xbt::Extendable<NetCard> {
+
 public:
   enum class Type { Host, Router, As };
 
@@ -33,7 +34,7 @@ public:
   {
     if (containingAS != nullptr)
       id_ = containingAS->addComponent(this);
-    simgrid::kernel::routing::netcardCreatedCallbacks(this);
+    simgrid::kernel::routing::NetCard::onCreation(this);
   }
   ~NetCard() = default;
 
@@ -48,6 +49,8 @@ public:
   bool isHost() { return componentType_ == Type::Host; }
   bool isRouter() { return componentType_ == Type::Router; }
 
+  static simgrid::xbt::signal<void(NetCard*)> onCreation;
+
 private:
   unsigned int id_;
   std::string name_;