finalize schema/data setup

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2025-01-01 13:49:05 +01:00
parent 70820129ae
commit 195f51d3d0
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
89 changed files with 2324 additions and 6271 deletions

View file

@ -0,0 +1,48 @@
#pragma once
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \file data.h
/// \author Folling <mail@folling.io>
/// \addtogroup values Values
IKARUS_BEGIN_HEADER
/// \brief Data stores the actual information of a value.
/// \details Data is schemaless and can store any kind of data. Only when the
/// data is combined with a schema does it become a value. \see value.h.
/// Given the complexity of data, they are transferred as json.
/// The json representation of a data is a map with the following keys:
/// - `type` The type of the data. \see IkarusValueDataType. Must be one of the
/// following:
/// - `Primitive` A primitive value. Has two additional key:
/// - `primitive` The type of the primitive. Must be one of the following:
/// - `data` The stored data. Must be either a bool, double, or string.
/// - `Constant` A constant value. Has no additional keys, as the constant
/// value is shared across all values.
/// - `List` A list of values. Has the following additional keys:
/// - `data` An array of stored data.
/// - `Map` A map of key-value pairs. Has the following additional keys:
/// - `data` An array of key-value pairs.
/// - `Tuple` A tuple of values. Has the following additional keys:
/// - `data` An array of stored data.
/// Note that each sub-data is also a data, allowing for arbitrarily nested data
/// structures.
struct IkarusValueData;
/// \brief The type of data.
enum IkarusValueDataType {
/// \brief A primitive value. \see IkarusValuePrimitiveType.
IkarusValueDataType_Primitive = 1,
/// \brief A list of values.
IkarusValueDataType_List = 2,
/// \brief A map of key-value pairs.
IkarusValueDataType_Map = 3,
/// \brief A tuple of values.
IkarusValueDataType_Tuple = 4,
};
IKARUS_END_HEADER