1 /* Copyright (c) 2004-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "msg_private.h"
8 #include "xbt/sysdep.h"
11 #include "simgrid/s4u/NetZone.hpp"
12 #include "simgrid/s4u/engine.hpp"
20 /********************************* MSG **************************************/
22 /** \ingroup msg_simulation
23 * \brief A platform constructor.
25 * Creates a new platform, including hosts, links and the routing_table.
26 * \param file a filename of a xml description of a platform. This file follows this DTD :
28 * \include simgrid.dtd
30 * Here is a small example of such a platform
32 * \include small_platform.xml
34 * Have a look in the directory examples/msg/ to have a big example.
36 void MSG_create_environment(const char *file)
38 SIMIX_create_environment(file);
41 void MSG_post_create_environment() {
42 xbt_lib_cursor_t cursor;
46 /* Initialize MSG storages */
47 xbt_lib_foreach(storage_lib, cursor, name, data) {
48 if(data[SIMIX_STORAGE_LEVEL])
49 __MSG_storage_create(xbt_dict_cursor_get_elm(cursor));
53 msg_netzone_t MSG_environment_get_routing_root()
55 return simgrid::s4u::Engine::instance()->netRoot();
58 const char* MSG_environment_as_get_name(msg_netzone_t netzone)
60 return netzone->name();
63 msg_netzone_t MSG_environment_as_get_by_name(const char* name)
65 return simgrid::s4u::Engine::instance()->netzoneByNameOrNull(name);
68 xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t netzone)
70 return netzone->children();
73 const char* MSG_environment_as_get_property_value(msg_netzone_t netzone, const char* name)
75 return netzone->property(name);
78 void MSG_environment_as_set_property_value(msg_netzone_t netzone, const char* name, char* value)
80 netzone->setProperty(name, value);
83 xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t netzone)
85 return netzone->hosts();