return res;
}
- void AsImpl::getOneLinkRoutes(std::vector<Onelink*>* accumulator)
- {
- // recursing only. I have no route myself :)
- char* key;
- xbt_dict_cursor_t cursor = nullptr;
- AsImpl* rc_child;
- xbt_dict_foreach (children(), cursor, key, rc_child) {
- rc_child->getOneLinkRoutes(accumulator);
- }
- }
-
/** @brief Get the common ancestor and its first children in each line leading to src and dst
*
* In the recursive case, this sets common_ancestor, src_ancestor and dst_ancestor are set as follows.
namespace simgrid {
namespace kernel {
namespace routing {
- class Onelink;
-
/** @brief Autonomous Systems
*
* An AS is a network container, in charge of routing information between elements (hosts) and to the nearby ASes.
static void getGlobalRoute(routing::NetCard * src, routing::NetCard * dst,
/* OUT */ std::vector<surf::Link*> * links, double* latency);
- virtual void getOneLinkRoutes(std::vector<Onelink*> * accumulator);
virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) = 0;
enum class RoutingMode {
unset = 0, /**< Undefined type */
{
}
-void AsRoutedGraph::getOneLinkRoutes(std::vector<Onelink*>* accumulator)
-{
- sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
- route->link_list = new std::vector<Link*>();
-
- int table_size = static_cast<int>(vertices_.size());
- for (int src = 0; src < table_size; src++) {
- for (int dst = 0; dst < table_size; dst++) {
- route->link_list->clear();
- NetCard* src_elm = vertices_.at(src);
- NetCard* dst_elm = vertices_.at(dst);
- getLocalRoute(src_elm, dst_elm, route, nullptr);
-
- if (route->link_list->size() == 1) {
- Link* link = route->link_list->at(0);
- if (hierarchy_ == RoutingMode::base)
- accumulator->push_back(new Onelink(link, src_elm, dst_elm));
- else if (hierarchy_ == RoutingMode::recursive)
- accumulator->push_back(new Onelink(link, route->gw_src, route->gw_dst));
- else
- accumulator->push_back(new Onelink(link, nullptr, nullptr));
- }
- }
- }
- AsImpl::getOneLinkRoutes(accumulator); // Recursivly call this function on all my childs too
-}
-
void AsRoutedGraph::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
{
for (auto my_src: vertices_){
public:
explicit AsRoutedGraph(As* father, const char* name);
- void getOneLinkRoutes(std::vector<Onelink*>* accumulator) override;
-
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg, int change_order);
protected:
* Classes *
***********/
-class XBT_PRIVATE Onelink;
-
class AsRoute {
public:
explicit AsRoute(NetCard* gwSrc, NetCard* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
std::vector<Link*> links;
};
-/** @ingroup SURF_routing_interface
- * @brief Link of length 1, alongside with its source and destination. This is mainly useful in the ns3 bindings
- */
-class Onelink {
-public:
- Onelink(Link* link, NetCard* src, NetCard* dst) : src_(src), dst_(dst), link_(link) {}
- NetCard* src_;
- NetCard* dst_;
- Link* link_;
-};
-
}}}
#endif /* NETWORK_ROUTING_HPP_ */