Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b5837e6e2c3dbd7fce88207f5007f6594a635a5f
[simgrid.git] / src / msg / environment.c
1 /*     $Id$      */
2
3 /* Copyright (c) 2002-2007 Arnaud Legrand.                                  */
4 /* Copyright (c) 2007 Bruno Donassolo.                                      */
5 /* All rights reserved.                                                     */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "msg/private.h"
11 #include "xbt/sysdep.h"
12 #include "xbt/log.h"
13 #include "xbt/dict.h"
14
15 /** \defgroup msg_easier_life      Platform and Application management
16  *  \brief This section describes functions to manage the platform creation
17  *  and the application deployment. You should also have a look at 
18  *  \ref MSG_examples  to have an overview of their usage.
19  */
20 /** @addtogroup msg_easier_life
21  *    \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
22  * 
23  */
24
25 /********************************* MSG **************************************/
26
27 /** \ingroup msg_easier_life
28  * \brief A name directory service...
29  *
30  * Finds a m_host_t using its name.
31  * \param name the name of an host.
32  * \return the corresponding host
33  */
34 m_host_t MSG_get_host_by_name(const char *name)
35 {
36   smx_host_t simix_h = NULL;
37
38   simix_h = SIMIX_host_get_by_name(name);
39   if (simix_h == NULL) {
40     return NULL;
41   } else
42     return (m_host_t) simix_h->data;
43 }
44
45 /** \ingroup msg_easier_life
46  * \brief A platform constructor.
47  *
48  * Creates a new platform, including hosts, links and the
49  * routing_table. 
50  * \param file a filename of a xml description of a platform. This file 
51  * follows this DTD :
52  *
53  *     \include simgrid.dtd
54  *
55  * Here is a small example of such a platform 
56  *
57  *     \include small_platform.xml
58  *
59  * Have a look in the directory examples/msg/ to have a big example.
60  */
61 void MSG_create_environment(const char *file)
62 {
63   xbt_dict_cursor_t c;
64   smx_host_t h;
65   char *name;
66
67   SIMIX_create_environment(file);
68
69   /* Initialize MSG hosts */
70   xbt_dict_foreach(SIMIX_host_get_dict(), c, name, h) {
71     __MSG_host_create(h, NULL);
72   }
73   return;
74 }