<br/>
.. _platform_cpp:
-
+
C++ Platforms
#############
.. code-block:: cpp
auto* link = zone->create_split_duplex_link("1", "125MBps")->set_latency("24us")->seal();
-
+
zone->add_route(S1, C1, nullptr, nullptr, {{link, LinkInRoute::Direction::UP}});
.. note::
Engine will look for a function with this signature: "**void load_platform(const sg4::Engine& e)**", and
execute it. It could be an easy way to make the transition between XML and C++ if necessary.
-For more details, please refer to the cpp and CMakeLists.txt files in
+For more details, please refer to the cpp and CMakeLists.txt files in
`examples/platform <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms>`_.
const sg4::Host* gpu = host_zone->create_host(gpu_name, 1e12)->seal();
/* connecting them */
sg4::Link* link = host_zone->create_link("link-" + cpu_name, 10e9)->set_latency(10e-9)->seal();
- host_zone->add_route(cpu->get_netpoint(), gpu->get_netpoint(), nullptr, nullptr, std::vector<sg4::Link*>{link});
+ host_zone->add_route(cpu->get_netpoint(), gpu->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
host_zone->seal();
/* cpu is the gateway for this host */
The code is straightforward and can be easily adapted to more complex environments thanks to the flexibility
provided by the C++ API.
-