88#include " parser/topology/host/host_parser.hpp"
99#include " parser/topology/link/link_parser.hpp"
1010#include " parser/topology/switch/switch_parser.hpp"
11- #include " preset_storage.hpp"
1211
1312namespace sim {
1413
@@ -43,8 +42,8 @@ Simulator YamlParser::build_simulator_from_config(
4342
4443 parse_if_present (topology_config[" hosts" ],
4544 [this , &hosts_presets_node](ConfigNode node) {
46- process_hosts (node, hosts_presets_node);
47- });
45+ process_hosts (node, hosts_presets_node);
46+ });
4847
4948 const ConfigNode packet_spraying_node =
5049 topology_config[" packet-spraying" ].value_or_throw ();
@@ -56,10 +55,11 @@ Simulator YamlParser::build_simulator_from_config(
5655 }
5756 }
5857
59- parse_if_present (topology_config[" switches" ],
60- [this , &switches_presets_node, &packet_spraying_node](ConfigNode node) {
61- process_switches (node, switches_presets_node, packet_spraying_node);
62- });
58+ parse_if_present (
59+ topology_config[" switches" ],
60+ [this , &switches_presets_node, &packet_spraying_node](ConfigNode node) {
61+ process_switches (node, switches_presets_node, packet_spraying_node);
62+ });
6363
6464 std::optional<ConfigNode> links_presets_node = std::nullopt ;
6565 if (topology_presets_node.has_value ()) {
@@ -82,41 +82,50 @@ Simulator YamlParser::build_simulator_from_config(
8282 return std::move (m_simulator);
8383}
8484
85- void YamlParser::process_hosts (const ConfigNode &hosts_node, const std::optional<ConfigNode> &hosts_presets_node) {
85+ void YamlParser::process_hosts (
86+ const ConfigNode &hosts_node,
87+ const std::optional<ConfigNode> &hosts_presets_node) {
8688 process_identifiables<IHost>(
8789 hosts_node,
8890 [this ](std::shared_ptr<IHost> host) {
8991 return m_simulator.add_host (host);
9092 },
91- [&hosts_presets_node](const ConfigNode& hosts_node){
92- return HostParser::parse_i_host (ConfigNodeWithPreset (hosts_node, hosts_presets_node));
93+ [&hosts_presets_node](const ConfigNode &hosts_node) {
94+ return HostParser::parse_i_host (
95+ ConfigNodeWithPreset (hosts_node, hosts_presets_node));
9396 },
9497 " Can not add host." );
9598}
9699
97- void YamlParser::process_switches (const ConfigNode &switches_node,
98- const std::optional<ConfigNode> &switches_presets_node,
99- const ConfigNode &packet_spraying_node) {
100+ void YamlParser::process_switches (
101+ const ConfigNode &switches_node,
102+ const std::optional<ConfigNode> &switches_presets_node,
103+ const ConfigNode &packet_spraying_node) {
100104 process_identifiables<ISwitch>(
101105 switches_node,
102106 [this ](std::shared_ptr<ISwitch> swtch) {
103107 return m_simulator.add_switch (swtch);
104108 },
105- [&packet_spraying_node, &switches_presets_node](const ConfigNode &switch_node) {
106- return SwitchParser::parse_i_switch (ConfigNodeWithPreset (switch_node, switches_presets_node), packet_spraying_node);
109+ [&packet_spraying_node,
110+ &switches_presets_node](const ConfigNode &switch_node) {
111+ return SwitchParser::parse_i_switch (
112+ ConfigNodeWithPreset (switch_node, switches_presets_node),
113+ packet_spraying_node);
107114 },
108115 " Can not add switch." );
109116}
110117
111- void YamlParser::process_links (const ConfigNode &links_node,
112- const std::optional<ConfigNode> &link_presets_node) {
118+ void YamlParser::process_links (
119+ const ConfigNode &links_node,
120+ const std::optional<ConfigNode> &link_presets_node) {
113121 process_identifiables<ILink>(
114122 links_node,
115123 [this ](std::shared_ptr<ILink> link) {
116124 return m_simulator.add_link (link);
117125 },
118126 [&link_presets_node](const ConfigNode &link_node) {
119- return LinkParser::parse_i_link (ConfigNodeWithPreset (link_node, link_presets_node));
127+ return LinkParser::parse_i_link (
128+ ConfigNodeWithPreset (link_node, link_presets_node));
120129 },
121130 " Can not add link." );
122131}
0 commit comments