Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4557bfdfce7196dd0b63ad293ab03ad15e6f10d7
[simgrid.git] / src / include / simix / datatypes.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
4    All rights reserved.                                          */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #ifndef SIMIX_DATATYPE_H
10 #define SIMIX_DATATYPE_H
11 #include "xbt/misc.h"
12 #include "xbt/swag.h"
13
14 SG_BEGIN_DECL()
15
16 /* ******************************** Host ************************************ */
17 /** @defgroup m_datatypes_management_details Details on SIMIX datatypes
18     @ingroup  m_datatypes_management*/
19
20 typedef struct s_simdata_host *simdata_host_t;
21 /** @brief Host datatype 
22     @ingroup m_datatypes_management_details */
23 typedef struct s_smx_host {
24   char *name;                   /**< @brief host name if any */
25   simdata_host_t simdata;       /**< @brief simulator data */
26   void *data;                   /**< @brief user data */
27 } s_smx_host_t;
28 /** @brief Host datatype  
29     @ingroup m_datatypes_management
30
31     A <em>location</em> (or <em>host</em>) is any possible place where
32     a process may run. Thus it is represented as a <em>physical
33     resource with computing capabilities</em>, some <em>mailboxes</em>
34     to enable running process to communicate with remote ones, and
35     some <em>private data</em> that can be only accessed by local
36     process.
37
38     \see m_host_management
39   @{ */
40 typedef struct s_smx_host *smx_host_t;
41 /** @} */
42
43
44 /* ******************************** Syncro ************************************ */
45
46 typedef struct s_smx_mutex *smx_mutex_t;
47 typedef struct s_smx_cond *smx_cond_t;
48
49
50 /********************************** Action *************************************/
51 typedef struct s_simdata_action *simdata_action_t;
52 /** @brief Action datatype 
53     @ingroup m_datatypes_management_details */
54 typedef struct s_smx_action {
55   char *name;                   /**< @brief action name if any */
56   simdata_action_t simdata;     /**< @brief simulator data */
57   void *data;                   /**< @brief user data */
58 } s_smx_action_t;
59
60 typedef struct s_smx_action *smx_action_t;
61
62
63 /* ****************************** Process *********************************** */
64 typedef struct s_simdata_process *simdata_process_t;
65 /** @brief Process datatype 
66     @ingroup m_datatypes_management_details @{ */
67 typedef struct s_smx_process {
68   char *name;                   /**< @brief process name if any */
69   simdata_process_t simdata;    /**< @brief simulator data */
70   s_xbt_swag_hookup_t process_hookup;
71   s_xbt_swag_hookup_t synchro_hookup;
72   s_xbt_swag_hookup_t host_proc_hookup;
73   void *data;                   /**< @brief user data */
74 } s_smx_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 s_smx_process *smx_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(*smx_process_code_t)(int argc,char *argv[]) ;
93 /** @} */
94
95
96 /* ***************************** Error handling ***************************** */
97 /** @brief Error handling 
98     @ingroup m_datatypes_management 
99     @{
100 */
101 typedef enum {
102   SIMIX_OK = 0,  /**< @brief Everything is right. Keep on going this way ! */
103   SIMIX_WARNING, /**< @brief Mmmh! Something must be not perfectly clean. But I
104       may be a paranoid freak... ! */
105   SIMIX_TRANSFER_FAILURE, /**< @brief There has been a problem during you action
106       transfer. Either the network is down or the remote host has been
107       shutdown. */
108   SIMIX_HOST_FAILURE, /**< @brief System shutdown. The host on which you are
109       running has just been rebooted. Free your datastructures and
110       return now !*/
111   SIMIX_ACTION_CANCELLED, /**< @brief Cancelled action. This action has been cancelled 
112                         by somebody!*/
113   SIMIX_FATAL /**< @brief You've done something wrong. You'd better look at it... */
114 } SIMIX_error_t;
115 /** @} */
116
117 SG_END_DECL()
118 #endif