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
diff --git a/src/xbt/xbt_context_factory.h b/src/xbt/xbt_context_factory.h
new file mode 100644 (file)
index 0000000..b6f1a99
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef _XBT_CONTEXT_FACTORY_H \r
+#define _XBT_CONTEXT_FACTORY_H\r
+\r
+#include "portable.h"\r
+#include "xbt/function_types.h"\r
+#include "xbt_context_private.h"\r
+\r
+SG_BEGIN_DECL()\r
+\r
+/* forward declaration */\r
+struct s_xbt_context_factory;\r
+\r
+/* this function describes the interface that all context factory must implement */\r
+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
+typedef int (*xbt_pfn_context_factory_create_maestro_context_t)(xbt_context_t*);\r
+\r
+/* this function finalize the specified context factory */\r
+typedef int (*xbt_pfn_context_factory_finalize_t)(struct s_xbt_context_factory**);\r
+\r
+/* this interface is used by the xbt context module to create the appropriate concept */\r
+typedef struct s_xbt_context_factory\r
+{\r
+       xbt_pfn_context_factory_create_maestro_context_t create_maestro_context;        /* create the context of the maestro    */\r
+       xbt_pfn_context_factory_create_context_t create_context;                                        /* create a new context                                 */\r
+       xbt_pfn_context_factory_finalize_t finalize;                                                            /* finalize the context factory                 */\r
+       const char* name;                                                                                                                       /* the name of the context factory              */\r
+       \r
+}s_xbt_context_factory_t;\r
+\r
+#ifndef _XBT_CONTEXT_FACTORY_T_DEFINED\r
+typedef struct s_xbt_context_factory* xbt_context_factory_t;\r
+#define _XBT_CONTEXT_FACTORY_T_DEFINED\r
+#endif /* !_XBT_CONTEXT_FACTORY_T_DEFINED */\r
+\r
+/**\r
+ * This function select a context factory associated with the name specified by\r
+ * the parameter name.\r
+ * If successful the function returns 0. Otherwise the function returns the error\r
+ * code.\r
+ */\r
+int\r
+xbt_context_select_factory(const char* name);\r
+\r
+/**\r
+ * This function initialize a context factory from the name specified by the parameter\r
+ * name.\r
+ * If successful the factory specified by the parameter factory is initialized and the\r
+ * function returns 0. Otherwise the function returns the error code.\r
+ */\r
+int\r
+xbt_context_init_factory_by_name(xbt_context_factory_t* factory, const char* name);\r
+\r
+\r
+SG_END_DECL()\r
+\r
+#endif /* !_XBT_CONTEXT_FACTORY_H */\r