Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
d83d22a5362c742efb5457036a3486da45da4a8c
[simgrid.git] / src / include / simix / 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 SIMIX_DATATYPE_H
9 #define SIMIX_DATATYPE_H
10 #include "xbt/misc.h"
11 #include "xbt/swag.h"
12
13 SG_BEGIN_DECL()
14
15 /* ******************************** Host ************************************ */
16 /** @defgroup m_datatypes_management_details Details on SIMIX datatypes
17     @ingroup  m_datatypes_management*/
18
19 typedef struct s_simdata_host *simdata_host_t;
20 /** @brief Host datatype 
21     @ingroup m_datatypes_management_details */
22 typedef struct s_smx_host {
23   char *name;                   /**< @brief host name if any */
24   simdata_host_t simdata;       /**< @brief simulator data */
25   void *data;                   /**< @brief user data */
26 } s_smx_host_t;
27 /** @brief Host datatype  
28     @ingroup m_datatypes_management
29
30     A <em>location</em> (or <em>host</em>) is any possible place where
31     a process may run. Thus it is represented as a <em>physical
32     resource with computing capabilities</em>, some <em>mailboxes</em>
33     to enable running process to communicate with remote ones, and
34     some <em>private data</em> that can be only accessed by local
35     process.
36
37     \see m_host_management
38   @{ */
39 typedef struct s_smx_host *smx_host_t;
40 /** @} */
41
42
43 /* ******************************** Syncro ************************************ */
44
45 typedef struct s_smx_mutex *smx_mutex_t;
46 typedef struct s_smx_cond *smx_cond_t;
47
48
49 /********************************** Action *************************************/
50 typedef struct s_simdata_action *simdata_action_t;
51 /** @brief Action datatype 
52     @ingroup m_datatypes_management_details */
53 typedef struct s_smx_action {
54   int number;                   /**< @brief action name if any */
55   simdata_action_t simdata;     /**< @brief simulator data */
56   void *data;                   /**< @brief user data */
57 } s_smx_action_t;
58
59 typedef struct s_smx_action *smx_action_t;
60
61
62 /* ****************************** Process *********************************** */
63 typedef struct s_simdata_process *simdata_process_t;
64 /** @brief Process datatype 
65     @ingroup m_datatypes_management_details @{ */
66 typedef struct s_smx_process {
67   char *name;                   /**< @brief process name if any */
68   simdata_process_t simdata;    /**< @brief simulator data */
69   s_xbt_swag_hookup_t process_hookup;
70   void *data;                   /**< @brief user data */
71 } s_smx_process_t;
72 /** @} */
73 /** @brief Agent datatype  
74     @ingroup m_datatypes_management 
75
76     An agent may be defined as a <em>code</em>, with some <em>private
77     data</em>, executing in a <em>location</em>.
78     \see m_process_management
79   @{ */
80 typedef struct s_smx_process *smx_process_t;
81 /** @} */
82
83 /** @brief Agent code
84     @ingroup m_datatypes_management 
85     The code of an agent is a m_process_code_t, i.e. a function with no arguments 
86     returning no value.
87     \see m_process_management
88   @{ */
89 typedef int(*smx_process_code_t)(int argc,char *argv[]) ;
90 /** @} */
91
92
93 /* ***************************** Error handling ***************************** */
94 /** @brief Error handling 
95     @ingroup m_datatypes_management 
96     @{
97 */
98 typedef enum {
99   SIMIX_OK = 0,  /**< @brief Everything is right. Keep on going this way ! */
100   SIMIX_WARNING, /**< @brief Mmmh! Something must be not perfectly clean. But I
101       may be a paranoid freak... ! */
102   SIMIX_TRANSFER_FAILURE, /**< @brief There has been a problem during you action
103       transfer. Either the network is down or the remote host has been
104       shutdown. */
105   SIMIX_HOST_FAILURE, /**< @brief System shutdown. The host on which you are
106       running has just been rebooted. Free your datastructures and
107       return now !*/
108   SIMIX_ACTION_CANCELLED, /**< @brief Cancelled action. This action has been cancelled 
109                         by somebody!*/
110   SIMIX_FATAL /**< @brief You've done something wrong. You'd better look at it... */
111 } SIMIX_error_t;
112 /** @} */
113
114 SG_END_DECL()
115 #endif