From: Bruno Donassolo Date: Thu, 1 Apr 2021 12:16:52 +0000 (+0200) Subject: Factory functions for all Netzones X-Git-Tag: v3.28~489 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/49badd715efa0f86ebf3849ad53bd566812dc4be Factory functions for all Netzones --- diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 6ad381c6cd..b3d814ccf4 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -78,6 +78,18 @@ public: static xbt::signal on_seal; }; +// External constructors so that the types (and the types of their content) remain hidden +XBT_PUBLIC NetZone* createFullZone(const std::string& name); +XBT_PUBLIC NetZone* createClusterZone(const std::string& name); +XBT_PUBLIC NetZone* createDijkstraZone(const std::string& name, bool cache); +XBT_PUBLIC NetZone* createDragonflyZone(const std::string& name); +XBT_PUBLIC NetZone* createEmptyZone(const std::string& name); +XBT_PUBLIC NetZone* createFatTreeZone(const std::string& name); +XBT_PUBLIC NetZone* createFloydZone(const std::string& name); +XBT_PUBLIC NetZone* createTorusZone(const std::string& name); +XBT_PUBLIC NetZone* createVivaldiZone(const std::string& name); +XBT_PUBLIC NetZone* createWifiZone(const std::string& name); + } // namespace s4u } // namespace simgrid diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 23b711d8bd..0df128efd1 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -161,4 +161,12 @@ void ClusterZone::create_links_for_node(ClusterCreationArgs* cluster, int id, in } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createClusterZone(const std::string& name) +{ + return (new kernel::routing::ClusterZone(name))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 0a4c855acf..1c6d30fa55 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -258,4 +258,12 @@ void DijkstraZone::new_edge(int src_id, int dst_id, RouteCreationArgs* route) } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createDijkstraZone(const std::string& name, bool cache) +{ + return (new kernel::routing::DijkstraZone(name, cache))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index c8d532f325..6fbc55140a 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -346,4 +346,12 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createDragonflyZone(const std::string& name) +{ + return (new kernel::routing::DragonflyZone(name))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/EmptyZone.cpp b/src/kernel/routing/EmptyZone.cpp index ea7037145f..229caf088d 100644 --- a/src/kernel/routing/EmptyZone.cpp +++ b/src/kernel/routing/EmptyZone.cpp @@ -22,4 +22,12 @@ void EmptyZone::get_graph(const s_xbt_graph_t* /*graph*/, std::mapget_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index 0c4ee2f918..02d73c79a1 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -474,4 +474,12 @@ FatTreeLink::FatTreeLink(const ClusterCreationArgs* cluster, FatTreeNode* downNo } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createFatTreeZone(const std::string& name) +{ + return (new kernel::routing::FatTreeZone(name))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 45b0d659ed..4fffad4dc5 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -169,4 +169,12 @@ void FloydZone::do_seal() } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createFloydZone(const std::string& name) +{ + return (new kernel::routing::FloydZone(name))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index 2978471388..72d301fb2e 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -107,4 +107,12 @@ void FullZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoin } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createFullZone(const std::string& name) +{ + return (new kernel::routing::FullZone(name))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 2a2d2186d1..5471e5a27b 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -183,4 +183,12 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createTorusZone(const std::string& name) +{ + return (new kernel::routing::TorusZone(name))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index 76e9883edb..80354186c3 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -119,4 +119,12 @@ void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg } } // namespace routing } // namespace kernel + +namespace s4u { +NetZone* createVivaldiZone(const std::string& name) +{ + return (new kernel::routing::VivaldiZone(name))->get_iface(); +} +} // namespace s4u + } // namespace simgrid diff --git a/src/kernel/routing/WifiZone.cpp b/src/kernel/routing/WifiZone.cpp index a6f8bc7185..7071075add 100644 --- a/src/kernel/routing/WifiZone.cpp +++ b/src/kernel/routing/WifiZone.cpp @@ -66,4 +66,12 @@ s4u::Link* WifiZone::create_link(const std::string& name, const std::vectorget_iface(); +} +} // namespace s4u + } // namespace simgrid