// Copyright Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #pragma once #include #include #include #include namespace rocRoller { template T fromString(std::string const& str) { using myInt = std::underlying_type_t; auto maxValue = static_cast(T::Count); for(myInt i = 0; i < maxValue; ++i) { auto val = static_cast(i); if(toString(val) == str) return val; } Throw( "Invalid fromString: type name: ", typeName(), ", string input: ", str); } template std::set enumStrings() { std::set result; using myInt = std::underlying_type_t; auto maxValue = static_cast(T::Count); for(myInt i = 0; i < maxValue; ++i) { result.insert(toString(static_cast(i))); } return result; } }