| 1 | /* |
| 2 | * Copyright (c) 2017-2022, Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included |
| 12 | * in all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | */ |
| 22 | //! |
| 23 | //! \file mos_util_user_interface.h |
| 24 | //! \brief Common MOS util user feature key service across different platform |
| 25 | //! \details Common MOS util user feature key service across different platform |
| 26 | //! |
| 27 | #ifndef __MOS_UTIL_USER_INTERFACE_H__ |
| 28 | #define __MOS_UTIL_USER_INTERFACE_H__ |
| 29 | |
| 30 | #include "mos_utilities.h" |
| 31 | |
| 32 | using UserFeatureValueMapType = std::map<uint32_t, PMOS_USER_FEATURE_VALUE>; |
| 33 | |
| 34 | class MosUtilUserInterface |
| 35 | { |
| 36 | public: |
| 37 | MosUtilUserInterface() = default; |
| 38 | virtual ~MosUtilUserInterface() = default; |
| 39 | |
| 40 | //! |
| 41 | //! \brief Add a user feature key to the m_userFeatureKeyMap |
| 42 | //! \details Each component call MosUtilities::MosDeclareUserFeatureKeysFromDescFields to add their specifc user key vlaue to the m_userFeatureKeyMap |
| 43 | //! \return MOS_STATUS |
| 44 | //! Returns one of the MOS_STATUS error codes if failed, |
| 45 | //! else MOS_STATUS_SUCCESS |
| 46 | //! |
| 47 | static MOS_STATUS AddEntry(uint32_t keyId, PMOS_USER_FEATURE_VALUE userFeatureKey); |
| 48 | |
| 49 | //! |
| 50 | //! \brief Del a user feature key from the m_userFeatureKeyMap |
| 51 | //! \details Each component call MosUtilities::MosDestroyUserFeatureKeysFromDescFields to delete their regostered user key from the m_userFeatureKeyMap |
| 52 | //! \return MOS_STATUS |
| 53 | //! Returns one of the MOS_STATUS error codes if failed, |
| 54 | //! else MOS_STATUS_SUCCESS |
| 55 | //! |
| 56 | static MOS_STATUS DelEntry(uint32_t keyId); |
| 57 | |
| 58 | //! |
| 59 | //! \brief Get a user feature key from the m_userFeatureKeyMap |
| 60 | //! \details Get a user feature key from the m_userFeatureKeyMap |
| 61 | //! \return MOS_STATUS |
| 62 | //! Returns one of the MOS_STATUS error codes if failed, |
| 63 | //! else MOS_STATUS_SUCCESS |
| 64 | //! |
| 65 | static PMOS_USER_FEATURE_VALUE GetValue(uint32_t keyId); |
| 66 | |
| 67 | //! |
| 68 | //! \brief Get user feature key map |
| 69 | //! \details Get user feature key map |
| 70 | //! \return UserFeatureValueMapType |
| 71 | //! Returns the map of user feature keys. |
| 72 | //! |
| 73 | static UserFeatureValueMapType& GetUserFeatureKeyMap() |
| 74 | { |
| 75 | return m_userFeatureKeyMap; |
| 76 | } |
| 77 | |
| 78 | private: |
| 79 | static std::map<uint32_t, PMOS_USER_FEATURE_VALUE> m_userFeatureKeyMap; |
| 80 | static MosMutex m_mosMutex; |
| 81 | }; |
| 82 | |
| 83 | |
| 84 | #endif // __MOS_UTIL_USER_INTERFACE_H__ |