+/** @addtogroup GRAS_dd Data description
+ * @brief Describing data to be exchanged (Communication facility)
+ *
+ * @section Overview
+ *
+ * Since GRAS takes care of potential representation conversion when the platform is heterogeneous,
+ * any data which transits on the network must be described beforehand.
+ *
+ * There is several possible interfaces for this, ranging from the really completely automatic parsing to
+ * completely manual. Let's study each of them from the simplest to the more advanced.
+ *
+ * \warning At least, I would like to present those sections in the right order, but doxygen prevents me
+ * from doing so. There is a weird bug I fail to circumvent here. The right order is naturally:
+ * -# basic operations
+ * -# Automatic parsing
+ * -# Simple manual definitions
+ * -# Callback Persistant State: Simple push/pop mechanism
+ * -# Callback Persistant State: Full featured mechanism
+ */
+/* @{*/
+
+/** @name 1. basic operations
+ *
+ * If you only want to send pre-existing types, simply retrieve the pre-defined description with
+ * the \ref gras_datadesc_by_name function. Existing types entail:
+ * - char (both signed and unsigned)
+ * - int (short, regular, long and long long, both signed and unsigned)
+ * - float and double
+ * - string (which is indeed a reference to a dynamically sized array of char, strlen being used to retrive the size)
+ *
+ * Example:\verbatim gras_datadesc_type_t i = gras_datadesc_by_name("int");
+ gras_datadesc_type_t uc = gras_datadesc_by_name("unsigned char");
+ gras_datadesc_type_t str = gras_datadesc_by_name("string");\endverbatim
+ */
+/* @{ */
+
+/** @brief Opaque type describing a type description. */
+typedef struct s_gras_datadesc_type *gras_datadesc_type_t;
+
+/** \brief Search a type description from its name */
+gras_datadesc_type_t gras_datadesc_by_name(const char *name);
+
+/* @} */
+
+/** @name 2. Automatic parsing
+ *
+ * If you need to declare a new datatype, this is the simplest way to describe it to GRAS. Simply
+ * enclose its type definition into a \ref GRAS_DEFINE_TYPE macro call, and you're set. Here is
+ * an type declaration example: \verbatim GRAS_DEFINE_TYPE(mytype,struct mytype {
+ int myfirstfield;
+ char mysecondfield;
+ });\endverbatim
+ * The type is then both copied verbatim into your source file and stored for further parsing. This allows
+ * you to let GRAS parse the exact version you are actually using in your program.
+ * You can then retrieve the corresponding type description with \ref gras_datadesc_by_symbol.
+ * Don't worry too much for the performances, the type is only parsed once and a binary representation
+ * is stored and used in any subsequent calls.
+ *
+ * If your structure contains any pointer, you have to explain GRAS the size of the pointed array. This
+ * can be 1 in the case of simple references, or more in the case of regular arrays. For that, use the
+ * \ref GRAS_ANNOTE macro within the type declaration you are passing to \ref GRAS_DEFINE_TYPE. This macro
+ * rewrites itself to nothing in the declaration (so they won't pollute the type definition copied verbatim
+ * into your code), and give some information to GRAS about your pointer.
+
+ * GRAS_ANNOTE takes two arguments being the key name and the key value. For now, the only accepted key name
+ * is "size", to specify the length of the pointed array. It can either be the string "1" (without the quote)
+ * or the name of another field of the structure.
+ *
+ * Here is an example:\verbatim GRAS_DEFINE_TYPE(s_clause,
+ struct s_array {
+ int length;
+ int *data GRAS_ANNOTE(size,length);
+ struct s_array *father GRAS_ANNOTE(size,1);
+ }
+;)\endverbatim
+ * It specifies that the structure s_array contains two fields, and that the size of the array pointed
+ * by \a data is the \a length field, and that the \a father field is a simple reference.
+ *
+ * If you cannot express your datadescs with this mechanism, you'll have to use the more advanced
+ * (and somehow complex) one described below.
+ *
+ * \warning Since GRAS_DEFINE_TYPE is a macro, you shouldn't put any comma in your type definition
+ * (comma separates macro args).
+ *
+ * For example, change \verbatim int a, b;\endverbatim to \verbatim int a;
+ int b:\endverbatim
+ */
+/** @{ */
+
+
+/** @brief Automatically parse C code
+ * @hideinitializer
+ */
+#define GRAS_DEFINE_TYPE(name,def) \
+ static const char * _gras_this_type_symbol_does_not_exist__##name=#def; def
+
+/** @brief Retrieve a datadesc which was previously parsed
+ * @hideinitializer
+ */
+#define gras_datadesc_by_symbol(name) \
+ (gras_datadesc_by_name(#name) ? \
+ gras_datadesc_by_name(#name) : \
+ gras_datadesc_parse(#name, \
+ _gras_this_type_symbol_does_not_exist__##name) \
+ )