48 lines
1.8 KiB
C
48 lines
1.8 KiB
C
#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
|