/* // Copyright (c) 2017 2018 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. */ #pragma once #include #include #include #include #include #include namespace ipmi { using Association = std::tuple; using DbusVariant = std::variant, std::vector, std::vector, std::vector>; using GetSubTreeType = std::vector< std::pair>>>>; using SensorMap = std::map>; namespace types { namespace details { template using underlying_t = typename std::conditional_t, std::underlying_type, std::enable_if>::type; } // namespace details /** * @brief Converts a number or enum class to another * @tparam R - The output type * @tparam T - The input type * @param t - An enum or integer value to cast * @return The value in R form */ template inline R enum_cast(T t) { auto tu = static_cast>(t); auto ru = static_cast>(tu); return static_cast(ru); } } // namespace types } // namespace ipmi