-/**
- * @brief Callback used to set the netpoint and gateway located at some leaf of clusters (Torus, FatTree, etc)
- *
- * The netpoint can be either a host, router or another netzone.
- * Gateway must be non-null if netpoint is a netzone
- *
- * @param zone: The newly create zone, needed for creating new resources (hosts, links)
- * @param coord: the coordinates of the element
- * @param id: Internal identifier of the element
- * @return pair<NetPoint*, NetPoint*>: returns a pair of netpoint and gateway.
- */
-using ClusterNetPointCb = std::pair<kernel::routing::NetPoint*, kernel::routing::NetPoint*>(
- NetZone* zone, const std::vector<unsigned int>& coord, int id);
-/**
- * @brief Callback used to set the links for some leaf of the cluster (Torus, FatTree, etc)
- *
- * @param zone: The newly create zone, needed for creating new resources (hosts, links)
- * @param coord: the coordinates of the element
- * @param id: Internal identifier of the element
- * @return Pointer to the Link
- */
-using ClusterLinkCb = Link*(NetZone* zone, const std::vector<unsigned int>& coord, int id);
+
+// Extra data structure for complex constructors
+
+/** @brief Aggregates the callbacks used to build clusters netzones (Torus/Dragronfly/Fat-Tree) */
+struct ClusterCallbacks {
+ /**
+ * @brief Callback used to set the netpoint and gateway located at some leaf of clusters (Torus, FatTree, etc)
+ *
+ * The netpoint can be either a host, router or another netzone.
+ * Gateway must be non-null if netpoint is a netzone
+ *
+ * @param zone: The newly create zone, needed for creating new resources (hosts, links)
+ * @param coord: the coordinates of the element
+ * @param id: Internal identifier of the element
+ * @return pair<NetPoint*, NetPoint*>: returns a pair of netpoint and gateway.
+ */
+ using ClusterNetPointCb = std::pair<kernel::routing::NetPoint*, kernel::routing::NetPoint*>(
+ NetZone* zone, const std::vector<unsigned int>& coord, int id);
+ /**
+ * @brief Callback used to set the links for some leaf of the cluster (Torus, FatTree, etc)
+ *
+ * @param zone: The newly create zone, needed for creating new resources (hosts, links)
+ * @param coord: the coordinates of the element
+ * @param id: Internal identifier of the element
+ * @return Pointer to the Link
+ */
+ using ClusterLinkCb = Link*(NetZone* zone, const std::vector<unsigned int>& coord, int id);
+
+ std::function<ClusterNetPointCb> netpoint;
+ std::function<ClusterLinkCb> loopback = {};
+ std::function<ClusterLinkCb> limiter = {};
+ explicit ClusterCallbacks(std::function<ClusterNetPointCb> set_netpoint) : netpoint(set_netpoint){/*nothing to do */};
+ ClusterCallbacks(std::function<ClusterNetPointCb> set_netpoint, std::function<ClusterLinkCb> set_loopback,
+ std::function<ClusterLinkCb> set_limiter)
+ : netpoint(set_netpoint), loopback(set_loopback), limiter(set_limiter){/*nothing to do */};
+};