X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9caf173e476622d309cc5653a83d224d05787cc7..8a0e2b82a1c0981a84e67f1bb4afb6e16fbf8c3a:/include/simgrid/s4u/NetZone.hpp diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index da36a0326c..d8e242b718 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -6,20 +6,15 @@ #ifndef SIMGRID_S4U_NETZONE_HPP #define SIMGRID_S4U_NETZONE_HPP +#include +#include + #include #include #include #include -#include -#include -#include - -#include -#include - namespace simgrid { - namespace s4u { /** @brief Networking Zones @@ -42,48 +37,74 @@ public: const std::string& get_name() const { return name_; } /** @brief Retrieves the name of that netzone as a C string */ const char* get_cname() const; - NetZone* getFather(); - - XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_name()") const std::string& getName() const { return get_name(); } - XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_cname()") const char* getCname() const { return get_cname(); } + NetZone* get_father(); std::vector* getChildren(); // Sub netzones void getHosts(std::vector * whereto); // retrieve my content as a vector of hosts int getHostCount(); +private: + std::unordered_map properties_; + +public: /** Get the properties assigned to a host */ std::unordered_map* getProperties(); /** Retrieve the property value (or nullptr if not set) */ - const char* getProperty(const char* key); - void setProperty(const char* key, const char* value); + const char* get_property(const char* key); + void set_property(const char* key, const char* value); /* Add content to the netzone, at parsing time. It should be sealed afterward. */ virtual int addComponent(kernel::routing::NetPoint * elm); /* A host, a router or a netzone, whatever */ - virtual void addRoute(kernel::routing::NetPoint * src, kernel::routing::NetPoint * dst, - kernel::routing::NetPoint * gw_src, kernel::routing::NetPoint * gw_dst, - std::vector & link_list, bool symmetrical); - virtual void addBypassRoute(kernel::routing::NetPoint * src, kernel::routing::NetPoint * dst, - kernel::routing::NetPoint * gw_src, kernel::routing::NetPoint * gw_dst, - std::vector & link_list, bool symmetrical) = 0; + virtual void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, + kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, + std::vector& link_list, bool symmetrical); + virtual void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, + kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, + std::vector& link_list, bool symmetrical) = 0; /*** Called on each newly created regular route (not on bypass routes) */ static simgrid::xbt::signal& link_list)> - onRouteCreation; - static simgrid::xbt::signal onCreation; - static simgrid::xbt::signal onSeal; + std::vector& link_list)> + on_route_creation; + static simgrid::xbt::signal on_creation; + static simgrid::xbt::signal on_seal; -protected: - unsigned int getTableSize() { return vertices_.size(); } - std::vector getVertices() { return vertices_; } + // Deprecation wrappers + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_father()") NetZone* getFather() { return get_father(); } + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_name()") const std::string& getName() const { return get_name(); } + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_cname()") const char* getCname() const { return get_cname(); } + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_route()") void addRoute( + kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, + kernel::routing::NetPoint* gw_dst, std::vector& link_list, bool symmetrical) + { + add_route(src, dst, gw_src, gw_dst, link_list, symmetrical); + } + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_bypass_route()") void addBypassRoute( + kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, + kernel::routing::NetPoint* gw_dst, std::vector& link_list, bool symmetrical) + { + add_bypass_route(src, dst, gw_src, gw_dst, link_list, symmetrical); + } + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_property()") const char* getProperty(const char* key) + { + return get_property(key); + } + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::set_property()") void setProperty(const char* key, const char* value) + { + set_property(key, value); + } private: // our content, as known to our graph routing algorithm (maps vertexId -> vertex) std::vector vertices_; - std::unordered_map properties_; +protected: + unsigned int get_table_size() { return vertices_.size(); } + std::vector getVertices() { return vertices_; } + +private: NetZone* father_ = nullptr; std::string name_;