3 /* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include "xbt/error.h"
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(environment, msg,
12 "Logging specific to MSG (environment)");
14 /** \defgroup msg_easier_life Platform and Application management
15 * \brief This section describes functions to manage the platform creation
16 * and the application deployment. You should also have a look at
17 * \ref MSG_examples to have an overview of their usage.
20 /********************************* MSG **************************************/
22 /** \ingroup msg_easier_life
23 * \brief A name directory service...
25 * Finds a m_host_t using its name.
26 * \param name the name of an host.
27 * \return the corresponding host
29 m_host_t MSG_get_host_by_name(const char *name)
31 xbt_fifo_item_t i = NULL;
34 xbt_assert0(((msg_global != NULL)
35 && (msg_global->host != NULL)), "Environment not set yet");
37 xbt_fifo_foreach(msg_global->host,i,host,m_host_t) {
38 if(strcmp(host->name, name) == 0) return host;
43 /** \ingroup msg_easier_life
44 * \brief A platform constructor.
46 * Creates a new platform, including hosts, links and the
48 * \param file a filename of a xml description of a platform. This file
51 * \include surfxml.dtd
53 * Here is a small example of such a platform
55 * \include small_platform.xml
57 * Have a look in the directory examples/msg/ to have a big example.
59 void MSG_create_environment(const char *file) {
60 xbt_dict_cursor_t cursor = NULL;
62 void *workstation = NULL;
64 surf_timer_resource_init(file);
65 #ifdef ALVIN_SURF_SPECIAL
66 surf_workstation_resource_init_KCCFLN05(file);
68 surf_workstation_resource_init_CLM03(file);
71 xbt_dict_foreach(workstation_set, cursor, name, workstation) {
72 __MSG_host_create(name, workstation, NULL);