finalise interface & documentation

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
folling 2023-11-06 13:14:39 +01:00 committed by Folling
parent c5157bd849
commit 52580a4382
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
56 changed files with 2074 additions and 780 deletions

40
src/id.hpp Normal file
View file

@ -0,0 +1,40 @@
// IMPLEMENTATION_DETAIL_DATABASE
/// \file id.h
/// \author Folling <folling@ikarus.world>
/// \privatesection
#pragma once
#include <ikarus/macros.h>
#include <ikarus/objects/object_type.h>
#include <ikarus/stdtypes.h>
IKARUS_BEGIN_HEADER
/// \defgroup id Ids
/// \brief Ids are used to identify objects in the database.
/// \details They are stored as 64 bit integers with the following layout:
/// - first bit: ignored, technically we could use it, but SQLite doesn't support u64 integers.
/// To avoid ordering fiascos and potential index performance degradation we just skip the first bit.
/// - next 7 bits: #IkarusObjectType
/// - last 56 bits: incremented counter generated by the database
/// @{
/// \brief A wrapper around a 64 bit integer that represents the id of an object.
/// \details They are stored as 64 bit integers with the following layout:
/// - first bit: ignored, technically we could use it, but SQLite doesn't support u64 integers.
/// To avoid ordering fiascos and potential index performance degradation we just skip the first bit.
/// - next 7 bits: #IkarusObjectType
/// - last 56 bits: incremented counter generated by the database
using IkarusId = int64_t;
/// \brief Fetches the object type of the given id.
/// \param id The id to fetch the object type for.
/// \return The object type of the given id.
IKA_API IkarusObjectType ikarus_id_get_object_type(IkarusId id);
/// @}
IKARUS_END_HEADER