Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add the new integrated files version (use xbt data structures instead my own data...
[simgrid.git] / tools / tesh2 / include / unit.h
diff --git a/tools/tesh2/include/unit.h b/tools/tesh2/include/unit.h
new file mode 100644 (file)
index 0000000..9f3d9b4
--- /dev/null
@@ -0,0 +1,116 @@
+/*\r
+ * include/unit.h - type representing the tesh unit concept.\r
+ *\r
+ * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved. \r
+ *\r
+ * This program is free software; you can redistribute it and/or modify it \r
+ * under the terms of the license (GNU LGPL) which comes with this package.\r
+ *\r
+ * Purpose:\r
+ *             This file contains all the declarations of the functions related with\r
+ *             the tesh unit concept.\r
+ *\r
+ */\r
\r
+#ifndef __UNIT_H       \r
+#define __UNIT_H\r
+\r
+#include <com.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*! \brief unit_new - create a new unit.\r
+ *\r
+ * \param runner       The runner which runs the unit.\r
+ * \param owner                The unit which owns the unit if it is an included unit.\r
+ * \param fstream      The file stream object used to parse the unit.\r
+ *\r
+ * \return                     If successful the function returns the newly created\r
+ *                                     unit. Otherwise the function returns NULL and sets the\r
+ *                                     global variable errno with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if one of the parameters is invalid.\r
+ *                                     [ENOMEM] if the system has not enough space to allocate\r
+ *                                              the unit.\r
+ */\r
+unit_t\r
+unit_new(runner_t runner, unit_t root, unit_t owner, fstream_t fstream);\r
+\r
+/*! \brief unit_free - destroy a tesh unit.\r
+ *\r
+ * \param ptr          A pointer to the unit to destroy.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the pointer to the unit to destroy is invalid.\r
+ */\r
+int\r
+unit_free(unit_t* ptr);\r
+\r
+/*! \brief unit_run - run a tesh unit.\r
+ *\r
+ * \param unit         The unit to run.\r
+ * \param mutex                A mutex used to synchronize the access of the runner properties.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the unit specified as parameter is invalid.\r
+ *                                              if the mutex specified as parameter is invalid.\r
+ *\r
+ * remarks :           If the runner is interrupted during a call of this function,\r
+ *                                     the unit is not launched but its flag interrupted is signaled.\r
+ */\r
+int\r
+unit_run(unit_t unit, xbt_os_mutex_t mutex);\r
+\r
+\r
+/*! \brief unit_interrupt - interrupt a tesh unit.\r
+ *\r
+ * \param unit         The unit to interrupt.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the unit specified as parameter is invalid.\r
+ *                                     [EALREADY] if the unit is already interrupted.\r
+ *\r
+ * remarks :           If the runner is interrupted during a call of this function,\r
+ *                                     the unit is not launched but its flag interrupted is signaled.\r
+ */\r
+int\r
+unit_interrupt(unit_t unit);\r
+\r
+/*! \brief unit_summuarize - summarize the run of tesh unit.\r
+ *\r
+ * \param unit         The unit to summarize the run.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the unit specified as parameter is invalid.\r
+ */\r
+int\r
+unit_summuarize(unit_t unit);\r
+\r
+int\r
+unit_reset(unit_t unit);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* !__UNIT_H */\r