#pragma once /// \file number_value.h /// \author Folling #include #include /// \addtogroup values Values /// @{ IKARUS_BEGIN_HEADER /// \brief A numeric value. For example "Age" or "Height". struct IkarusNumberValue; /// \brief Creates a number value from long doubles. /// \param data The number data or null if you wish to create an empty value. /// \details LibIkarus does not take ownership of this array. /// \param data_size The size of the data array. /// \return The value or null if an error occurs. /// \remark Must be freed with #ikarus_free. IKA_API IkarusNumberValue * ikarus_number_value_create(long double * data, size_t data_size); /// \brief Creates an indeterminate number value. /// \return The value. /// \remark Must be freed with #ikarus_free. IKA_API IkarusNumberValue * ikarus_number_value_create_indeterminate(); /// \brief Fetches the underlying data of a number value at a specific index. /// \param value The number value. /// \pre \li Must not be null. /// \param idx The index of the data to fetch. /// \pre \li Must be less than the size of the value. /// \return The underlying data or null if an error occurs or the value is indeterminate. IKA_API long double const * ikarus_number_value_get(IkarusNumberValue * value, size_t idx); /// \brief Fetches the size of the underlying data of a number value. /// \param value The number value. /// \pre \li Must not be null. /// \return The size of the underlying data or 0 if an error occurs or the value is indeterminate. IKA_API size_t ikarus_number_value_get_size(IkarusNumberValue const * value); /// \brief Sets the data of a number value at a specific index. /// \param value The number value. /// \pre \li Must not be null. /// \param idx The index of the data to set. /// \pre \li Must be less than the size of the value. /// \param new_data The new data. IKA_API void ikarus_number_value_set(IkarusNumberValue * value, size_t idx, long double new_data); /// \brief Removes a data from a number value. /// \param value The number value. /// \pre \li Must not be null. /// \param idx The index of the data to remove. /// \pre \li Must be less than the size of the value. /// \remark This will shift all data after the index by one to the left. IKA_API void ikarus_number_value_remove(IkarusNumberValue * value, size_t idx); /// \brief Inserts a data into a number value. /// \param value The number value. /// \pre \li Must not be null. /// \param idx The index of the data to insert. /// \pre \li Must be less than or equal to the size of the value. /// \param new_data The new data. /// \remark This will shift all data after the index by one to the right. IKA_API void ikarus_number_insert(IkarusNumberValue * value, size_t idx, long double new_data); /// \brief Converts a number value to an entity value. /// \param value The number value to convert. /// \return The converted entity value. IKA_API struct IkarusValue * ikarus_number_value_to_value(IkarusNumberValue * value); IKARUS_END_HEADER /// @}