Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The file containing the new implementation of the switch context mechanism.
[simgrid.git] / src / xbt / xbt_context_factory.h
1 #ifndef _XBT_CONTEXT_FACTORY_H  \r
2 #define _XBT_CONTEXT_FACTORY_H\r
3 \r
4 #include "portable.h"\r
5 #include "xbt/function_types.h"\r
6 #include "xbt_context_private.h"\r
7 \r
8 SG_BEGIN_DECL()\r
9 \r
10 /* forward declaration */\r
11 struct s_xbt_context_factory;\r
12 \r
13 /* this function describes the interface that all context factory must implement */\r
14 typedef xbt_context_t (*xbt_pfn_context_factory_create_context_t)(const char*, xbt_main_func_t, void_f_pvoid_t, void*, void_f_pvoid_t, void*, int, char**);\r
15 typedef int (*xbt_pfn_context_factory_create_maestro_context_t)(xbt_context_t*);\r
16 \r
17 /* this function finalize the specified context factory */\r
18 typedef int (*xbt_pfn_context_factory_finalize_t)(struct s_xbt_context_factory**);\r
19 \r
20 /* this interface is used by the xbt context module to create the appropriate concept */\r
21 typedef struct s_xbt_context_factory\r
22 {\r
23         xbt_pfn_context_factory_create_maestro_context_t create_maestro_context;        /* create the context of the maestro    */\r
24         xbt_pfn_context_factory_create_context_t create_context;                                        /* create a new context                                 */\r
25         xbt_pfn_context_factory_finalize_t finalize;                                                            /* finalize the context factory                 */\r
26         const char* name;                                                                                                                       /* the name of the context factory              */\r
27         \r
28 }s_xbt_context_factory_t;\r
29 \r
30 #ifndef _XBT_CONTEXT_FACTORY_T_DEFINED\r
31 typedef struct s_xbt_context_factory* xbt_context_factory_t;\r
32 #define _XBT_CONTEXT_FACTORY_T_DEFINED\r
33 #endif /* !_XBT_CONTEXT_FACTORY_T_DEFINED */\r
34 \r
35 /**\r
36  * This function select a context factory associated with the name specified by\r
37  * the parameter name.\r
38  * If successful the function returns 0. Otherwise the function returns the error\r
39  * code.\r
40  */\r
41 int\r
42 xbt_context_select_factory(const char* name);\r
43 \r
44 /**\r
45  * This function initialize a context factory from the name specified by the parameter\r
46  * name.\r
47  * If successful the factory specified by the parameter factory is initialized and the\r
48  * function returns 0. Otherwise the function returns the error code.\r
49  */\r
50 int\r
51 xbt_context_init_factory_by_name(xbt_context_factory_t* factory, const char* name);\r
52 \r
53 \r
54 SG_END_DECL()\r
55 \r
56 #endif /* !_XBT_CONTEXT_FACTORY_H */\r