Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
XBT documentation reorganization. module-xbt only contains the structure, module...
[simgrid.git] / include / msg / datatypes.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved.        */
4
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. */
7
8 #ifndef MSG_DATATYPE_H
9 #define MSG_DATATYPE_H
10 #include "xbt/misc.h"
11
12 SG_BEGIN_DECL()
13
14 /* ******************************** Host ************************************ */
15 /** @defgroup m_datatypes_management_details */
16
17 typedef struct simdata_host *simdata_host_t;
18 /** @brief Host datatype 
19     @ingroup m_datatypes_management_details */
20 typedef struct m_host {
21   char *name;                   /**< @brief host name if any */
22   simdata_host_t simdata;       /**< @brief simulator data */
23   void *data;                   /**< @brief user data */
24 } s_m_host_t;
25 /** @brief Host datatype  
26     @ingroup m_datatypes_management
27
28     A <em>location</em> (or <em>host</em>) is any possible place where
29     a process may run. Thus it is represented as a <em>physical
30     resource with computing capabilities</em>, some <em>mailboxes</em>
31     to enable running process to communicate with remote ones, and
32     some <em>private data</em> that can be only accessed by local
33     process.
34
35     \see m_host_management
36   @{ */
37 typedef struct m_host *m_host_t;
38 /** @} */
39 /* ******************************** Task ************************************ */
40
41 typedef struct simdata_task *simdata_task_t;
42 /** @brief Task datatype 
43     @ingroup m_datatypes_management_details */
44 typedef struct m_task {
45   char *name;                   /**< @brief task name if any */
46   simdata_task_t simdata;       /**< @brief simulator data */
47   void *data;                   /**< @brief user data */
48 } s_m_task_t;
49 /** @brief Task datatype  
50     @ingroup m_datatypes_management 
51
52     A <em>task</em> may then be defined by a <em>computing
53     amount</em>, a <em>message size</em> and some <em>private
54     data</em>.
55     \see m_task_management
56   @{ */
57 typedef struct m_task  *m_task_t;
58
59 /** \brief Default value for an uninitialized #m_task_t.
60     \ingroup m_datatypes_management 
61 */
62 #define MSG_TASK_UNINITIALIZED NULL
63
64 /** @} */
65
66 /* ****************************** Process *********************************** */
67 typedef struct simdata_process *simdata_process_t;
68 /** @brief Process datatype 
69     @ingroup m_datatypes_management_details @{ */
70 typedef struct m_process {
71   char *name;                   /**< @brief process name if any */
72   simdata_process_t simdata;    /**< @brief simulator data */
73   void *data;                   /**< @brief user data */
74 } s_m_process_t;
75 /** @} */
76 /** @brief Agent datatype  
77     @ingroup m_datatypes_management 
78
79     An agent may be defined as a <em>code</em>, with some <em>private
80     data</em>, executing in a <em>location</em>.
81     \see m_process_management
82   @{ */
83 typedef struct m_process *m_process_t;
84 /** @} */
85
86 /** @brief Agent code
87     @ingroup m_datatypes_management 
88     The code of an agent is a m_process_code_t, i.e. a function with no arguments 
89     returning no value.
90     \see m_process_management
91   @{ */
92 typedef int(*m_process_code_t)(int argc,char *argv[]) ;
93 /** @} */
94
95 /* ********************************* Channel ******************************** */
96 /** @brief Channel datatype  
97     @ingroup m_datatypes_management 
98
99     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
100     port number does).
101     \see m_channel_management
102    @{ */
103 typedef int m_channel_t;
104 /** @} */
105
106 /* ***************************** Error handling ***************************** */
107 /** @brief Error handling 
108     @ingroup m_datatypes_management 
109     @{
110 */
111 typedef enum {
112   MSG_OK = 0,  /**< @brief Everything is right. Keep on going this way ! */
113   MSG_WARNING, /**< @brief Mmmh! Something must be not perfectly clean. But I
114       may be a paranoid freak... ! */
115   MSG_TRANSFER_FAILURE, /**< @brief There has been a problem during you task
116       transfer. Either the network is down or the remote host has been
117       shutdown. */
118   MSG_HOST_FAILURE, /**< @brief System shutdown. The host on which you are
119       running has just been rebooted. Free your datastructures and
120       return now !*/
121   MSG_TASK_CANCELLED, /**< @brief Cancelled task. This task has been cancelled 
122                         by somebody!*/
123   MSG_FATAL /**< @brief You've done something wrong. You'd better look at it... */
124 } MSG_error_t;
125 /** @} */
126
127 SG_END_DECL()
128 #endif