diff --git a/doc/source/protocol/datatypes.rst b/doc/source/protocol/datatypes.rst index e851352..c92a8af 100644 --- a/doc/source/protocol/datatypes.rst +++ b/doc/source/protocol/datatypes.rst @@ -1,77 +1,175 @@ Datatypes ========= +double +------ + .. list-table:: - :header-rows: 1 + :widths: 20 80 + :stub-columns: 1 - * - Data type - - Specification (simple) - - Specification (with limits) - - Transport example - - Datatype used in C/C++ API - - Remarks + * - Datatype + - | ["double"] **or** + | ["double", ] **or** + | ["double", , ] + | + | if is not given or null, there is no upper limit + | if is null or not given, there is no lower limit - * - double - - ["double"] - - ["double", , ] - - 3.14159265 - - double - - + * - Transport example + - | 3.14159265 - * - int - - ["int"] - - ["int", , ] - - -55 - - int64_t - - + * - Datatype in C/C++ + - | double - * - bool - - ["bool"] - - - - true - - int64_t - - +int +--- - * - enum - - ["enum", { : , ....}] - - - - 1 - - int64_t - - +.. list-table:: + :widths: 20 80 + :stub-columns: 1 - * - string - - ["string"] - - ["string", , ] - - "hello!" - - char * - - + * - Datatype + - | ["int"] **or** + | ["int", ] **or** + | ["int", , ] + | + | if is not given or null, there is no upper limit + | if is null or not given, there is no lower limit - * - blob - - ["blob"] - - ["blob", , ] - - "AA==" - - struct {int64_t len, char \*data} - - transport is base64 encoded + * - Transport example + - | -55 - * - array - - ["array", ] - - ["array", , , ] - - [3,4,7,2,1] - - [] - - + * - Datatype in C/C++ + - | int64_t - * - tuple - - ["tuple", [, , ...]] - - - - [0,"idle"] - - struct ?? - - +bool +---- - * - struct - - ["struct", { : , : , ....}] - - - - {"x": 0, "y": 1} - - struct ?? - - - +.. list-table:: + :widths: 20 80 + :stub-columns: 1 + * - Datatype + - | ["bool"] + + * - Transport example + - | true + + * - Datatype in C/C++ + - | int64_t + + +enum +---- + +.. list-table:: + :widths: 20 80 + :stub-columns: 1 + + * - Datatype + - | ["enum", { : , ....}] + + * - Transport example + - | 2 + + * - Datatype in C/C++ + - | int64_t + + +string +------ + +.. list-table:: + :widths: 20 80 + :stub-columns: 1 + + * - Datatype + - | ["string"] **or** + | ["string", ] **or** + | ["string", , ] + | + | if is not given, it is assumed as 255. + | if is not given, it is assumed as 0. + | if the string is UTF-8 encoded, the length is counting the number of bytes, not characters + + * - Transport example + - | "hello!" + + * - Datatype in C/C++ + - | char \* + +blob +---- + +.. list-table:: + :widths: 20 80 + :stub-columns: 1 + + * - Datatype + - | ["blob", ] **or** + | ["blob", , ] + | + | if is not given, it is assumed as 255. + | if the string is UTF-8 encoded, the length is counting the number of bytes, not characters + | if is not given, it is assumed as 0. + + * - Transport example + - | "AA==" (base64 encoded) + + * - Datatype in C/C++ + - | struct {int64_t len, char \*data} + +array +----- + +.. list-table:: + :widths: 20 80 + :stub-columns: 1 + + * - Datatype + - | ["array", , ] **or** + | ["array", , , ] + | + | if is not given, it is assumed as 0. + | the length is the number of elements + + * - Transport example + - | [3,4,7,2,1] + + * - Datatype in C/C++ + - | [] + +tuple +----- + +.. list-table:: + :widths: 20 80 + :stub-columns: 1 + + * - Datatype + - | ["tuple", [, , ...]] + + * - Transport example + - | [0,"idle"] + + * - Datatype in C/C++ + - | struct ?? + +struct +------ + +.. list-table:: + :widths: 20 80 + :stub-columns: 1 + + * - Datatype + - | ["struct", { : , : , ....}] + + * - Transport example + - | {"x": 0, "y": 1} + + * - Datatype in C/C++ + - | struct ?? + | + | might be null