当前位置: 首页>>代码示例>>C++>>正文


C++ NetworkManager::connectLink方法代码示例

本文整理汇总了C++中NetworkManager::connectLink方法的典型用法代码示例。如果您正苦于以下问题:C++ NetworkManager::connectLink方法的具体用法?C++ NetworkManager::connectLink怎么用?C++ NetworkManager::connectLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NetworkManager的用法示例。


在下文中一共展示了NetworkManager::connectLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
	Link link("L1", 10000000, 0.01, 64000);

	Node node1("H1");
	Node node2("H2");
	NetworkManager* nm = NetworkManager::getInstance();

	nm->registerLink(link);
	nm->registerNode(node1);
	nm->registerNode(node2);

	nm->connectLink("L1", "H1", "H2");

	Flow flow("F1", "H1", "H2", 20000000, TCP_RENO_t, 1);
	nm->registerFlow(flow);

	EventQueue* eq = EventQueue::getInstance();
	eq->run();

	Logger * logger = Logger::getInstance();
	delete logger;

	return EXIT_SUCCESS;
}
开发者ID:kudosjisoo,项目名称:CS143,代码行数:25,代码来源:testcase0.cpp

示例2: main

int main()
{
	std::vector<Link> links;
	std::vector<Node> nodes;

	std::vector<std::string> link_names = {"L0", "L1", "L2", "L3", "L4", "L5"};
	std::vector<std::string> node_names = {"H1", "H2", "R1", "R2", "R3", "R4" };

	links.push_back(Link(link_names[0], 12500000, 0.01, 64000));
	for (int i = 1; i < 5; i++)
	{
		links.push_back(Link(link_names[i], 10000000, 0.01, 64000));
	}
	links.push_back(Link(link_names[5], 12500000, 0.01, 64000));
	for (int i = 0; i < 6; i++)
	{
		nodes.push_back(Node(node_names[i]));
	}

	NetworkManager* nm = NetworkManager::getInstance();

	for (int i = 0; i < 6; i++)
	{
		nm->registerLink(links[i]);
		nm->registerNode(nodes[i]);
	}

	nm->connectLink("L0", "H1", "R1");
	nm->connectLink("L1", "R1", "R2");
	nm->connectLink("L2", "R1", "R3");
	nm->connectLink("L3", "R2", "R4");
	nm->connectLink("L4", "R3", "R4");
	nm->connectLink("L5", "R4", "H2");

	Flow flow("F1", "H1", "H2", 20000000, TCP_FAST_t, 0.5);
	nm->registerFlow(flow);

	EventQueue* eq = EventQueue::getInstance();
	eq->run();

	Logger * logger = Logger::getInstance();
	delete logger;

	return EXIT_SUCCESS;
}
开发者ID:kudosjisoo,项目名称:CS143,代码行数:45,代码来源:testcase1.cpp


注:本文中的NetworkManager::connectLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。