#pragma once #include #include #include /// \file schema.h /// \author Folling /// \addtogroup values Values IKARUS_BEGIN_HEADER /// \brief Schemas define the type of value. /// \details Schemas are used to define the type of value. They are akin to /// classes in programming languages. /// Schemas are used to validate values and structure data. /// /// Given the complexity of schemas, they are transferred as json. /// The json representation of a schema is a map with the following keys: /// - `type` The type of the schema. Must be one of the following: /// - `Primitive` A primitive value. Has the following additional keys: /// - `primitive` The type of the primitive value. \see IkarusPrimitiveType. /// - `Constant` A constant value. Has the following additional keys: /// - `value` The constant value, shared across all values of the schema. /// \see value.h. \remark The schema is derived from the value. /// - `List` A list of values. Has the following additional keys: /// - `schema` The schema of the values in the list. /// - `Map` A map of key-value pairs. Has the following additional keys: /// - `key_schema` The schema of the keys. /// - `value_schema` The schema of the values. /// - `Tuple` A tuple of values. Has the following additional keys: /// - `schemas` The schemas of the values in the tuple. struct IkarusSchema; /// \brief The type of primitive data. enum IkarusValuePrimitiveType { /// \brief A boolean. IkarusValuePrimitiveType_Toggle = 1, /// \brief A 64-bit floating point number. IkarusValuePrimitiveType_Number = 2, /// \brief An arbitrary length string. IkarusValuePrimitiveType_Text = 3 }; /// \brief The type of schema. enum IkarusValueSchemaType { /// \brief A primitive value. \see IkarusPrimitiveType IkarusValueSchemaType_Primitive = 1, /// \brief A homogeneous list of values. IkarusValueSchemaType_List = 2, /// \brief A mapping from Value->Value. IkarusValueSchemaType_Map = 3, /// \brief A heterogeneous list of values. IkarusValueSchemaType_Tuple = 4 }; IKARUS_END_HEADER