X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1365d67fed75eed3bc33aaed77aac4481039f27a..737a256dd1d7adf4255c24729ae6069284049d2c:/include/simgrid/kernel/routing/NetZoneImpl.hpp diff --git a/include/simgrid/kernel/routing/NetZoneImpl.hpp b/include/simgrid/kernel/routing/NetZoneImpl.hpp index 2e9b75b614..94b474c67a 100644 --- a/include/simgrid/kernel/routing/NetZoneImpl.hpp +++ b/include/simgrid/kernel/routing/NetZoneImpl.hpp @@ -19,6 +19,20 @@ namespace simgrid { namespace kernel { namespace routing { +class Route { +public: + Route() = default; + explicit Route(NetPoint* src, NetPoint* dst, NetPoint* gwSrc, NetPoint* gwDst) + : src_(src), dst_(dst), gw_src_(gwSrc), gw_dst_(gwDst) + { + } + NetPoint* src_ = nullptr; + NetPoint* dst_ = nullptr; + NetPoint* gw_src_ = nullptr; + NetPoint* gw_dst_ = nullptr; + std::vector link_list_; +}; + class BypassRoute { public: explicit BypassRoute(NetPoint* gwSrc, NetPoint* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {} @@ -70,13 +84,6 @@ class XBT_PUBLIC NetZoneImpl : public xbt::PropertyHolder { std::map, BypassRoute*> bypass_routes_; // src x dst -> route routing::NetPoint* netpoint_ = nullptr; // Our representative in the father NetZone - std::shared_ptr network_model_; - std::shared_ptr cpu_model_vm_; - std::shared_ptr cpu_model_pm_; - std::shared_ptr disk_model_; - std::shared_ptr host_model_; - /** @brief Perform sealing procedure for derived classes, if necessary */ - virtual void do_seal(){}; protected: explicit NetZoneImpl(const std::string& name); @@ -92,7 +99,7 @@ protected: * @param into Container into which the traversed links and gateway information should be pushed * @param latency Accumulator in which the latencies should be added (caller must set it to 0) */ - virtual void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) = 0; + virtual void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) = 0; /** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */ /* returns whether we found a bypass path */ bool get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst, @@ -100,14 +107,10 @@ protected: public: enum class RoutingMode { - unset = 0, /**< Undefined type */ - base, /**< Base case: use simple link lists for routing */ - recursive /**< Recursive case: also return gateway information */ + base, /**< Base case: use simple link lists for routing */ + recursive /**< Recursive case: also return gateway information */ }; - /* FIXME: protect the following fields once the construction madness is sorted out */ - RoutingMode hierarchy_ = RoutingMode::unset; - /** @brief Retrieves the network model associated to this NetZone */ const std::shared_ptr& get_network_model() const { return network_model_; } /** @brief Retrieves the CPU model for virtual machines associated to this NetZone */ @@ -127,14 +130,18 @@ public: NetZoneImpl* get_parent() const { return parent_; } /** @brief Returns the list of direct children (no grand-children). This returns the internal data, no copy. * Don't mess with it.*/ - std::vector* get_children() { return &children_; } - void add_child(NetZoneImpl* new_zone); + const std::vector& get_children() const { return children_; } + /** @brief Get current netzone hierarchy */ + RoutingMode get_hierarchy() const { return hierarchy_; } /** @brief Retrieves the name of that netzone as a C++ string */ const std::string& get_name() const { return name_; } /** @brief Retrieves the name of that netzone as a C string */ const char* get_cname() const { return name_.c_str(); }; + /** @brief Gets the netpoint associated to this netzone */ + kernel::routing::NetPoint* get_netpoint() const { return netpoint_; } + std::vector get_all_hosts() const; int get_host_count() const; @@ -143,8 +150,9 @@ public: /** @brief Create a disk with the disk model from this NetZone */ s4u::Disk* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth); /** @brief Make a link within that NetZone */ - virtual s4u::Link* create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy); + virtual s4u::Link* create_link(const std::string& name, const std::vector& bandwidths); + /** @brief Make a router within that NetZone */ + NetPoint* create_router(const std::string& name); /** @brief Creates a new route in this NetZone */ virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, std::vector& link_list, bool symmetrical); @@ -176,6 +184,17 @@ public: virtual void get_graph(const s_xbt_graph_t* graph, std::map>* nodes, std::map>* edges) = 0; + +private: + RoutingMode hierarchy_ = RoutingMode::base; + std::shared_ptr network_model_; + std::shared_ptr cpu_model_vm_; + std::shared_ptr cpu_model_pm_; + std::shared_ptr disk_model_; + std::shared_ptr host_model_; + /** @brief Perform sealing procedure for derived classes, if necessary */ + virtual void do_seal() { /* obviously nothing to do by default */ } + void add_child(NetZoneImpl* new_zone); }; } // namespace routing } // namespace kernel