diff --git a/src/complex/Common/TypesUtility.hpp b/src/complex/Common/TypesUtility.hpp index 74d4cf7b9e..e3da359777 100644 --- a/src/complex/Common/TypesUtility.hpp +++ b/src/complex/Common/TypesUtility.hpp @@ -374,6 +374,32 @@ inline constexpr DataType StringToDataType(std::string_view dataTypeString) } } +/** + * @brief Returns a DataType for the passed in index + * @param index + * @return + */ +inline std::optional IndexToDataType(usize index) +{ + switch(index) + { + case static_cast(DataType::int8): + case static_cast(DataType::uint8): + case static_cast(DataType::int16): + case static_cast(DataType::uint16): + case static_cast(DataType::int32): + case static_cast(DataType::uint32): + case static_cast(DataType::int64): + case static_cast(DataType::uint64): + case static_cast(DataType::float32): + case static_cast(DataType::float64): + case static_cast(DataType::boolean): + return static_cast(index); + default: + return {}; + } +} + /** * @brief Converts DataType to NumericType. Fails on DataType::bool and DataType::error. * @param dataType